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 "Alexis Reigel (JIRA)" <ax...@ws.apache.org> on 2006/11/06 15:34:37 UTC

[jira] Created: (AXIS-2587) NumberFormatException for new UnsignedLong( double )

NumberFormatException for new UnsignedLong( double )
----------------------------------------------------

                 Key: AXIS-2587
                 URL: http://issues.apache.org/jira/browse/AXIS-2587
             Project: Apache Axis
          Issue Type: Bug
          Components: Basic Architecture
    Affects Versions: current (nightly)
            Reporter: Alexis Reigel


The double constructor for the class org.apache.axis.types.UnsignedLong raises a NumberFormatException exception if the argument is a double value.
E.g. 

<code>UnsignedLong ulong = new UnsignedLong(1D);</code>

The Problem lies in the constructor itself. The line

<code>new BigInteger(Double.toString(value))</code>

calls the constructor of java.lang.BigInteger which expects a string defined as follows: "The String representation consists of an optional minus sign followed by a sequence of one or more decimal digits". In the case of a double value this fails of course.

I'm not sure about the purpose of this constructor anyway. Why would you want to create a long from a double?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS-2587) NumberFormatException for new UnsignedLong( double )

Posted by "Henri Yandell (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2587?page=comments#action_12447873 ] 
            
Henri Yandell commented on AXIS-2587:
-------------------------------------

Looking at the history of the file (http://svn.apache.org/viewvc/webservices/axis/trunk/java/src/org/apache/axis/types/UnsignedLong.java) it was originally based on a Double rather than a BigInteger. So that would suggest the (double) constructor is either intentional or unintentional legacy.

It was changed in this revision:

http://svn.apache.org/viewvc/webservices/axis/trunk/java/src/org/apache/axis/types/UnsignedLong.java?r1=257456&r2=259888

as a part of https://issues.apache.org/jira/browse/AXIS-1344.

Dims said:  (needed to keep the old constructor)

> NumberFormatException for new UnsignedLong( double )
> ----------------------------------------------------
>
>                 Key: AXIS-2587
>                 URL: http://issues.apache.org/jira/browse/AXIS-2587
>             Project: Apache Axis
>          Issue Type: Bug
>          Components: Basic Architecture
>    Affects Versions: current (nightly)
>            Reporter: Alexis Reigel
>
> The double constructor for the class org.apache.axis.types.UnsignedLong raises a NumberFormatException exception if the argument is a double value.
> E.g. 
> <code>UnsignedLong ulong = new UnsignedLong(1D);</code>
> The Problem lies in the constructor itself. The line
> <code>new BigInteger(Double.toString(value))</code>
> calls the constructor of java.lang.BigInteger which expects a string defined as follows: "The String representation consists of an optional minus sign followed by a sequence of one or more decimal digits". In the case of a double value this fails of course.
> I'm not sure about the purpose of this constructor anyway. Why would you want to create a long from a double?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org