Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1127329 - [GSS] (6.4.0) Invalid boolean values are set to 'false' instead of null
[GSS] (6.4.0) Invalid boolean values are set to 'false' instead of null
Status: VERIFIED
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: XML Frameworks (Show other bugs)
6.3.0
Unspecified Unspecified
unspecified Severity unspecified
: DR1
: EAP 6.4.0
Assigned To: Jason T. Greene
Pavel Slavicek
eap-docs
:
Depends On:
Blocks: 1127326 1127332
  Show dependency treegraph
 
Reported: 2014-08-06 12:40 EDT by Kyle Lape
Modified: 2015-05-19 06:14 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1127332 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Kyle Lape 2014-08-06 12:40:41 EDT
There are certain illegal values of an xs:boolean that return false when they should return null, namely values that start with t and f. In addition, if the string literals "t" and "f" are passed in, this will cause an unmarshalling error:

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 1
  at java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:203) [rt.jar:1.7.0_55]
  at java.lang.StringBuilder.charAt(StringBuilder.java:72) [rt.jar:1.7.0_55]
  at com.sun.xml.bind.DatatypeConverterImpl._parseBoolean(DatatypeConverterImpl.java:260)
Comment 1 Kyle Lape 2014-08-06 12:44:56 EDT
Upstream Jira: https://java.net/jira/browse/JAXB-1019
Comment 2 Kyle Lape 2014-08-18 01:20:51 EDT
Spec references:

------------------------------------------------------------------------
JAXB 2.2 spec, section B.3.8.1: Unparseable Data for Simple Types (p312)

  If simple type data cannot be parsed into a java datatype, then the
  value of the java datatype must not change the current set value. An
  access to the datatype must return the value as specified in Section
  B.3.8.2, “Missing element information item”. If the conversion of
  lexical representation into a value results in an exception, then the
  exception must be caught and a validation event reported. This is to
  ensure that such conversion errors do not terminate unmarshalling.

B.3.8.2 Missing element information item

  Property or field access must return the value specified in Section
  B.3.8.4, “Value for missing elements/attributes”

B.3.8.4 Value for missing elements/attributes

  If an attribute or an element is missing from an XML instance, then
  unmarshal will not change the current set value. An access to the
  property will return the set value or if unset, the uninitialized
  value. The uninitialized value of the property or field depends upon
  it's type. If the type is

  1. int-valueis0
  2. boolean - value is false
  3. a reference (must be mapped to a simple type) - value is null.
  ...

------------------------------------------------------------------------

XML Schema, part 2, secion 3.2.2: Primitive Datatypes: boolean
3.2.2.1 Lexical representation

  An instance of a datatype that is defined as ·boolean· can have the
  following legal literals {true, false, 1, 0}.

------------------------------------------------------------------------

So I interpret the above specs like this:

- The valid boolean values are {true, false, 1, 0}, excluding
  whitespace around the values

- If it's not one of those values, then:

  - If the type is a primitive "boolean", the value is false (default)
  - If the type is "java.lang.Boolean" (i.e. an object reference),
    then the value is null (default)

(Of course the invalid value should throw an exception if schema
validation is enabled; we are only talking about the default
unmarshalling value with schema validation disabled.)
Comment 3 Kabir Khan 2014-08-23 06:30:43 EDT
Should be fixed by jaxb upgrade to 2.2.5-redhat-9: https://bugzilla.redhat.com/show_bug.cgi?id=1127326
Comment 4 Jan Blizňák 2014-09-18 05:59:48 EDT
Verified on 6.4.0.DR1

Note You need to log in before you can comment on or make changes to this bug.