Inconsistent handling of invalid boolean input parameters to a web service

Solution Verified - Updated -

Issue

In JBoss EAP 6.1.1, the following web service input parameters are mapped to the boolean value false:

test
fAlse
tRue
“ “ (single space)

whereas the following parameters are mapped to null:

asdf
TRUE
FALSE
True
False

and the following parameters result in an Unmarshalling error:

t
f

From a user’s perspective, this behavior is inconsistent and hard to understand.

  1. Is this behavior intended?
  2. Why not map all invalid boolean input parameters to the same value (false / null / unmarshalling error)?
  3. Is it possible that this behavior will change again in a future version? We noticed that AS 7.1.1 behaves differently.
  4. How can we enforce a certain, consistent behavior for our web services?

Example of UnmarshalException message:

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.