commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r636804 - in /commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils: BeanPropertyValueChangeClosure.java BeanPropertyValueEqualsPredicate.java BeanToPropertyValueTransformer.java
Date Thu, 13 Mar 2008 16:59:25 GMT
Author: niallp
Date: Thu Mar 13 09:59:10 2008
New Revision: 636804

URL: http://svn.apache.org/viewvc?rev=636804&view=rev
Log:
BEANUTILS-266 - Log or throw exception, not both

Modified:
    commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java
    commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java
    commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java

Modified: commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java?rev=636804&r1=636803&r2=636804&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java
(original)
+++ commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java
Thu Mar 13 09:59:10 2008
@@ -168,23 +168,35 @@
             final String errorMsg = "Unable to execute Closure. Null value encountered in
property path...";
 
             if (ignoreNull) {
-                log.warn("WARNING: " + errorMsg, e);
+                log.warn("WARNING: " + errorMsg + e);
             } else {
-                log.error("ERROR: " + errorMsg, e);
-                throw e;
+                IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+                if (!BeanUtils.initCause(iae, e)) {
+                    log.error(errorMsg, e);
+                }
+                throw iae;
             }
         } catch (IllegalAccessException e) {
             final String errorMsg = "Unable to access the property provided.";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         } catch (InvocationTargetException e) {
             final String errorMsg = "Exception occurred in property's getter";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         } catch (NoSuchMethodException e) {
             final String errorMsg = "Property not found";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         }
     }
 

Modified: commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java?rev=636804&r1=636803&r2=636804&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java
(original)
+++ commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java
Thu Mar 13 09:59:10 2008
@@ -203,23 +203,35 @@
             final String errorMsg = "Problem during evaluation. Null value encountered in
property path...";
 
             if (ignoreNull) {
-                log.warn("WARNING: " + errorMsg, e);
+                log.warn("WARNING: " + errorMsg + e);
             } else {
-                log.error("ERROR: " + errorMsg, e);
-                throw e;
+                IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+                if (!BeanUtils.initCause(iae, e)) {
+                    log.error(errorMsg, e);
+                }
+                throw iae;
             }
         } catch (IllegalAccessException e) {
             final String errorMsg = "Unable to access the property provided.";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         } catch (InvocationTargetException e) {
             final String errorMsg = "Exception occurred in property's getter";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         } catch (NoSuchMethodException e) {
             final String errorMsg = "Property not found.";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         }
 
         return evaluation;

Modified: commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java?rev=636804&r1=636803&r2=636804&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java
(original)
+++ commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java
Thu Mar 13 09:59:10 2008
@@ -155,24 +155,36 @@
             final String errorMsg = "Problem during transformation. Null value encountered
in property path...";
 
             if (ignoreNull) {
-                log.warn("WARNING: " + errorMsg, e);
+                log.warn("WARNING: " + errorMsg + e);
             } else {
-                log.error("ERROR: " + errorMsg, e);
-                throw e;
+                IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+                if (!BeanUtils.initCause(iae, e)) {
+                    log.error(errorMsg, e);
+                }
+                throw iae;
             }
         } catch (IllegalAccessException e) {
             final String errorMsg = "Unable to access the property provided.";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         } catch (InvocationTargetException e) {
             final String errorMsg = "Exception occurred in property's getter";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         } catch (NoSuchMethodException e) {
             final String errorMsg = "No property found for name [" +
                 propertyName + "]";
-            log.error(errorMsg, e);
-            throw new IllegalArgumentException(errorMsg);
+            IllegalArgumentException iae = new IllegalArgumentException(errorMsg);
+            if (!BeanUtils.initCause(iae, e)) {
+                log.error(errorMsg, e);
+            }
+            throw iae;
         }
 
         return propertyValue;



Mime
View raw message