我有一个这种类型的XSD
<xs:simpleType name="dec_number_def">
<xs:restriction base="xs:int">
<xs:minInclusive value="-2147483648"/>
<xs:maxInclusive value="2147483647"/>
</xs:restriction>
</xs:simpleType>
我认为没问题,因为对于java数据类型 int ,最大值为2147483647,最小值为-2147483648
但轴存根拒绝像3
这样的值当我使用axis2 ADB 1.7.5和1.7.6创建存根时,我得到:
/**
* Auto generated setter method
* @param param Dec_number_def
*/
public void setDec_number_def(int param) {
if (org.apache.axis2.databinding.utils.ConverterUtil.compare(
param, "2147483647") <= 0) {
this.localDec_number_def = param;
} else {
throw new java.lang.RuntimeException(
"Input values do not follow defined XSD restrictions");
}
if (org.apache.axis2.databinding.utils.ConverterUtil.compare(
param, "-2147483648") >= 0) {
this.localDec_number_def = param;
} else {
throw new java.lang.RuntimeException(
"Input values do not follow defined XSD restrictions");
}
}
如果参数是正数,我会得到带比较函数的负数
compare(3, "-2147483648") = -2147483645 !!!!
因为功能比较是
public static int More compare(int intValue, String value) {
return intValue - Integer.parseInt(value);
}
并且
3 - (-2147483648) = 3 + 2147483648 = 2147483651 OVERFLOW !!!
then -2147483645 is returned and the validation is ERROR
那么这是一个Axis错误?或者是XSD错误?