Author: thorsten
Date: Fri Oct 17 05:04:24 2008
New Revision: 705573
URL: http://svn.apache.org/viewvc?rev=705573&view=rev
Log:
Adding work around for a bug I found with xsl:sort. Using xsl:sort in the
dispatcher has thrown a NPE from xalan. It seems to me like a xalan bug. See
http://markmail.org/message/5bekq5goyeik7q7l for background information.
However the workaround is actually not bad at all and we can leave it in place
even after the problem is solved in xalan.
Modified:
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/Captions.java
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java
Modified:
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/Captions.java
URL:
http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/Captions.java?rev=705573&r1=705572&r2=705573&view=diff
==============================================================================
---
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/Captions.java
(original)
+++
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/Captions.java
Fri Oct 17 05:04:24 2008
@@ -65,5 +65,7 @@
public static final String PART_ELEMENT = "part";
public static final String NS_CONTRACTS =
NS;//"http://apache.org/forrest/templates/1.0";
+
+ public static final String NS_XSL = "http://www.w3.org/1999/XSL/Transform";
}
Modified:
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java
URL:
http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java?rev=705573&r1=705572&r2=705573&view=diff
==============================================================================
---
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java
(original)
+++
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java
Fri Oct 17 05:04:24 2008
@@ -319,8 +319,18 @@
*/
public static XMLEvent createStartElementNS(final XMLStreamReader reader,
final XMLEvent currentEvent) {
QName name = currentEvent.asStartElement().getName();
+ Iterator namespaces = null;
+ /*
+ * Workaround to a xalan bug see thread
+ * http://markmail.org/message/5bekq5goyeik7q7l
+ *
+ * We will only append ns declaration for xsl:stylesheet any other xsl
element needs to be
+ * child of this element in any form so we are save to do so.
+ */
+ if (!(name.getNamespaceURI().equals(Captions.NS_XSL) &&
!name.getLocalPart().equals("stylesheet"))){
+ namespaces = allocateNamespacesForced(name, reader);
+ }
Iterator attributes = allocateAttributes(reader);
- Iterator namespaces = allocateNamespacesForced(name, reader);
return createStartElement(name, attributes, namespaces);
}
}