openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r446802 - /incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
Date Sat, 16 Sep 2006 01:26:01 GMT
Author: mprudhom
Date: Fri Sep 15 18:25:59 2006
New Revision: 446802

URL: http://svn.apache.org/viewvc?view=rev&rev=446802
Log:
Fixed possibility of a null method in getMethodDescriptors.

Modified:
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java?view=diff&rev=446802&r1=446801&r2=446802
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
(original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
Fri Sep 15 18:25:59 2006
@@ -42,6 +42,7 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.MissingResourceException;
@@ -372,15 +373,19 @@
         if (_mds != null)
             return _mds;
         PropertyDescriptor[] pds = getPropertyDescriptors();
-        _mds = new MethodDescriptor[pds.length * 2];
+
+        List descs = new LinkedList(); 
         for (int i = 0; i < pds.length; i++) {
             Method write = pds[i].getWriteMethod();
-            if (write != null)
-                _mds[i * 2] = new MethodDescriptor(write);
             Method read = pds[i].getReadMethod();
-            if (read != null)
-                _mds[(i * 2) + 1] = new MethodDescriptor(read);
+            if (read != null && write != null) {
+                descs.add(new MethodDescriptor(write));
+                descs.add(new MethodDescriptor(read));
+            }
         }
+
+        _mds = (MethodDescriptor[])descs.
+            toArray(new MethodDescriptor[descs.size()]);
         return _mds;
     }
 



Mime
View raw message