OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

java.lang.NullPointerException



Dear colleagues. I am a newbie.
I hope to be helped here. My java-code doesn't work.

public class XGLanls {
        public void analyse(String filename) {
                try {
                        File f = new File(filename);
                        InputSource is = new InputSource(f.toURL().toString());
                        
                        HandlerBase h = new MyHandler();
                
                        Parser p = ParserFactory.makeParser("org.apache.xerces.parsers.SAXParser");
                
                        p.setDocumentHandler(h);
                        p.setErrorHandler(h);
                        
                        p.parse(is);
                } catch (Exception e) {
                        e.printStackTrace(System.err);
                }
        }
}

It gives the exception

java.lang.NullPointerException
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1094)
        at com.wolf.tra.xglanls.XGLanls.analyse(XGLanls.java:32)