You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "David Übelacker (JIRA)" <ji...@apache.org> on 2010/01/05 13:34:54 UTC

[jira] Commented: (AXIS2-4200) ConverterUtil.compare fails for BigInteger values

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

David Übelacker commented on AXIS2-4200:
----------------------------------------

Have the same problem with version 1.5.1

solved it by replacing

public static int compare(BigInteger binBigInteger, String value) {
        return binBigInteger.intValue() - Integer.parseInt(value);
    }

with

public static long compare(BigInteger binBigInteger, String value) {
        return binBigInteger.longValue() - Long.parseLong(value);
    }

in org.apache.axis2.databinding.utils.ConverterUtil

> ConverterUtil.compare fails for BigInteger values
> -------------------------------------------------
>
>                 Key: AXIS2-4200
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4200
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1
>         Environment: Axis2 1.4.1, JBoss 4.2, jdk6u10
>            Reporter: Roman HEINZ
>
> A range is defined as:
> 		<xs:restriction base="xs:integer">
> 			<xs:minInclusive value="0"/>
> 			<xs:maxInclusive value="999999999999999"/>
> 		</xs:restriction>
> The generated databinding calls:
>             public void setPhoneNumberType(java.math.BigInteger param){
>                 if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, "999999999999999") <= 0){
>                         this.localPhoneNumberType=param;
>                 }  else {
>                       throw new java.lang.RuntimeException();
>                 }
> The ConverterUtil code is:
>     public static int compare(BigInteger binBigInteger, String value) {
>         return binBigInteger.intValue() - Integer.parseInt(value);
>     }
> This will always fail for values that exceed the capacity of a java.lang.Integer with:
>   Caused by: java.lang.NumberFormatException: For input string: "999999999999999"
>           at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>           at java.lang.Integer.parseInt(Integer.java:459)
>           at java.lang.Integer.parseInt(Integer.java:497)
>           at org.apache.axis2.databinding.utils.ConverterUtil.compare(ConverterUtil.java:1281)
>           [...]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.