aizu-m opened a new pull request, #92:
URL: https://github.com/apache/poi-xmlbeans/pull/92

       java.lang.IllegalArgumentException: Number has more than 1024 characters
           at 
org.apache.xmlbeans.impl.util.MathUtil.parseAsFloat(MathUtil.java:126)
           at 
org.apache.xmlbeans.impl.values.JavaFloatHolder.validateLexical(JavaFloatHolder.java:71)
           at 
org.apache.xmlbeans.impl.validator.Validator.validateAtomicType(Validator.java:1125)
   
   Found this feeding long numeric text through validate(). A float or double 
literal longer than the XmlOptions maxNumberOfCharsForNumbers cap (1024 by 
default) reaches MathUtil.parseAsFloat/parseAsDouble, which enforce the cap by 
throwing IllegalArgumentException. validateLexical in JavaFloatHolder and 
JavaDoubleHolder only catches NumberFormatException, so the exception leaves 
doc.validate() instead of being recorded as an XmlError.
   
   Two observations. validate() throws rather than returning false. And a union 
such as `<xs:union memberTypes="xs:double xs:string"/>` rejects a value that is 
valid against xs:string, because the validator probes the double member first 
and the exception escapes the member loop.
   
   NumberFormatException is a subclass of IllegalArgumentException, so widening 
the catch keeps every existing invalid-lexical case and folds the length cap 
into a reported error. Regression test drives a 1025-char float and double 
through validate().
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to