QName.valueOf behaviour does not match the Javadoc
--------------------------------------------------

                 Key: WODEN-125
                 URL: https://issues.apache.org/jira/browse/WODEN-125
             Project: Woden
          Issue Type: Improvement
          Components: Parser
            Reporter: John Kaputin


The javax.xml.namespace.QName class in Woden implements the static 
valueOf(String) method and the method's javadoc conforms to other QName 
implementation in J2EE 1.4 and Java 5.0. However, the method's implementation 
contain more constraints on structure and validation than are implied by the 
javadoc.   It tries to avoid 'garbage in' (e.g. multiple left curly braces) by 
treating this as an error, but according to the Javadoc no such validation is 
required and the only criteria is that the String argument must not be null and 
must be in the same format as that produced by the toString() method.  That is, 
'garbage in' should just be accepted and used to create a QName - typically 
this means a 'garbage' string will form the localpart and the namespace will be 
the empty string.  This is acceptable, because per the javadoc no validation is 
done on the namespace or the localpart.

As an aside, the Woden test suite checks for this current behaviour in the 
valueOf method. However, when the test suite runs in a Java 5 JRE it is the 
Java 5 implementation of QName loaded by the classloader, not Woden's, and the 
test cases fail because that implementation is more lax.  The AllWodenTests 
junit harness has a conditional statement to check the java version, but this 
is not really adequate as the QNameTests junit class can be invoked 
independently of AllWodenTests (e.g. by Maven2).

So, the valueOf method must be 'dumbed down' to conform to the javadoc and the 
corresponding tests removed. A new test is needed to check the String passed to 
the valueOf method to create the QName object is equal to the result of the 
object's toString() method.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to