Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToLong.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToLong.java	(revision 2649)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToLong.java	(revision 2650)
@@ -26,6 +26,7 @@
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Date;
+import org.apache.commons.lang3.BooleanUtils;
 import org.gvsig.tools.dataTypes.AbstractCoercion;
 import org.gvsig.tools.dataTypes.CoercionException;
 import org.gvsig.tools.dataTypes.CoercionContext;
@@ -35,55 +36,60 @@
 @SuppressWarnings("UseSpecificCatch")
 public class CoerceToLong extends AbstractCoercion {
 
-  @Override
-  public Object coerce(Object value, CoercionContext context) throws CoercionException {
-    if (value == null || value instanceof Long) {
-      return value;
-    }
-    CoercionContextLocale theContext;
-    if (context instanceof CoercionContextLocale) {
-      theContext = (CoercionContextLocale) context;
-    } else {
-      theContext = DataTypeUtils.coerceContextDefaultLocale();
-    }
-    Number num;
-    try {
-      if (value instanceof Number) {
-        num = (Number) value;
+    @Override
+    public Object coerce(Object value, CoercionContext context) throws CoercionException {
+        if (value == null || value instanceof Long) {
+            return value;
+        }
+        CoercionContextLocale theContext;
+        if (context instanceof CoercionContextLocale) {
+            theContext = (CoercionContextLocale) context;
+        } else {
+            theContext = DataTypeUtils.coerceContextDefaultLocale();
+        }
+        Number num;
+        try {
+            if (value instanceof Number) {
+                num = (Number) value;
 
-      } else if (value instanceof Boolean) {
-        num = ((boolean) value ? 1l : 0l);
+            } else if (value instanceof Boolean) {
+                num = ((boolean) value ? 1l : 0l);
 
-      } else if (value instanceof Date) {
-        num = ((Date) value).getTime();
+            } else if (value instanceof Date) {
+                num = ((Date) value).getTime();
 
-      } else {
-        String s = value.toString();
-        if (s == null) {
-          return null;
-        }
-        s = s.trim().toLowerCase();
-        if (s.length() == 0) {
-          return null;
-        }
-        if (s.startsWith("0x")) {
-          num = Long.valueOf(s.substring(2), 16);
+            } else {
+                String s = value.toString();
+                if (s == null) {
+                    return null;
+                }
+                s = s.trim().toLowerCase();
+                if (s.length() == 0) {
+                    return null;
+                }
+                if (s.startsWith("0x")) {
+                    num = Long.valueOf(s.substring(2), 16);
 
-        } else {
-          if (s.startsWith("+")) {
-            s = s.substring(1);
-          }
-          ParsePosition p = new ParsePosition(0);
-          DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
-          num = nf.parse(s, p);
-          if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
-            throw new CoercionException("Can't coerce '" + s + "' to long with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
-          }
+                } else {
+                    Boolean bool = BooleanUtils.toBooleanObject(s);
+                    if (bool != null) {
+                        num = ((boolean) bool ? 1l : 0l);
+                    } else {
+                        if (s.startsWith("+")) {
+                            s = s.substring(1);
+                        }
+                        ParsePosition p = new ParsePosition(0);
+                        DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
+                        num = nf.parse(s, p);
+                        if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
+                            throw new CoercionException("Can't coerce '" + s + "' to long with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
+                        }
+                    }
+                }
+            }
+            return num.longValue();
+        } catch (Exception e) {
+            throw new CoercionException("Can't coerce '" + value.toString() + "' to long.", e);
         }
-      }
-      return num.longValue();
-    } catch (Exception e) {
-      throw new CoercionException("Can't coerce '" + value.toString() + "' to long.", e);
     }
-  }
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToByte.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToByte.java	(revision 2649)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToByte.java	(revision 2650)
@@ -23,6 +23,7 @@
  */
 package org.gvsig.tools.dataTypes.impl.coercion;
 
+import org.apache.commons.lang3.BooleanUtils;
 import org.gvsig.tools.dataTypes.AbstractCoercion;
 import org.gvsig.tools.dataTypes.CoercionContext;
 import org.gvsig.tools.dataTypes.CoercionException;
@@ -30,40 +31,45 @@
 
 public class CoerceToByte extends AbstractCoercion {
 
-  @Override
-  @SuppressWarnings("UseSpecificCatch")
-  public Object coerce(Object value, CoercionContext context) throws CoercionException {
-    if (value == null || value instanceof Byte) {
-      return value;
-    }
-    Byte num;
-    try {
-        if (value instanceof Number) {
-          num = ((Number) value).byteValue();
+    @Override
+    @SuppressWarnings("UseSpecificCatch")
+    public Object coerce(Object value, CoercionContext context) throws CoercionException {
+        if (value == null || value instanceof Byte) {
+            return value;
+        }
+        Byte num;
+        try {
+            if (value instanceof Number) {
+                num = ((Number) value).byteValue();
 
-        } else if (value instanceof Boolean) {
-          num = (byte) ((boolean) value ? 1 : 0);
+            } else if (value instanceof Boolean) {
+                num = (byte) ((boolean) value ? 1 : 0);
 
-        } else {
-          String s = value.toString();
-          if (s == null) {
-            return null;
-          }
-          s = s.trim().toLowerCase();
-          if (s.length() == 0) {
-            return null;
-          }
-          if (s.startsWith("0x")) {
-            num = Byte.valueOf(s.substring(2), 16);
-          } else {
-            num = Byte.valueOf(value.toString());
-          }
+            } else {
+                String s = value.toString();
+                if (s == null) {
+                    return null;
+                }
+                s = s.trim().toLowerCase();
+                if (s.length() == 0) {
+                    return null;
+                }
+                if (s.startsWith("0x")) {
+                    num = Byte.valueOf(s.substring(2), 16);
+                } else {
+                    Boolean bool = BooleanUtils.toBooleanObject(s);
+                    if (bool != null) {
+                        num = ((boolean) bool ? (byte) 1 :(byte) 0);
+                    } else {
+                        num = Byte.valueOf(value.toString());
+                    }
+                }
+            }
+            return num;
+        } catch (Exception e) {
+            throw new CoercionException(e);
         }
-      return num;
-    } catch (Exception e) {
-      throw new CoercionException(e);
+
     }
 
-  }
-
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFloat.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFloat.java	(revision 2649)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToFloat.java	(revision 2650)
@@ -26,6 +26,7 @@
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Date;
+import org.apache.commons.lang3.BooleanUtils;
 import org.gvsig.tools.dataTypes.AbstractCoercion;
 import org.gvsig.tools.dataTypes.CoercionContext;
 import org.gvsig.tools.dataTypes.CoercionContextLocale;
@@ -37,66 +38,71 @@
 @SuppressWarnings("UseSpecificCatch")
 public class CoerceToFloat extends AbstractCoercion {
 
-  @Override
-  public Object coerce(Object value) throws CoercionException {
-    if (value == null || value instanceof Float) {
-      return value;
+    @Override
+    public Object coerce(Object value) throws CoercionException {
+        if (value == null || value instanceof Float) {
+            return value;
+        }
+        return coerce(value, DataTypeUtils.coerceContextDefaultDecimal());
     }
-    return coerce(value, DataTypeUtils.coerceContextDefaultDecimal());
-  }
 
-  @Override
-  public Object coerce(Object value, CoercionContext context) throws CoercionException {
-    if (value == null || value instanceof Float) {
-      return value;
-    }
-    CoercionContextLocale theContext;
-    if (context instanceof CoercionContextLocale) {
-      theContext = (CoercionContextLocale) context;
-    } else {
-      theContext = DataTypeUtils.coerceContextDefaultLocale();
-    }
-    Float num;
-    try {
-      if (value instanceof Number) {
-        num = ((Number) value).floatValue();
-        
-      } else if (value instanceof Boolean) {        
-        num = ((boolean) value ? 1f : 0f);
-        
-      } else if (value instanceof Date) {
-        num = (float) (((Date) value).getTime());
-        
-      } else {
-        String s = value.toString();
-        if (s == null) {
-          return null;
+    @Override
+    public Object coerce(Object value, CoercionContext context) throws CoercionException {
+        if (value == null || value instanceof Float) {
+            return value;
         }
-        s = s.trim().toLowerCase();
-        if (s.length() == 0) {
-          return null;
-        }
-        if (s.startsWith("0x")) {
-          num = (float) Long.parseLong(s.substring(2), 16);
-          
+        CoercionContextLocale theContext;
+        if (context instanceof CoercionContextLocale) {
+            theContext = (CoercionContextLocale) context;
         } else {
-          if (s.startsWith("+")) {
-            s = s.substring(1);
-          }
-          ParsePosition p = new ParsePosition(0);
-          DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
-          Number n = nf.parse(s, p);
-          if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
-            throw new CoercionException("Can't coerce '" + s + "' to float with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
-          }
-          num = n.floatValue();
+            theContext = DataTypeUtils.coerceContextDefaultLocale();
         }
-      }
-      return num;
-    } catch (CoercionException e) {
-      throw e;
-    } catch (Exception e) {
-      throw new CoercionException("Can't coerce '" + value.toString() + "' to double with locale " + theContext.locale().getLanguage() + "'.", e);
+        Float num;
+        try {
+            if (value instanceof Number) {
+                num = ((Number) value).floatValue();
+
+            } else if (value instanceof Boolean) {
+                num = ((boolean) value ? 1f : 0f);
+
+            } else if (value instanceof Date) {
+                num = (float) (((Date) value).getTime());
+
+            } else {
+                String s = value.toString();
+                if (s == null) {
+                    return null;
+                }
+                s = s.trim().toLowerCase();
+                if (s.length() == 0) {
+                    return null;
+                }
+                if (s.startsWith("0x")) {
+                    num = (float) Long.parseLong(s.substring(2), 16);
+
+                } else {
+                    Boolean bool = BooleanUtils.toBooleanObject(s);
+                    if (bool != null) {
+                        num = ((boolean) bool ? 1f : 0f);
+                    } else {
+                        if (s.startsWith("+")) {
+                            s = s.substring(1);
+                        }
+                        ParsePosition p = new ParsePosition(0);
+                        DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
+                        Number n = nf.parse(s, p);
+                        if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
+                            throw new CoercionException("Can't coerce '" + s + "' to float with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
+                        }
+                        num = n.floatValue();
+                    }
+                }
+            }
+            return num;
+        } catch (CoercionException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new CoercionException("Can't coerce '" + value.toString() + "' to double with locale " + theContext.locale().getLanguage() + "'.", e);
+        }
     }
-  }
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java	(revision 2649)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDouble.java	(revision 2650)
@@ -26,6 +26,7 @@
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Date;
+import org.apache.commons.lang3.BooleanUtils;
 import org.gvsig.tools.dataTypes.AbstractCoercion;
 import org.gvsig.tools.dataTypes.Coercion;
 
@@ -37,77 +38,82 @@
 @SuppressWarnings("UseSpecificCatch")
 public class CoerceToDouble extends AbstractCoercion {
 
-  @Override
-  public Object coerce(Object value) throws CoercionException {
-    if (value == null || value instanceof Double) {
-      return value;
+    @Override
+    public Object coerce(Object value) throws CoercionException {
+        if (value == null || value instanceof Double) {
+            return value;
+        }
+        return coerce(value, DataTypeUtils.coerceContextDefaultDecimal());
     }
-    return coerce(value, DataTypeUtils.coerceContextDefaultDecimal());
-  }
 
-  @Override
-  public Object coerce(Object value, CoercionContext context) throws CoercionException {
-    if (value == null || value instanceof Double) {
-      return value;
-    }
-    CoercionContextLocale theContext;
-    if (context instanceof CoercionContextLocale) {
-      theContext = (CoercionContextLocale) context;
-    } else {
-      theContext = DataTypeUtils.coerceContextDefaultLocale();
-    }
-    Double num;
-    try {
-      if (value instanceof Number) {
-        num = ((Number) value).doubleValue();
-        
-      } else if (value instanceof Boolean) {
-        num = ((boolean) value ? 1d : 0d);
-        
-      } else if (value instanceof Date) {
-        num = (double) (((Date) value).getTime());
-        
-      } else {
-        String s = value.toString();
-        if (s == null) {
-          return null;
+    @Override
+    public Object coerce(Object value, CoercionContext context) throws CoercionException {
+        if (value == null || value instanceof Double) {
+            return value;
         }
-        s = s.trim().toLowerCase();
-        if (s.length() == 0) {
-          return null;
-        }
-        if (s.startsWith("0x")) {
-          num = (double) Long.parseLong(s.substring(2), 16);
-          
+        CoercionContextLocale theContext;
+        if (context instanceof CoercionContextLocale) {
+            theContext = (CoercionContextLocale) context;
         } else {
-          if (s.startsWith("+")) {
-            s = s.substring(1);
-          }
-          ParsePosition p = new ParsePosition(0);
-          DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
-          Number n = nf.parse(s, p);
-          if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
-            throw new CoercionException("Can't coerce '" + s + "' to double with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
-          }
-          num = n.doubleValue();
+            theContext = DataTypeUtils.coerceContextDefaultLocale();
         }
-      }
-      return num;
-    } catch (CoercionException e) {
-      throw e;
-    } catch (Exception e) {
-      throw new CoercionException("Can't coerce '" + value.toString() + "' to double with locale " + theContext.locale().getLanguage() + "'.", e);
+        Double num;
+        try {
+            if (value instanceof Number) {
+                num = ((Number) value).doubleValue();
+
+            } else if (value instanceof Boolean) {
+                num = ((boolean) value ? 1d : 0d);
+
+            } else if (value instanceof Date) {
+                num = (double) (((Date) value).getTime());
+
+            } else {
+                String s = value.toString();
+                if (s == null) {
+                    return null;
+                }
+                s = s.trim().toLowerCase();
+                if (s.length() == 0) {
+                    return null;
+                }
+                if (s.startsWith("0x")) {
+                    num = (double) Long.parseLong(s.substring(2), 16);
+
+                } else {
+                    Boolean bool = BooleanUtils.toBooleanObject(s);
+                    if (bool != null) {
+                        num = ((boolean) bool ? 1d : 0d);
+                    } else {
+                        if (s.startsWith("+")) {
+                            s = s.substring(1);
+                        }
+                        ParsePosition p = new ParsePosition(0);
+                        DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
+                        Number n = nf.parse(s, p);
+                        if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
+                            throw new CoercionException("Can't coerce '" + s + "' to double with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
+                        }
+                        num = n.doubleValue();
+                    }
+                }
+            }
+            return num;
+        } catch (CoercionException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new CoercionException("Can't coerce '" + value.toString() + "' to double with locale " + theContext.locale().getLanguage() + "'.", e);
+        }
     }
-  }
 
-  public static void main(String[] args) throws CoercionException {
-    Coercion toDouble = new CoerceToDouble();
-    
-    Double x = (double) toDouble.coerce("10.5");
-    System.out.println(x);
-    x = (double) toDouble.coerce("123456789.5");
-    System.out.println(x);
-    x = (double) toDouble.coerce("123,456,789.5");
-    System.out.println(x);
-  }
+    public static void main(String[] args) throws CoercionException {
+        Coercion toDouble = new CoerceToDouble();
+
+        Double x = (double) toDouble.coerce("10.5");
+        System.out.println(x);
+        x = (double) toDouble.coerce("123456789.5");
+        System.out.println(x);
+        x = (double) toDouble.coerce("123,456,789.5");
+        System.out.println(x);
+    }
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToInt.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToInt.java	(revision 2649)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToInt.java	(revision 2650)
@@ -26,6 +26,7 @@
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Date;
+import org.apache.commons.lang3.BooleanUtils;
 import org.gvsig.tools.dataTypes.AbstractCoercion;
 import org.gvsig.tools.dataTypes.CoercionException;
 import org.gvsig.tools.dataTypes.CoercionContext;
@@ -35,64 +36,68 @@
 @SuppressWarnings("UseSpecificCatch")
 public class CoerceToInt extends AbstractCoercion {
 
-  @Override
-  public Object coerce(Object value) throws CoercionException {
-    if (value == null || value instanceof Integer) {
-      return value;
+    @Override
+    public Object coerce(Object value) throws CoercionException {
+        if (value == null || value instanceof Integer) {
+            return value;
+        }
+        return coerce(value, null);
     }
-    return coerce(value, null);
-  }
 
-  @Override
-  public Object coerce(Object value, CoercionContext context) throws CoercionException {
-    if (value == null || value instanceof Integer) {
-      return value;
-    }
-    CoercionContextLocale theContext;
-    if (context instanceof CoercionContextLocale) {
-      theContext = (CoercionContextLocale) context;
-    } else {
-      theContext = DataTypeUtils.coerceContextDefaultLocale();
-    }
-    Number num;
-    try {
-      if (value instanceof Number) {
-        num = (Number) value;
+    @Override
+    public Object coerce(Object value, CoercionContext context) throws CoercionException {
+        if (value == null || value instanceof Integer) {
+            return value;
+        }
+        CoercionContextLocale theContext;
+        if (context instanceof CoercionContextLocale) {
+            theContext = (CoercionContextLocale) context;
+        } else {
+            theContext = DataTypeUtils.coerceContextDefaultLocale();
+        }
+        Number num;
+        try {
+            if (value instanceof Number) {
+                num = (Number) value;
 
-      } else if (value instanceof Boolean) {
-        num = ((boolean) value ? 1 : 0);
+            } else if (value instanceof Boolean) {
+                num = ((boolean) value ? 1 : 0);
 
-      } else if (value instanceof Date) {
-        num = ((Date) value).getTime();
+            } else if (value instanceof Date) {
+                num = ((Date) value).getTime();
 
-      } else {
-        String s = value.toString();
-        if (s == null) {
-          return null;
-        }
-        s = s.trim().toLowerCase();
-        if (s.length() == 0) {
-          return null;
-        }
-        if (s.startsWith("0x")) {
-          num = Integer.valueOf(s.substring(2), 16);
+            } else {
+                String s = value.toString();
+                if (s == null) {
+                    return null;
+                }
+                s = s.trim().toLowerCase();
+                if (s.length() == 0) {
+                    return null;
+                } else if (s.startsWith("0x")) {
+                    num = Integer.valueOf(s.substring(2), 16);
 
-        } else {
-          if (s.startsWith("+")) {
-            s = s.substring(1);
-          }
-          ParsePosition p = new ParsePosition(0);
-          DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
-          num = nf.parse(s, p);
-          if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
-            throw new CoercionException("Can't coerce '" + s + "' to int with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
-          }
+                } else {
+                    Boolean bool = BooleanUtils.toBooleanObject(s);
+                    if (bool != null) {
+                        num = ((boolean) bool ? 1 : 0);
+                    } else {
+                        if (s.startsWith("+")) {
+                            s = s.substring(1);
+                        }
+                        ParsePosition p = new ParsePosition(0);
+                        DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
+                        num = nf.parse(s, p);
+                        if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
+                            throw new CoercionException("Can't coerce '" + s + "' to int with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
+                        }
+                    }
+                }
+            }
+            return num.intValue();
+        } catch (Exception e) {
+            throw new CoercionException("Can't coerce '" + value.toString() + "' to integer.", e);
         }
-      }
-      return num.intValue();
-    } catch (Exception e) {
-      throw new CoercionException("Can't coerce '" + value.toString() + "' to integer.", e);
     }
-  }
 
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDecimal.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDecimal.java	(revision 2649)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/coercion/CoerceToDecimal.java	(revision 2650)
@@ -28,6 +28,7 @@
 import java.text.ParsePosition;
 import java.util.Date;
 import java.util.Locale;
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.gvsig.tools.dataTypes.AbstractCoercion;
 import org.gvsig.tools.dataTypes.Coercion;
@@ -42,106 +43,111 @@
 @SuppressWarnings("UseSpecificCatch")
 public class CoerceToDecimal extends AbstractCoercion {
 
-  @Override
-  public Object coerce(Object value) throws CoercionException {
-    if (value == null || value instanceof BigDecimal) {
-      return value;
+    @Override
+    public Object coerce(Object value) throws CoercionException {
+        if (value == null || value instanceof BigDecimal) {
+            return value;
+        }
+        return coerce(value, DataTypeUtils.coerceContextDefaultDecimal());
     }
-    return coerce(value, DataTypeUtils.coerceContextDefaultDecimal());
-  }
 
-  @Override
-  public Object coerce(Object value, CoercionContext context) throws CoercionException {
-    if (value == null ) {
-      return value;
-    }
-    CoercionContextDecimal theContext;
-    if (context instanceof CoercionContextDecimal) {
-      theContext = (CoercionContextDecimal) context;
-    } else {
-      if (context instanceof CoercionContextLocale) {
-        theContext = DataTypeUtils.coerceContextDecimal(((CoercionContextLocale) context).locale());
-      } else {
-        theContext = DataTypeUtils.coerceContextDefaultDecimal();
-      }
-    }
-    BigDecimal num;
-    try {
-      if (value instanceof BigDecimal) {
-        num = (BigDecimal) value;
-        
-      } else if (value instanceof Number) {
-        num = new BigDecimal(((Number) value).doubleValue(), theContext.getMathContext());
+    @Override
+    public Object coerce(Object value, CoercionContext context) throws CoercionException {
+        if (value == null) {
+            return value;
+        }
+        CoercionContextDecimal theContext;
+        if (context instanceof CoercionContextDecimal) {
+            theContext = (CoercionContextDecimal) context;
+        } else {
+            if (context instanceof CoercionContextLocale) {
+                theContext = DataTypeUtils.coerceContextDecimal(((CoercionContextLocale) context).locale());
+            } else {
+                theContext = DataTypeUtils.coerceContextDefaultDecimal();
+            }
+        }
+        BigDecimal num;
+        try {
+            if (value instanceof BigDecimal) {
+                num = (BigDecimal) value;
 
-      } else if (value instanceof Boolean) {
-        num = new BigDecimal((boolean) value ? 1 : 0, theContext.getMathContext());
-        
-      } else if (value instanceof Date) {
-        num = new BigDecimal(((Date) value).getTime(), theContext.getMathContext());
+            } else if (value instanceof Number) {
+                num = new BigDecimal(((Number) value).doubleValue(), theContext.getMathContext());
 
-      } else {
-        String s = value.toString().trim().toLowerCase();
-        if (StringUtils.isBlank(s)) {
-          return null;
-        }
-        if (s.startsWith("0x")) {
-          num = new BigDecimal(Long.parseLong(s.substring(2), 16), theContext.getMathContext());
+            } else if (value instanceof Boolean) {
+                num = new BigDecimal((boolean) value ? 1 : 0, theContext.getMathContext());
 
-        } else {
-          if (s.startsWith("+")) {
-            s = s.substring(1);
-          }
-          ParsePosition p = new ParsePosition(0);
-          DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
-          nf.setParseBigDecimal(true);
-          num = (BigDecimal) nf.parse(s, p);
-          if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
-            throw new CoercionException("Can't coerce '" + s + "' to BigDecimal with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
-          }
+            } else if (value instanceof Date) {
+                num = new BigDecimal(((Date) value).getTime(), theContext.getMathContext());
+
+            } else {
+                String s = value.toString().trim().toLowerCase();
+                if (StringUtils.isBlank(s)) {
+                    return null;
+                }
+                if (s.startsWith("0x")) {
+                    num = new BigDecimal(Long.parseLong(s.substring(2), 16), theContext.getMathContext());
+
+                } else {
+                    Boolean bool = BooleanUtils.toBooleanObject(s);
+                    if (bool != null) {
+                        num = ((boolean) bool ? BigDecimal.ONE : BigDecimal.ZERO);
+                    } else {
+                        if (s.startsWith("+")) {
+                            s = s.substring(1);
+                        }
+                        ParsePosition p = new ParsePosition(0);
+                        DecimalFormat nf = (DecimalFormat) NumberFormat.getInstance(theContext.locale());
+                        nf.setParseBigDecimal(true);
+                        num = (BigDecimal) nf.parse(s, p);
+                        if (p.getErrorIndex() > 0 || p.getIndex() < s.length()) {
+                            throw new CoercionException("Can't coerce '" + s + "' to BigDecimal with locale " + theContext.locale().getLanguage() + "(error index " + p.getErrorIndex() + ", index " + p.getIndex() + ").");
+                        }
+                    }
+                }
+            }
+            if (theContext.hasScale() && num.scale() != theContext.scale()) {
+                // Ojo, que este set no es un set. Contruye un nuevo BigDecimal, no
+                // modifica el existente.
+                num = num.setScale(theContext.scale(), theContext.roundMode());
+            }
+            if (theContext.hasPrecision() && num.precision() > theContext.precision()) {
+                throw new ArithmeticException("Overflow");
+            }
+            return num;
+        } catch (CoercionException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new CoercionException("Can't coerce '" + value.toString() + "' to BigDecimal with locale " + theContext.locale().getLanguage() + "'.", e);
         }
-      }
-      if( theContext.hasScale() && num.scale()!=theContext.scale()) {
-        // Ojo, que este set no es un set. Contruye un nuevo BigDecimal, no
-        // modifica el existente.
-        num = num.setScale(theContext.scale(), theContext.roundMode());
-      }
-      if( theContext.hasPrecision() && num.precision()>theContext.precision() ) {
-        throw new ArithmeticException("Overflow");
-      }
-      return num;
-    } catch (CoercionException e) {
-      throw e;
-    } catch (Exception e) {
-      throw new CoercionException("Can't coerce '" + value.toString() + "' to BigDecimal with locale " + theContext.locale().getLanguage() + "'.", e);
     }
-  }
 
-  private static BigDecimal toBigDecimal(Object value, int precision, int scale) throws CoercionException {
-      CoercionContextDecimalImpl context = new CoercionContextDecimalImpl(Locale.ENGLISH, precision, scale);
-      Coercion c = new CoerceToDecimal();              
-      BigDecimal x = (BigDecimal) c.coerce(value,context);
-      return x;
-  }
-  
-  public static void main(String[] args) throws CoercionException {
-    BigDecimal n;
+    private static BigDecimal toBigDecimal(Object value, int precision, int scale) throws CoercionException {
+        CoercionContextDecimalImpl context = new CoercionContextDecimalImpl(Locale.ENGLISH, precision, scale);
+        Coercion c = new CoerceToDecimal();
+        BigDecimal x = (BigDecimal) c.coerce(value, context);
+        return x;
+    }
 
-    n = toBigDecimal(1,6,3);
-    System.out.println("BigDecimal(1,6,3): "+n+"("+n.precision()+","+n.scale()+")");
+    public static void main(String[] args) throws CoercionException {
+        BigDecimal n;
 
-    n = toBigDecimal(10,6,3);
-    System.out.println("BigDecimal(10,6,3): "+n+"("+n.precision()+","+n.scale()+")");
+        n = toBigDecimal(1, 6, 3);
+        System.out.println("BigDecimal(1,6,3): " + n + "(" + n.precision() + "," + n.scale() + ")");
 
-    n = toBigDecimal(12.345,6,3);
-    System.out.println("BigDecimal(12.345,6,3): "+n+"("+n.precision()+","+n.scale()+")");
+        n = toBigDecimal(10, 6, 3);
+        System.out.println("BigDecimal(10,6,3): " + n + "(" + n.precision() + "," + n.scale() + ")");
 
-    n = toBigDecimal(-12.345,6,3);
-    System.out.println("BigDecimal(-12.345,6,3): "+n+"("+n.precision()+","+n.scale()+")");
+        n = toBigDecimal(12.345, 6, 3);
+        System.out.println("BigDecimal(12.345,6,3): " + n + "(" + n.precision() + "," + n.scale() + ")");
 
-    n = toBigDecimal(12.3457,6,3);
-    System.out.println("BigDecimal(12.3457,6,3): "+n+"("+n.precision()+","+n.scale()+")");
+        n = toBigDecimal(-12.345, 6, 3);
+        System.out.println("BigDecimal(-12.345,6,3): " + n + "(" + n.precision() + "," + n.scale() + ")");
 
-    n = toBigDecimal(120.3457,6,3);
-    System.out.println("BigDecimal(120.3457,6,3): "+n+"("+n.precision()+","+n.scale()+")");
-  }
+        n = toBigDecimal(12.3457, 6, 3);
+        System.out.println("BigDecimal(12.3457,6,3): " + n + "(" + n.precision() + "," + n.scale() + ")");
+
+        n = toBigDecimal(120.3457, 6, 3);
+        System.out.println("BigDecimal(120.3457,6,3): " + n + "(" + n.precision() + "," + n.scale() + ")");
+    }
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToIntTest.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToIntTest.java	(revision 2649)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/datatypes/impl/coercion/CoerceToIntTest.java	(revision 2650)
@@ -37,14 +37,17 @@
     public void testCoerce() throws Exception {
         CoerceToInt coerce = new CoerceToInt();
 
-        Integer integer12 = new Integer(12);
+        Integer integer12 = 12;
 
-        assertCoercion(coerce, new Integer(12), integer12);
-        assertCoercion(coerce, new Long(12l), integer12);
-        assertCoercion(coerce, new Float(12.0f), integer12);
-        assertCoercion(coerce, new Double(12.0d), integer12);
+        assertCoercion(coerce, (int) 12, integer12);
+        assertCoercion(coerce, 12l, integer12);
+        assertCoercion(coerce, 12.0f, integer12);
+        assertCoercion(coerce, 12.0d, integer12);
         assertCoercion(coerce, "12", integer12);
         assertCoercion(coerce, "0x0C", integer12);
+        assertCoercion(coerce, "t", 1);
+        assertCoercion(coerce, "f", 0);
+        assertCoercion(coerce, "true", 1);
     }
 
     private void assertCoercion(CoerceToInt coerce, Object value,
