Details
-
Bug
-
Resolution: Done
-
Major
-
2.3.0.Final
-
None
-
Low
Description
When obtaining a value from a javax.jcr.Value instance, conversion between property types is not always consistent. For example, if a property type is BOOLEAN but the underlying graph value is a String instance, then converting that type to a NAME will succeed because the conversion at the graph-level is done based upon the value's class. In other words, conversion from a String to a Boolean will always succeed (as would conversion from a JCR STRING to a JCR BOOLEAN), since that conversion is defined by the specification to use Boolean.valueOf(String), which returns 'true' if the String value is case-independently equal to "true" or 'false' in all other cases.
Our JcrValue implementation should be a bit more strict about the type of conversions that are allowed, and it should do this by ensuring that the 'value' is an instance of the appropriate class given it's property type.