tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r535095 - /incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java
Date Fri, 04 May 2007 05:07:26 GMT
Author: rfeng
Date: Thu May  3 22:07:25 2007
New Revision: 535095

URL: http://svn.apache.org/viewvc?view=rev&rev=535095
Log:
Test if a property is readable to avoid NPE

Modified:
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java?view=diff&rev=535095&r1=535094&r2=535095
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java
(original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java
Thu May  3 22:07:25 2007
@@ -25,6 +25,7 @@
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
@@ -78,7 +79,11 @@
                     try {
 
                         // Get the value of each property
-                        Object value = propertyDescriptor.getReadMethod().invoke(object);
+                        Method getter = propertyDescriptor.getReadMethod();
+                        if (getter == null) {
+                            continue;
+                        }
+                        Object value = getter.invoke(object);
                         if (value != null) {
 
                             // Convert array value into a list



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message