commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Diviacco <patrick.divia...@gmail.com>
Subject Re: [digester] NullPointerException
Date Fri, 01 Apr 2011 08:05:47 GMT
Cool thanks, solved.

On 1 April 2011 01:00, Simone Tripodi <simonetripodi@apache.org> wrote:

> Patrick,
> just replace
>
> 71    digester.addObjectCreate("collection", XMLReader.class);
>
> with
>
>    digester.push(this);
>
>
>
> Otherwise
>
> 30    ArrayList<ArrayList<String>> docs;
>
> with
>
> 30    ArrayList<ArrayList<String>> docs = new
> ArrayList<ArrayList<String>>();
>
> and remove line 64
>
> I suggest you the first option
>
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://www.99soft.org/
>
>
>
> On Fri, Apr 1, 2011 at 12:36 AM, Patrick Diviacco
> <patrick.diviacco@gmail.com> wrote:
> > Sure, here you are
> >
> > http://dl.dropbox.com/u/72686/trainSmall.xml
> >
> > and
> >
> > http://dl.dropbox.com/u/72686/testSmall.xml
> >
> > I was wondering if the issue is that XMLReader has been created as static
> > object...
> >
> > thanks
> >
> >
> > On 1 April 2011 00:26, Simone Tripodi <simonetripodi@apache.org> wrote:
> >
> >> Hi Patrick,
> >> can you link also to the XML you're trying to parse?
> >> Simo
> >>
> >> http://people.apache.org/~simonetripodi/
> >> http://www.99soft.org/
> >>
> >>
> >>
> >> On Thu, Mar 31, 2011 at 10:24 PM, Patrick Diviacco
> >> <patrick.diviacco@gmail.com> wrote:
> >> > Hi,
> >> >
> >> > I'm trying to store the content of a xml file into memory but for some
> >> > reason I get following NullPointerException.. (this is the code:
> >> > http://pastie.org/1740948):
> >> >
> >> > Clusterer...
> >> > Reading XML...
> >> > Mar 31, 2011 10:19:17 PM org.apache.commons.digester.Digester
> endElement
> >> > SEVERE: End event threw exception
> >> > java.lang.reflect.InvocationTargetException
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> >
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> > at
> >> >
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
> >> > at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220)
> >> > at org.apache.commons.digester.Rule.end(Rule.java:257)
> >> > at org.apache.commons.digester.Digester.endElement(Digester.java:1345)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
> >> > at org.apache.commons.digester.Digester.parse(Digester.java:1871)
> >> > at XMLReader.read(XMLReader.java:74)
> >> > at Clusterer.<init>(Clusterer.java:49)
> >> > at Main.main(Main.java:11)
> >> > Caused by: java.lang.NullPointerException
> >> > at XMLReader$FlickrCollection.addDocument(XMLReader.java:108)
> >> > ... 22 more
> >> > java.lang.NullPointerException
> >> > at
> >> >
> >>
> org.apache.commons.digester.Digester.createSAXException(Digester.java:3363)
> >> > at
> >> >
> >>
> org.apache.commons.digester.Digester.createSAXException(Digester.java:3389)
> >> > at org.apache.commons.digester.Digester.endElement(Digester.java:1348)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
> >> > Reading XML...
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
> >> > at org.apache.commons.digester.Digester.parse(Digester.java:1871)
> >> > at XMLReader.read(XMLReader.java:74)
> >> > at Clusterer.<init>(Clusterer.java:49)
> >> > at Main.main(Main.java:11)
> >> > Caused by: java.lang.NullPointerException
> >> > at XMLReader$FlickrCollection.addDocument(XMLReader.java:108)
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> >
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> > at
> >> >
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
> >> > at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220)
> >> > at org.apache.commons.digester.Rule.end(Rule.java:257)
> >> > at org.apache.commons.digester.Digester.endElement(Digester.java:1345)
> >> > ... 14 more
> >> > Mar 31, 2011 10:19:17 PM org.apache.commons.digester.Digester
> endElement
> >> > SEVERE: End event threw exception
> >> > java.lang.reflect.InvocationTargetException
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> >
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> > at
> >> >
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
> >> > at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220)
> >> > at org.apache.commons.digester.Rule.end(Rule.java:257)
> >> > at org.apache.commons.digester.Digester.endElement(Digester.java:1345)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
> >> > at org.apache.commons.digester.Digester.parse(Digester.java:1871)
> >> > at XMLReader.read(XMLReader.java:74)
> >> > at Clusterer.<init>(Clusterer.java:50)
> >> > at Main.main(Main.java:11)
> >> > Caused by: java.lang.NullPointerException
> >> > at XMLReader$FlickrCollection.addDocument(XMLReader.java:108)
> >> > ... 22 more
> >> > java.lang.NullPointerException
> >> > at
> >> >
> >>
> org.apache.commons.digester.Digester.createSAXException(Digester.java:3363)
> >> > at
> >> >
> >>
> org.apache.commons.digester.Digester.createSAXException(Digester.java:3389)
> >> > at org.apache.commons.digester.Digester.endElement(Digester.java:1348)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
> >> > at
> >> >
> >>
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
> >> > at org.apache.commons.digester.Digester.parse(Digester.java:1871)
> >> > at XMLReader.read(XMLReader.java:74)
> >> > at Clusterer.<init>(Clusterer.java:50)
> >> > at Main.main(Main.java:11)
> >> > Caused by: java.lang.NullPointerException
> >> > at XMLReader$FlickrCollection.addDocument(XMLReader.java:108)
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> >
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> > at
> >> >
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
> >> > at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220)
> >> > at org.apache.commons.digester.Rule.end(Rule.java:257)
> >> > []
> >> > []
> >> > at org.apache.commons.digester.Digester.endElement(Digester.java:1345)
> >> > ... 14 more
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: user-help@commons.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message