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

Adam Fordham commented on AXIS2-5842:
-------------------------------------

The fix implemented in the referenced issue works when a restriction is a 
*Decimal* parameter. However, it fails with the *NumberFormatException* when 
the restriction is an *Integer*. This is because of the overloaded 
*org.apache.axis2.databinding.utils.ConverterUtil.compare(param,value)* method. 
When the `*param`* is an *Integer*, it calls the *compare(BigInteger 
binBigInteger, String value)* method that tries to convert the 
*StandardDecimalNotation* *String `value`* to a *Long*, which throws the 
*NumberFormat Exception*. 
  
 A possbile fix would be to update the compare method to use something like 
this:

 
{code:java}
public static long compare(BigInteger binBigInteger, String value) {
  NumberFormat nf = NumberFormat.getInstance();
  Long param = nf.parse(value).longValue();
  return binBigInteger.longValue() - param;
}
{code}
[https://stackoverflow.com/a/39291763/412267|http://example.com]

I'd be willing to contribute a patch. What is the best method to do this?

> 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
(v8.3.4#803005)

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

Reply via email to