Hi Gabriel,

Yup, changes look good. Apply at your leisure.

-Justin

Gabriel Roldan wrote:
> Hey,
> 
> Jira is down so I can't create an issue for this. Let's do email:
> 
> The xs bindings for integral types with restricted value space do fail 
> to parse/encode due to some checks value range using its Java integer 
> value rather than the long one, when the actual value exceeds the Java 
> integer value range. The xsd value ranges for these types as -Ininity..0 
> or 0..Infinity, so it makes more sense to make the checks over their 
> Java long values.
> 
> Here's a patch, ok to apply?:
> 
> Index: src/main/java/org/geotools/xs/bindings/XSNegativeIntegerBinding.java
> ===================================================================
> --- src/main/java/org/geotools/xs/bindings/XSNegativeIntegerBinding.java 
> (revision 34084)
> +++ src/main/java/org/geotools/xs/bindings/XSNegativeIntegerBinding.java 
> (working copy)
> @@ -85,7 +85,7 @@
>          throws Exception {
>          Number number = (Number) value;
> 
> -        if (number.intValue() == 0) {
> +        if (number.longValue() == 0) {
>              throw new IllegalArgumentException("negativeInteger value 
> '" + number
>                  + "' required to be negative");
>          }
> Index: 
> src/main/java/org/geotools/xs/bindings/XSNonNegativeIntegerBinding.java
> ===================================================================
> --- 
> src/main/java/org/geotools/xs/bindings/XSNonNegativeIntegerBinding.java 
> (revision 34084)
> +++ 
> src/main/java/org/geotools/xs/bindings/XSNonNegativeIntegerBinding.java 
> (working copy)
> @@ -119,7 +119,7 @@
>      public String encode(Object object, String value) throws Exception {
>          Number number = (Number) object;
> 
> -        if (number.intValue() < 0) {
> +        if (number.longValue() < 0) {
>              throw new IllegalArgumentException("Value '" + number
>                  + "' must be non-negative (0 or above).");
>          }
> Index: 
> src/main/java/org/geotools/xs/bindings/XSNonPositiveIntegerBinding.java
> ===================================================================
> --- 
> src/main/java/org/geotools/xs/bindings/XSNonPositiveIntegerBinding.java 
> (revision 34084)
> +++ 
> src/main/java/org/geotools/xs/bindings/XSNonPositiveIntegerBinding.java 
> (working copy)
> @@ -114,7 +114,7 @@
>      public String encode(Object object, String value) throws Exception {
>          Number number = (Number) object;
> 
> -        if (number.intValue() > 0) {
> +        if (number.longValue() > 0) {
>              throw new IllegalArgumentException("Value '" + number
>                  + "' must be non-positive (0 or below).");
>          }
> Index: src/main/java/org/geotools/xs/bindings/XSPositiveIntegerBinding.java
> ===================================================================
> --- src/main/java/org/geotools/xs/bindings/XSPositiveIntegerBinding.java 
> (revision 34084)
> +++ src/main/java/org/geotools/xs/bindings/XSPositiveIntegerBinding.java 
> (working copy)
> @@ -89,7 +89,7 @@
>          throws Exception {
>          Number number = (Number) value;
> 
> -        if (number.intValue() < 1) {
> +        if (number.longValue() < 1) {
>              throw new IllegalArgumentException("positiveInteger value 
> '" + number
>                  + "' must be positive.");
>          }
> @@ -106,7 +106,7 @@
>      public String encode(Object object, String value) throws Exception {
>          Number number = (Number) object;
> 
> -        if (number.intValue() == 0) {
> +        if (number.longValue() == 0) {
>              throw new IllegalArgumentException("positiveInteger value 
> '" + number
>                  + "' must be positive.");
>          }
> 
> 

-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to