From: SourceForge.net <no...@so...> - 2010-02-02 14:11:41
|
Bugs item #2942363, was opened at 2010-01-29 17:49 Message generated for change (Settings changed) made by mguillem You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=952178&aid=2942363&group_id=195122 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: mhnrec (mhnrec) >Assigned to: Marc Guillemot (mguillem) Summary: NullPointerException in bindNamespaces Initial Comment: Got follwing NPE with 1.9.12 and 1.9.13 java.lang.NullPointerException at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:450) at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:325) at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3041) at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1993) at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:910) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.ajax4jsf.webapp.nekko.NekkoParser.parseSAXSource(NekkoParser.java:233) Local var attrs is null ---------------------------------------------------------------------- >Comment By: Marc Guillemot (mguillem) Date: 2010-02-02 15:11 Message: Thanks. Now fixed in SVN. Just curious: for which purpose does Richfaces use NekoHTML? ---------------------------------------------------------------------- Comment By: mhnrec (mhnrec) Date: 2010-02-02 12:21 Message: I added a small Test class. I do not use cyberneko parser directly. It is used from another framework I use: Richfaces from JBOSS. Open the class and change the filename to your environment ---------------------------------------------------------------------- Comment By: Marc Guillemot (mguillem) Date: 2010-02-02 11:23 Message: can you provide a minimal java code causing this error while parsing the attached html? ---------------------------------------------------------------------- Comment By: mhnrec (mhnrec) Date: 2010-02-02 11:17 Message: I got this exception also a few weeks ago wutg 1.9.13. It still occurs if the snapshot nekohtml-1.9.14-20100122.114035-12.jar. new Stack: java.lang.NullPointerException at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:450) at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:325) at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2999) at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1991) at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:895) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.ajax4jsf.webapp.nekko.NekkoParser.parseSAXSource(NekkoParser.java:233) There is still no null check for attrs in this section: if(fInsertNamespaces && HTMLElements.getElement(element.localpart, null) != null && (element.prefix == null || fNamespaceContext.getURI(element.prefix) == null)) { String xmlns = "xmlns" + (element.prefix == null ? "" : ":" + element.prefix); fQName.setValues(null, xmlns, xmlns, null); attrs.addAttribute(fQName, "CDATA", fNamespacesURI); A few lines later it is checked again for null: attrCount = attrs == null ? 0 : attrs.getLength(); ---------------------------------------------------------------------- Comment By: Marc Guillemot (mguillem) Date: 2010-02-01 17:17 Message: Can you try with latest sources from SVN (or snapshot: http://build.canoo.com/NekoHTML/artifacts//m2-repo/net/sourceforge/nekohtml/nekohtml/1.9.14-SNAPSHOT/nekohtml-1.9.14-20100122.114035-12.jar): it seems to me that the problem has been fixed since release 1.9.13. ---------------------------------------------------------------------- Comment By: mhnrec (mhnrec) Date: 2010-02-01 17:07 Message: I added sample html last friday. Htlm is invalid and bug is caused by not correctly nested div tag. ---------------------------------------------------------------------- Comment By: Marc Guillemot (mguillem) Date: 2010-01-29 18:10 Message: An example? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=952178&aid=2942363&group_id=195122 |