java Axis2 adb和minInclusive=2147483648
我有一个这种类型的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
那么这是轴误差?还是XSD错误
共 (0) 个答案