openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1030172 - in /openjpa/trunk: openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/ openjpa-lib/src/main/java/org/apache/openjpa/lib/log/ openjpa-lib/src/main/java/org/apache/openjpa/lib/util/ openjpa-persistence-jdbc/src/main/java/o...
Date Tue, 02 Nov 2010 18:50:14 GMT
Author: curtisr7
Date: Tue Nov  2 18:50:13 2010
New Revision: 1030172

URL: http://svn.apache.org/viewvc?rev=1030172&view=rev
Log:
OPENJPA-1868: Miscellaneous FindBugs suggested performance improvements for lib, persistence,
and persistence-jdbc.

Modified:
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierUtilImpl.java
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/MultiLogFactory.java
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierUtilImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierUtilImpl.java?rev=1030172&r1=1030171&r2=1030172&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierUtilImpl.java
(original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierUtilImpl.java
Tue Nov  2 18:50:13 2010
@@ -88,7 +88,7 @@ public class IdentifierUtilImpl implemen
         }
         
         if (delimited) {
-            combined = delimit(config, rule, combined.toString()).toString();
+            combined = delimit(config, rule, combined.toString());
         }
         
         return combined;
@@ -105,7 +105,7 @@ public class IdentifierUtilImpl implemen
             delimit = true;
         }
         String name = name1 + config.getIdentifierConcatenator() + name2;
-        return delimit(config, rule, name, delimit).toString();
+        return delimit(config, rule, name, delimit);
     }
 
     public String combineNames(IdentifierConfiguration config, IdentifierRule namingRule,
String[] names) {
@@ -125,7 +125,7 @@ public class IdentifierUtilImpl implemen
             }
         }
         if (delimited) {
-            combined = delimit(config, namingRule, combined.toString()).toString();
+            combined = delimit(config, namingRule, combined.toString());
         }
         
         return combined;
@@ -145,7 +145,7 @@ public class IdentifierUtilImpl implemen
             name2 = IdentifierUtil.EMPTY;
         }
         String name = name1 + name2;
-        return delimit(rule, name).toString();
+        return delimit(rule, name);
     }
 
     /**
@@ -414,7 +414,7 @@ public class IdentifierUtilImpl implemen
         }
         tName = tName.substring(0, tName.length() - length);
         if (delimited) {
-            tName = delimit(namingRule, tName).toString();
+            tName = delimit(namingRule, tName);
         }
         return tName;
     }
@@ -477,7 +477,7 @@ public class IdentifierUtilImpl implemen
 
         name = name.substring(newStart);
         if (delimited) {
-            name = delimit(rule, name).toString();
+            name = delimit(rule, name);
         }
         return name;
     }
@@ -502,7 +502,7 @@ public class IdentifierUtilImpl implemen
         if (delimit) {
             name = removeDelimiters(config, orule, name, config.getLeadingDelimiter(), 
                 config.getTrailingDelimiter());
-            return delimit(getIdentifierConfiguration(), nrule, name, delimit).toString();
+            return delimit(getIdentifierConfiguration(), nrule, name, delimit);
         }
         return name;
     }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java?rev=1030172&r1=1030171&r2=1030172&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java
(original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java
Tue Nov  2 18:50:13 2010
@@ -277,8 +277,7 @@ public class LogFactoryImpl 
             for (Iterator<Map.Entry<Object, Object>> iter =
                 opts.entrySet().iterator(); iter.hasNext();) {
                 e = iter.next();
-                _configuredLevels.put(shorten((String) e.getKey()), new Short(
-                    getLevel((String) e.getValue())));
+                _configuredLevels.put(shorten((String) e.getKey()), Short.valueOf(getLevel((String)
e.getValue())));
             }
             opts.clear();
         }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/MultiLogFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/MultiLogFactory.java?rev=1030172&r1=1030171&r2=1030172&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/MultiLogFactory.java
(original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/MultiLogFactory.java
Tue Nov  2 18:50:13 2010
@@ -68,7 +68,7 @@ public class MultiLogFactory implements 
      * Returns the delegates that this MultiLogFactory delegates messages to.
      */
     public LogFactory[] getDelegates() {
-        return (LogFactory[]) _delegates.toArray(new LogFactory[0]);
+        return (LogFactory[]) _delegates.toArray(new LogFactory[_delegates.size()]);
     }
 
     /**

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java?rev=1030172&r1=1030171&r2=1030172&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java
(original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/J2DoPrivHelper.java
Tue Nov  2 18:50:13 2010
@@ -597,7 +597,7 @@ public abstract class J2DoPrivHelper {
     public static final PrivilegedAction<Long> lengthAction(final File f) {
         return new PrivilegedAction<Long>() {
             public Long run() {
-                return new Long(f.length());
+                return Long.valueOf(f.length());
             }
         };
     }

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java?rev=1030172&r1=1030171&r2=1030172&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java Tue Nov
 2 18:50:13 2010
@@ -62,13 +62,13 @@ public class Options extends TypedProper
     // maps primitive types to the appropriate wrapper class and default value
     private static Object[][] _primWrappers = new Object[][]{
         { boolean.class, Boolean.class, Boolean.FALSE },
-        { byte.class, Byte.class, new Byte((byte) 0) },
-        { char.class, Character.class, new Character((char) 0) },
-        { double.class, Double.class, new Double(0D) },
-        { float.class, Float.class, new Float(0F) },
-        { int.class, Integer.class, new Integer(0) },
-        { long.class, Long.class, new Long(0L) },
-        { short.class, Short.class, new Short((short) 0) }, };
+        { byte.class, Byte.class, Byte.valueOf((byte) 0) },
+        { char.class, Character.class, Character.valueOf((char) 0) },
+        { double.class, Double.class, Double.valueOf(0D) },
+        { float.class, Float.class, Float.valueOf(0F) },
+        { int.class, Integer.class, Integer.valueOf(0) },
+        { long.class, Long.class, Long.valueOf(0L) },
+        { short.class, Short.class, Short.valueOf((short) 0) }, };
 
     /**
      * Default constructor.

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java?rev=1030172&r1=1030171&r2=1030172&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
Tue Nov  2 18:50:13 2010
@@ -1401,14 +1401,12 @@ public class XMLPersistenceMappingParser
         super.addDeferredEmbeddableMetaData();
         if (_deferredMappings.size() > 0) {
             Set<Class<?>> keys = _deferredMappings.keySet();
-            Class[] classes = keys.toArray(new Class[0]);
+            Class<?>[] classes = keys.toArray(new Class[keys.size()]);
             for (int i = 0; i < classes.length; i++) {
                 try {
                     applyDeferredEmbeddableOverrides(classes[i]);
                 } catch (Exception e) {
-                    throw new MetaDataException(
-                            _loc.get("no-embeddable-metadata",
-                                classes[i].getName()), e);
+                    throw new MetaDataException(_loc.get("no-embeddable-metadata", classes[i].getName()),
e);
                 }
             }
         }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java?rev=1030172&r1=1030171&r2=1030172&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
Tue Nov  2 18:50:13 2010
@@ -590,7 +590,7 @@ class Expressions {
     }
     
     public static class Trim extends BinarayFunctionalExpression<String> {
-        static Expression<Character> defaultTrim = new Constant<Character>(Character.class,
new Character(' '));
+        static Expression<Character> defaultTrim = new Constant<Character>(Character.class,
Character.valueOf(' '));
         static Trimspec defaultSpec = Trimspec.BOTH;
         private Trimspec ts;
         



Mime
View raw message