axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Blake (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (AXIS2-5342) Generated code for xsd:totalDigits cause errors
Date Thu, 10 Apr 2014 09:11:32 GMT

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

Steven Blake edited comment on AXIS2-5342 at 4/10/14 9:11 AM:
--------------------------------------------------------------

Is the fix for this to change '>' to '<' ?

{code}
public void setCurr132(java.math.BigDecimal param){
                            
  java.lang.String totalDigitsDecimal = org.apache.axis2.databinding.utils.ConverterUtil.convertToStandardDecimalNotation("13").toString();

  if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param, totalDigitsDecimal)
< 0){
                                                    this.localCurr132=param;
                                            }
                                            else {
                                                throw new java.lang.RuntimeException();
                                            }                                       
}

{code}


was (Author: sb89):
Is the fix for this to change '>' to '<' ?

{code}
public void setCurr132(java.math.BigDecimal param){
                            
java.lang.String totalDigitsDecimal = org.apache.axis2.databinding.utils.ConverterUtil.convertToStandardDecimalNotation("13").toString();
                                            if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param,
totalDigitsDecimal) < 0){
                                                    this.localCurr132=param;
                                            }
                                            else {
                                                throw new java.lang.RuntimeException();
                                            }
                                        

                               }

{code}

> 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.7.0, 1.6.3
>
>
> 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.2#6252)

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


Mime
View raw message