commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Yano <Alberto.Y...@anvisa.gov.br>
Subject COMMONS-BEANUTILS-1.5
Date Tue, 24 Dec 2002 15:10:37 GMT
 

            I had a problem on the BeanUtils.copyProperties( XXX, YYY ) in a
class where the attribute is wrapper of number.

 

            Example: If the class XXX have a property BigDecimal and a class
YYY have a property Integer and this value is null. The copy of value should
be null, but the value is zero. 

 

            Then I had to do the following changes on the source code:

 

 

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/BigDecimalConvert
er.java

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/BigDecimalConverter.java,v

retrieving revision 1.3

diff -u -r1.3 BigDecimalConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/BigDecimalConvert
er.java    13 Jul 2002 02:22:08 -0000         1.3

+++
beanutils/src/java/org/apache/commons/beanutils/converters/BigDecimalConvert
er.java 24 Dec 2002 13:15:49 -0000

@@ -145,7 +145,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return (BigDecimal) null;

             }

         }

 

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/BigIntegerConvert
er.java

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/BigIntegerConverter.java,v

retrieving revision 1.3

diff -u -r1.3 BigIntegerConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/BigIntegerConvert
er.java      13 Jul 2002 02:22:08 -0000         1.3

+++
beanutils/src/java/org/apache/commons/beanutils/converters/BigIntegerConvert
er.java   24 Dec 2002 13:17:18 -0000

@@ -145,7 +145,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return (BigInteger) null;

             }

         }

 

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/BooleanConverter.
java

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/BooleanConverter.java,v

retrieving revision 1.5

diff -u -r1.5 BooleanConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/BooleanConverter.
java        13 Jul 2002 02:22:08 -0000         1.5

+++
beanutils/src/java/org/apache/commons/beanutils/converters/BooleanConverter.
java     24 Dec 2002 13:21:30 -0000

@@ -144,7 +144,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return new Boolean( false );

             }

         }

 

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/CharacterConverte
r.java

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/CharacterConverter.java,v

retrieving revision 1.3

diff -u -r1.3 CharacterConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/CharacterConverte
r.java      13 Jul 2002 02:22:08 -0000         1.3

+++
beanutils/src/java/org/apache/commons/beanutils/converters/CharacterConverte
r.java   24 Dec 2002 13:21:59 -0000

@@ -144,7 +144,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return (Character) null;

             }

         }

 

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/DoubleConverter.j
ava

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/DoubleConverter.java,v

retrieving revision 1.4

diff -u -r1.4 DoubleConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/DoubleConverter.j
ava          9 Dec 2002 22:03:11 -0000         1.4

+++
beanutils/src/java/org/apache/commons/beanutils/converters/DoubleConverter.j
ava       24 Dec 2002 13:22:12 -0000

@@ -144,7 +144,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return (Double) null;

             }

         }

 

@@ -153,7 +153,7 @@

         } else if(value instanceof Number) {

             return new Double(((Number)value).doubleValue());

         }

-            

+

 

         try {

             return (new Double(value.toString()));

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/FloatConverter.ja
va

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/FloatConverter.java,v

retrieving revision 1.4

diff -u -r1.4 FloatConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/FloatConverter.ja
va 9 Dec 2002 22:03:11 -0000         1.4

+++
beanutils/src/java/org/apache/commons/beanutils/converters/FloatConverter.ja
va          24 Dec 2002 13:22:22 -0000

@@ -144,7 +144,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return (Float) null;

             }

         }

 

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/IntegerConverter.
java

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/IntegerConverter.java,v

retrieving revision 1.4

diff -u -r1.4 IntegerConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/IntegerConverter.
java          9 Dec 2002 22:03:11 -0000         1.4

+++
beanutils/src/java/org/apache/commons/beanutils/converters/IntegerConverter.
java       24 Dec 2002 13:22:29 -0000

@@ -144,7 +144,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return (Integer) null;

             }

         }

 

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/LongConverter.jav
a

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/LongConverter.java,v

retrieving revision 1.4

diff -u -r1.4 LongConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/LongConverter.jav
a 9 Dec 2002 22:03:11 -0000         1.4

+++
beanutils/src/java/org/apache/commons/beanutils/converters/LongConverter.jav
a          24 Dec 2002 13:22:40 -0000

@@ -144,7 +144,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return (Long) null;

             }

         }

 

Index:
beanutils/src/java/org/apache/commons/beanutils/converters/ShortConverter.ja
va

===================================================================

RCS file:
/home/cvspublic/jakarta-commons/beanutils/src/java/org/apache/commons/beanut
ils/converters/ShortConverter.java,v

retrieving revision 1.4

diff -u -r1.4 ShortConverter.java

---
beanutils/src/java/org/apache/commons/beanutils/converters/ShortConverter.ja
va            9 Dec 2002 22:03:11 -0000         1.4

+++
beanutils/src/java/org/apache/commons/beanutils/converters/ShortConverter.ja
va         24 Dec 2002 13:22:48 -0000

@@ -144,7 +144,7 @@

             if (useDefault) {

                 return (defaultValue);

             } else {

-                throw new ConversionException("No value specified");

+                return (Short) null;

             }

         }

 

 

Atenciosamente,


  <http://www.anvisa.gov.br/newanvisa/imagens/logo.gif> 

Alberto Yano
Analista de Sistemas Senior
Gerência Geral de Informação - GGINF
Agência Nacional de Vigilância Sanitária - ANVISA 


 

Brazilian Sanitary Surveillance Agency
Fone/Phone: 55-61-448 1133 Fax: 55-61-448 1362
 <http://www.anvisa.gov.br> http://www.anvisa.gov.br 

 


Mime
View raw message