Author: rmannibucau
Date: Mon Aug  8 09:38:08 2011
New Revision: 1154891

URL: http://svn.apache.org/viewvc?rev=1154891&view=rev
Log:
fixing bad test to avoid exception

Modified:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1154891&r1=1154890&r2=1154891&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 Mon Aug  8 09:38:08 2011
@@ -736,10 +736,14 @@ public class AnnotationDeployer implemen
                                                        }
                                                        
                                                        
javax.resource.spi.ConfigProperty annotation = 
propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
-                                                       if (annotation == null 
&& clazz.getDeclaredField(name) != null) {
-                                                               // if there's 
no annotation on the setter, we'll try and scrape one off the field itself 
(assuming the same name)
-                                                               annotation = 
clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
-                                                       }
+                            if (annotation == null) {
+                                try {
+                                    // if there's no annotation on the setter, 
we'll try and scrape one off the field itself (assuming the same name)
+                                    annotation = 
clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
+                                } catch (Exception ignored) {
+                                    // no-op : getDeclaredField() throws 
exceptions and does not return null
+                                }
+                            }
                                                        
                                                        
configProperty.setConfigPropertyName(name);
                                                        
configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));


Reply via email to