[ 
https://issues.apache.org/jira/browse/AXIS2-5789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15336104#comment-15336104
 ] 

Stefano R commented on AXIS2-5789:
----------------------------------

Problem seems caused by BigDecimal value generated inside 
ConverterUtil.convertToStandardDecimalNotation.

{code:java}
org.apache.axis2.databinding.utils.ConverterUtil.convertToStandardDecimalNotation("3").toPlainString()
{code}

 is "1000.0" but if i call method with larger value, eg.:
{code:java}
org.apache.axis2.databinding.utils.ConverterUtil.convertToStandardDecimalNotation("15").toPlainString()
{code}

result is "1000000000000000", without dot.

Tested with jdk 1.7.0_80 and 1.8.0_65


> Generated code for xsd:totalDigits throws NumberFormatException
> ---------------------------------------------------------------
>
>                 Key: AXIS2-5789
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5789
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, codegen
>    Affects Versions: 1.7.3
>            Reporter: Stefano R
>
> In relation to issue [https://issues.apache.org/jira/browse/AXIS2-5342],
> generated code for type:
> {code:xml}
>     <simpleType name="INTERO3_TYPE">
>         <restriction base="integer">
>             <totalDigits value="3"/>
>         </restriction>
>     </simpleType>
> {code}
> produces a class with setter:
> {code:java}
>  public void setINTERO3_TYPE(java.math.BigInteger param) {
>         java.lang.String totalDigitsDecimal = 
> org.apache.axis2.databinding.utils.ConverterUtil.convertToStandardDecimalNotation("3").toPlainString();
>         if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, 
> totalDigitsDecimal) < 0) {
>             this.localINTERO3_TYPE = param;
>         } else {
>             throw new java.lang.RuntimeException(
>                 "Input values do not follow defined XSD restrictions");
>         }
>     }
> {code}
> ConverterUtil.convertToStandardDecimalNotation produces a BigDecimal with a 
> toPlainString() value "1000.0", but ConverterUtil.compare(BigInteger, String) 
> contains code:
> {code:java|title=ConverterUtil.java:1344}
> public static long compare(BigInteger binBigInteger, String value) {
>         return binBigInteger.longValue() - Long.parseLong(value);
>     }
> {code}
> which parses second string parameter as a Long, throwing a 
> NumberFormatException



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to