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 "Mauricio Ferraz Cassiolato dos Santos (JIRA)" <ji...@apache.org> on 2019/07/03 18:29:00 UTC

[jira] [Comment Edited] (AXIS2-5842) wsdl2java generates faulty runtime code for

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

Mauricio Ferraz Cassiolato dos Santos edited comment on AXIS2-5842 at 7/3/19 6:28 PM:
--------------------------------------------------------------------------------------

Bottom line is that Java can't convert a number with floating point straight into a Long.

Plenty of possible solutions to whoever decide to tackle this issue:

[https://stackoverflow.com/questions/12732309/converting-a-string-that-contains-decimal-to-long]

 

I'm not sure about speed or memory concerns, but it worked when I substituted each call to 
{code:java}
org.apache.axis2.databinding.utils.ConverterUtil.compare(){code}
with a call to this other compare:
{code:java}
public static long compare(BigInteger binBigInteger, String value) {
    BigDecimal bd = new BigDecimal(value);
    long l = bd.setScale(0, BigDecimal.ROUND_HALF_UP).longValue();
    return binBigInteger.longValue() - l;
}{code}
Feel free to use it as a starting point.


was (Author: mauricioferraz):
Bottom line is that Java can't convert a number with floating point straight into a Long.

Plenty of possible solutions to whoever decide to tackle this issue:

[https://stackoverflow.com/questions/12732309/converting-a-string-that-contains-decimal-to-long]

> wsdl2java generates faulty runtime code for <xsd:totalDigits> 
> --------------------------------------------------------------
>
>                 Key: AXIS2-5842
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5842
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.7.4
>         Environment: axis2-wsdl2code-maven-plugin:1.7.4:wsdl2code
>            Reporter: Udo Kühne
>            Priority: Major
>         Attachments: generated.code.zip
>
>
> For this reason, it can't be used.
> This error occurs starting with version Axis2 1.6.2 ( AXIS2-5342 ) and is already marked as resolved. Why?
> But this is not solved!
> Please take a look into the attached sample "generated.code.zip" ...
> a) download and unpack them
> b) cd generated.code
> c) mvn test
> {noformat}
> Running de.udoline.axis2.wsdl2code.generated.xi.SachbuchkontoTest
> ~~~ The underline error:
> ~~~ java.lang.NumberFormatException: For input string: "1000000.0"
>         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
>         at java.lang.Long.parseLong(Long.java:589)
>         at java.lang.Long.parseLong(Long.java:631)
>         at org.apache.axis2.databinding.utils.ConverterUtil.compare(ConverterUtil.java:1345)
>         at de.udoline.axis2.wsdl2code.generated.xi.Sachbuchkonto.setSachbuchkonto(Sachbuchkonto.java:41)
>         at de.udoline.axis2.wsdl2code.generated.xi.SachbuchkontoTest.testGeneratedWsdlCode(SachbuchkontoTest.java:53)
>         ...
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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