openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r590143 - /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
Date Tue, 30 Oct 2007 16:51:33 GMT
Author: pcl
Date: Tue Oct 30 09:51:32 2007
New Revision: 590143

URL: http://svn.apache.org/viewvc?rev=590143&view=rev
Log:
Avoid potential NPE; fix error msg.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java?rev=590143&r1=590142&r2=590143&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
Tue Oct 30 09:51:32 2007
@@ -463,10 +463,11 @@
                 // merge the fetchgroup required fields to the original
                 // fields only the fields are not already loaded and
                 // are not in the original fields.
-                for (int j = 0; j < fgFields.length(); j++) {
-                    if (fgFields.get(j) && !fields.get(j) && !_loaded.get(j))
-                        fields.set(j);
-                }
+                if (fgFields != null)
+                    for (int j = 0; j < fgFields.length(); j++) {
+                        if (fgFields.get(j) && !fields.get(j) &&!_loaded.get(j))
+                            fields.set(j);
+                    }
             }
 
         }
@@ -597,7 +598,7 @@
         // Just return if there's no value generation strategy
         if (fmd.getValueStrategy() == ValueStrategies.NONE)
             return false;
-        
+
         // Throw exception if field already has a value assigned.
         // @GeneratedValue overrides POJO initial values and setter methods
         if (!isDefaultValue(field) && !fmd.isValueGenerated())
@@ -816,7 +817,8 @@
 
         SaveFieldManager saved = getSaveFieldManager();
         if (saved == null)
-            throw new InternalException(_loc.get("no-saved-fields"));
+            throw new InternalException(_loc.get("no-saved-fields",
+                getManagedInstance()));
 
         FieldMetaData[] fmds = getMetaData().getFields();
         for (int i = 0; i < fmds.length; i++) {



Mime
View raw message