db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1375892 - in /db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque: TorqueInstance.java oid/IDGeneratorFactory.java
Date Wed, 22 Aug 2012 04:11:34 GMT
Author: tfischer
Date: Wed Aug 22 04:11:33 2012
New Revision: 1375892

URL: http://svn.apache.org/viewvc?rev=1375892&view=rev
Log:
fix findbugs error: mutable array used as constant

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java?rev=1375892&r1=1375891&r2=1375892&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
Wed Aug 22 04:11:33 2012
@@ -36,6 +36,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.torque.adapter.Adapter;
 import org.apache.torque.adapter.AdapterFactory;
+import org.apache.torque.adapter.IDMethod;
 import org.apache.torque.dsfactory.DataSourceFactory;
 import org.apache.torque.manager.AbstractBaseManager;
 import org.apache.torque.map.DatabaseMap;
@@ -357,12 +358,11 @@ public class TorqueInstance
                             + handle + " as Adapter");
 
                     // add Id generators
-                    for (int i = 0;
-                            i < IDGeneratorFactory.ID_GENERATOR_METHODS.length;
-                            i++)
+                    for (IDMethod idMethod
+                            : IDGeneratorFactory.ID_GENERATOR_METHODS)
                     {
                         database.addIdGenerator(
-                                IDGeneratorFactory.ID_GENERATOR_METHODS[i],
+                                idMethod,
                                 IDGeneratorFactory.create(adapter, handle));
                     }
                 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java?rev=1375892&r1=1375891&r2=1375892&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDGeneratorFactory.java
Wed Aug 22 04:11:33 2012
@@ -19,6 +19,10 @@ package org.apache.torque.oid;
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.torque.adapter.Adapter;
 import org.apache.torque.adapter.IDMethod;
 
@@ -32,6 +36,21 @@ import org.apache.torque.adapter.IDMetho
 public final class IDGeneratorFactory
 {
     /**
+     * The list of ID generation method types which have associated
+     * {@link org.apache.torque.oid.IdGenerator} implementations.
+     */
+    public static final List<IDMethod> ID_GENERATOR_METHODS;
+
+    static
+    {
+        List<IDMethod> idGeneratorMethods = new ArrayList<IDMethod>();
+        idGeneratorMethods.add(IDMethod.NATIVE);
+        idGeneratorMethods.add(IDMethod.AUTO_INCREMENT);
+        idGeneratorMethods.add(IDMethod.SEQUENCE);
+        ID_GENERATOR_METHODS = Collections.unmodifiableList(idGeneratorMethods);
+    }
+
+    /**
      * Private constructor to prevent initialisation.
      *
      * This class contains only static methods and thus should not be
@@ -43,15 +62,6 @@ public final class IDGeneratorFactory
     }
 
     /**
-     * The list of ID generation method types which have associated
-     * {@link org.apache.torque.oid.IdGenerator} implementations.
-     */
-    public static final IDMethod[] ID_GENERATOR_METHODS =
-    {
-        IDMethod.NATIVE, IDMethod.AUTO_INCREMENT, IDMethod.SEQUENCE
-    };
-
-    /**
      * Factory method which instantiates {@link
      * org.apache.torque.oid.IdGenerator} implementations based on the
      * return value of the provided adapter's {@link



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message