XFire

StaxSerializer improper handling of empty namespace

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2.5
  • Fix Version/s: 1.2.6
  • Component/s: Core
  • Labels:
    None
  • Environment:
    Weblogic 9.2
  • Number of attachments :
    0

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.)

Activity

Hide
Mika Goeckel added a comment -

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();

  • String boundPrefix = writer.getPrefix(elUri);
    + // XFIRE-972
    + String boundPrefix = elPrefix;
    + if(elUri != null && !"".equals(elUri)){ + boundPrefix = writer.getPrefix(elUri); + }
    +
    boolean writeElementNS = false;
    if (boundPrefix == null || !elPrefix.equals(boundPrefix))
    {
Show
Mika Goeckel added a comment - 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();
  • String boundPrefix = writer.getPrefix(elUri); + // XFIRE-972 + String boundPrefix = elPrefix; + if(elUri != null && !"".equals(elUri)){ + boundPrefix = writer.getPrefix(elUri); + } + boolean writeElementNS = false; if (boundPrefix == null || !elPrefix.equals(boundPrefix)) {

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: