Details
Description
Bea's stax implementation throws an IllegalArgumentException if XMLStreamWriter.getPrefix is called with null or "" (EMPTY_STRING) argument as URI.
This can be reproduced with the CustomXFireFaultTest using -Djavax.xml.stream.XMLInputFactory=weblogic.xml.stax.XMLStreamInputFactory and having weblogic.jar on the classpath of the JUnit test.
The quick workaround is to test for empty namespace url and assume an empty prefix (I'm not sure if this applies to all situations.)
Checked in Revision 2153:
Index: StaxSerializer.java
===================================================================
— StaxSerializer.java (revision 1673)
+++ StaxSerializer.java (revision 2153)
@@ -41,7 +41,12 @@
String elPrefix = e.getNamespacePrefix();
String elUri = e.getNamespaceURI();
+ //
XFIRE-972+ String boundPrefix = elPrefix;
+ if(elUri != null && !"".equals(elUri)){ + boundPrefix = writer.getPrefix(elUri); + }
+
boolean writeElementNS = false;
if (boundPrefix == null || !elPrefix.equals(boundPrefix))
{
XFIRE-972+ String boundPrefix = elPrefix; + if(elUri != null && !"".equals(elUri)){ + boundPrefix = writer.getPrefix(elUri); + } + boolean writeElementNS = false; if (boundPrefix == null || !elPrefix.equals(boundPrefix)) {