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

khalithbasha commented on AXIS2-5342:
-------------------------------------

I am facing same issue. Exception in thread "main" 
java.lang.NumberFormatException: For input string: "1000.0"

public void setEMPL_RCDTypeDef(int 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.localEMPL_RCDTypeDef = param;
            } else {
                throw new java.lang.RuntimeException(
                    "Input values do not follow defined XSD restrictions");
            }
        }

Version is Axis2 - 1.7.5. Kindly help me on the same.

> Generated code for xsd:totalDigits cause errors
> -----------------------------------------------
>
>                 Key: AXIS2-5342
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5342
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, codegen
>    Affects Versions: 1.6.2
>            Reporter: Conny Kreyßel
>             Fix For: 1.6.3, 1.7.0
>
>
> If you have a element like
> <xsd:simpleType name="abc">
>       <xsd:restriction base="xsd:integer">
>               <xsd:totalDigits value="5" />
>       </xsd:restriction>
> </xsd:simpleType>
> axis generates this as source code  
> public void setAbc(java.math.BigInteger param){
>       java.lang.String totalDigitsDecimal = 
> org.apache.axis2.databinding.utils.ConverterUtil.convertToStandardDecimalNotation("5").toString();
>       if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, 
> totalDigitsDecimal) > 0){
>               this.localHerkunftsschluessel=param;
>       }
>       else {
>               throw new java.lang.RuntimeException();
>       }
> }
> The problem is the toString() of the result from 
> .convertToStandardDecimalNotation("5"). It converts the a BigDecimal into 
> String and this results in "10000.0". Then ConverterUtil.compare() trys to 
> convert this string into a Long. BANG.
> Please change convertToStandardDecimalNotation().toString() into 
> convertToStandardDecimalNotation().toPlainString().
> The same functionality should be evaluated for xsd:int, xsd:float, 
> xsd:decimal ...
> IMHO, this results from a bad implementation of AXIS2-4190. Please add 
> testcases for this.
> Take a look at the following comment and below.
> https://issues.apache.org/jira/browse/AXIS2-4190?focusedCommentId=13285198&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13285198



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to