This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 50021
Collapse All | Expand All

(-)projects/libraries/src/org/netbeans/modules/project/libraries/LibrariesStorage.java (-5 / +4 lines)
Lines 20-26 Link Here
20
import java.beans.PropertyChangeSupport;
20
import java.beans.PropertyChangeSupport;
21
21
22
22
23
import org.openide.filesystems.FileObject;
24
import org.openide.ErrorManager;
23
import org.openide.ErrorManager;
25
import org.openide.util.NbBundle;
24
import org.openide.util.NbBundle;
26
import org.openide.xml.EntityCatalog;
25
import org.openide.xml.EntityCatalog;
Lines 98-106 Link Here
98
        libraries = new HashMap();
97
        libraries = new HashMap();
99
        librariesByFileNames = new HashMap();
98
        librariesByFileNames = new HashMap();
100
        LibraryDeclarationHandlerImpl handler = new LibraryDeclarationHandlerImpl();
99
        LibraryDeclarationHandlerImpl handler = new LibraryDeclarationHandlerImpl();
101
        EntityResolver resolver = EntityCatalog.getDefault();
100
//        EntityResolver resolver = EntityCatalog.getDefault();
102
        LibraryDeclarationConvertorImpl convertor = new LibraryDeclarationConvertorImpl();
101
        LibraryDeclarationConvertorImpl convertor = new LibraryDeclarationConvertorImpl();
103
        LibraryDeclarationParser parser = new LibraryDeclarationParser(handler,resolver,convertor);
102
        LibraryDeclarationParser parser = new LibraryDeclarationParser(handler, null /*resolver*/,convertor);
104
        // parse
103
        // parse
105
        FileObject libraryDefinitions[] = storage.getChildren();
104
        FileObject libraryDefinitions[] = storage.getChildren();
106
        for (int i = 0; i < libraryDefinitions.length; i++) {
105
        for (int i = 0; i < libraryDefinitions.length; i++) {
Lines 137-145 Link Here
137
    
136
    
138
    private static LibraryImplementation readLibrary (FileObject descriptorFile, LibraryImplementation impl) throws SAXException, javax.xml.parsers.ParserConfigurationException, IOException {
137
    private static LibraryImplementation readLibrary (FileObject descriptorFile, LibraryImplementation impl) throws SAXException, javax.xml.parsers.ParserConfigurationException, IOException {
139
        LibraryDeclarationHandlerImpl handler = new LibraryDeclarationHandlerImpl();
138
        LibraryDeclarationHandlerImpl handler = new LibraryDeclarationHandlerImpl();
140
        EntityResolver resolver = EntityCatalog.getDefault();
139
        // EntityResolver resolver = EntityCatalog.getDefault();
141
        LibraryDeclarationConvertorImpl convertor = new LibraryDeclarationConvertorImpl();
140
        LibraryDeclarationConvertorImpl convertor = new LibraryDeclarationConvertorImpl();
142
        LibraryDeclarationParser parser = new LibraryDeclarationParser(handler,resolver,convertor);
141
        LibraryDeclarationParser parser = new LibraryDeclarationParser(handler, null /*resolver*/,convertor);
143
        handler.setLibrary (impl);
142
        handler.setLibrary (impl);
144
        readLibrary (descriptorFile, parser);
143
        readLibrary (descriptorFile, parser);
145
        return handler.getLibrary();
144
        return handler.getLibrary();
(-)projects/libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationParser.java (-6 / +21 lines)
Lines 13-18 Link Here
13
13
14
package org.netbeans.modules.project.libraries;
14
package org.netbeans.modules.project.libraries;
15
15
16
import java.io.ByteArrayInputStream;
17
import java.io.InputStream;
18
import org.openide.xml.XMLUtil;
16
import org.xml.sax.*;
19
import org.xml.sax.*;
17
20
18
/**
21
/**
Lines 26-32 Link Here
26
 * <p><b>Warning:</b> the class is machine generated. DO NOT MODIFY</p>
29
 * <p><b>Warning:</b> the class is machine generated. DO NOT MODIFY</p>
27
 *
30
 *
28
 */
31
 */
29
public class LibraryDeclarationParser implements ContentHandler {
32
public class LibraryDeclarationParser implements ContentHandler, EntityResolver {
30
    
33
    
31
    private java.lang.StringBuffer buffer;
34
    private java.lang.StringBuffer buffer;
32
    
35
    
Lines 225-237 Link Here
225
    }
228
    }
226
    
229
    
227
    private static void parse(final InputSource input, final LibraryDeclarationParser recognizer) throws SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException {
230
    private static void parse(final InputSource input, final LibraryDeclarationParser recognizer) throws SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException {
228
        javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance();
231
        XMLReader parser = XMLUtil.createXMLReader(false, false); //the code was generated according DTD
229
        factory.setValidating(true);  //the code was generated according DTD
230
        factory.setNamespaceAware(false);  //the code was generated according DTD
231
        XMLReader parser = factory.newSAXParser().getXMLReader();
232
        parser.setContentHandler(recognizer);
232
        parser.setContentHandler(recognizer);
233
        parser.setErrorHandler(recognizer.getDefaultErrorHandler());
233
        parser.setErrorHandler(recognizer.getDefaultErrorHandler());
234
        if (recognizer.resolver != null) parser.setEntityResolver(recognizer.resolver);
234
        if (recognizer.resolver != null) {
235
            parser.setEntityResolver(recognizer.resolver);
236
        }
237
        else {
238
            parser.setEntityResolver(recognizer);
239
        }
235
        parser.parse(input);
240
        parser.parse(input);
236
    }
241
    }
237
    
242
    
Lines 257-261 Link Here
257
        
262
        
258
    }
263
    }
259
    
264
    
265
    /** Implementation of entity resolver. Points to the local DTD
266
     * for our public ID */
267
    public InputSource resolveEntity (String publicId, String systemId)
268
    throws SAXException {
269
        if ("-//NetBeans//DTD Library Declaration 1.0//EN".equals(publicId)) {
270
            InputStream is = new ByteArrayInputStream(new byte[0]);
271
            return new InputSource(is);
272
        }
273
        return null; // i.e. follow advice of systemID
274
    }
260
}
275
}
261
276

Return to bug 50021