Version of neko: 1.9.14
Stacktrace:
java.lang.StackOverflowError
at org.apache.xerces.util.XMLAttributesImpl.getTableViewBucket(Unknown Source)
at org.apache.xerces.util.XMLAttributesImpl.addAttribute(Unknown Source)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:450)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
at org.cyberneko.html.filters.NamespaceBinder.bindNamespaces(NamespaceBinder.java:451)
...
...
HTML snipset that triggers the error:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>some stuff</title></head><body><div class='breadcrump' xmlns=''><b xmlns:x=""> toto </b></div></body></body>
The xmlns='' is the cause of the stackoverflow error.
Neko config:
nekoParser.setFeature("http://cyberneko.org/html/features/override-namespaces", true);
nekoParser.setFeature("http://cyberneko.org/html/features/insert-namespaces", true);
nekoParser.setFeature("http://cyberneko.org/html/features/scanner/script/strip-comment-delims", true);
nekoParser.setProperty("http://cyberneko.org/html/properties/names/elems", "lower");
nekoParser.setFeature("http://cyberneko.org/html/features/balance-tags/document-fragment", true);
Proposed Patch (this works in our cases, but I do not clearly now if there are some side effects...):
--- org/cyberneko/html/filters/NamespaceBinder.java~ 2010-02-02 14:59:58.000000000 +0100
+++ org/cyberneko/html/filters/NamespaceBinder.java 2010-11-15 14:12:12.000000000 +0100
@@ -423,7 +423,9 @@
HTMLElements.getElement(element.localpart, null) != null) {
uri = fNamespacesURI;
}
- fNamespaceContext.declarePrefix(prefix, uri);
+ if (uri != null && !"".equals(uri)) {
+ fNamespaceContext.declarePrefix(prefix, uri);
+ }
}
}
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
This patch seems to fix the problem:
@@ -1001,7 +1001,10 @@
if (depth == -1) {
if (elem.code == HTMLElements.P) {
forceStartElement(element, emptyAttributes(), synthesizedAugs());
- endElement(element, augs);
+ boolean startElementWasCreated =forceStartElement(element, emptyAttributes(), synthesizedAugs());
+ if (startElementWasCreated) {
+ endElement(element, augs);
+ }
}
else if (!elem.isEmpty()) {
notifyDiscardedEndElement(element, augs);