openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r955046 - in /openjpa/trunk/openjpa-kernel/src/main: java/org/apache/openjpa/datacache/ java/org/apache/openjpa/enhance/ java/org/apache/openjpa/kernel/ java/org/apache/openjpa/kernel/jpql/ java/org/apache/openjpa/meta/ java/org/apache/open...
Date Tue, 15 Jun 2010 20:53:39 GMT
Author: dwoods
Date: Tue Jun 15 20:53:38 2010
New Revision: 955046

URL: http://svn.apache.org/viewvc?rev=955046&view=rev
Log:
OPENJPA-1700 FindBugs - Method invokes inefficient Number constructor; use static valueOf
instead

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java
    openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/ParseException.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
Tue Jun 15 20:53:38 2010
@@ -89,7 +89,7 @@ public abstract class AbstractQueryCache
             // Pre-load all the entity types into the HashMap to handle 
             // synchronization on the map efficiently
             for (Object o : perTypes)
-                entityTimestampMap.put((String)o, new Long(0));
+                entityTimestampMap.put((String)o, Long.valueOf(0));
         }
     }
 
@@ -121,7 +121,7 @@ public abstract class AbstractQueryCache
             Collection changedTypes = ev.getTypes();
             HashMap<String,Long> changedClasses = 
                 new HashMap<String,Long>();
-            Long tstamp = new Long(System.currentTimeMillis());
+            Long tstamp = Long.valueOf(System.currentTimeMillis());
             for (Object o: changedTypes) {
                 String name = ((Class) o).getName();
                 if(!changedClasses.containsKey(name)) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/ReflectingPersistenceCapable.java
Tue Jun 15 20:53:38 2010
@@ -144,10 +144,10 @@ public class ReflectingPersistenceCapabl
                     sm.replaceBooleanField(this, i)));
                 break;
             case JavaTypes.BYTE:
-                setValue(i, o, new Byte(sm.replaceByteField(this, i)));
+                setValue(i, o, Byte.valueOf(sm.replaceByteField(this, i)));
                 break;
             case JavaTypes.CHAR:
-                setValue(i, o, new Character(sm.replaceCharField(this, i)));
+                setValue(i, o, Character.valueOf(sm.replaceCharField(this, i)));
                 break;
             case JavaTypes.DOUBLE:
                 setValue(i, o, new Double(sm.replaceDoubleField(this, i)));
@@ -156,13 +156,13 @@ public class ReflectingPersistenceCapabl
                 setValue(i, o, new Float(sm.replaceFloatField(this, i)));
                 break;
             case JavaTypes.INT:
-                setValue(i, o, new Integer(sm.replaceIntField(this, i)));
+                setValue(i, o, Integer.valueOf(sm.replaceIntField(this, i)));
                 break;
             case JavaTypes.LONG:
-                setValue(i, o, new Long(sm.replaceLongField(this, i)));
+                setValue(i, o, Long.valueOf(sm.replaceLongField(this, i)));
                 break;
             case JavaTypes.SHORT:
-                setValue(i, o, new Short(sm.replaceShortField(this, i)));
+                setValue(i, o, Short.valueOf(sm.replaceShortField(this, i)));
                 break;
             case JavaTypes.STRING:
                 setValue(i, o, sm.replaceStringField(this, i));

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
Tue Jun 15 20:53:38 2010
@@ -779,14 +779,14 @@ public class Reflection {
      * Invoke the given setter on the given object.
      */
     public static void set(Object target, Method setter, byte value) {
-        set(target, setter, new Byte(value));
+        set(target, setter, Byte.valueOf(value));
     }
 
     /**
      * Invoke the given setter on the given object.
      */
     public static void set(Object target, Method setter, char value) {
-        set(target, setter, new Character(value));
+        set(target, setter, Character.valueOf(value));
     }
 
     /**
@@ -807,21 +807,21 @@ public class Reflection {
      * Invoke the given setter on the given object.
      */
     public static void set(Object target, Method setter, int value) {
-        set(target, setter, new Integer(value));
+        set(target, setter, Integer.valueOf(value));
     }
 
     /**
      * Invoke the given setter on the given object.
      */
     public static void set(Object target, Method setter, long value) {
-        set(target, setter, new Long(value));
+        set(target, setter, Long.valueOf(value));
     }
 
     /**
      * Invoke the given setter on the given object.
      */
     public static void set(Object target, Method setter, short value) {
-        set(target, setter, new Short(value));
+        set(target, setter, Short.valueOf(value));
     }
     
     /**

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java Tue
Jun 15 20:53:38 2010
@@ -1624,7 +1624,7 @@ public class BrokerImpl
                     && (tranStatus != Status.STATUS_COMMITTED))
                 _runtime.setRollbackOnly(cause);
             else if (_log.isTraceEnabled())
-                _log.trace(_loc.get("invalid-tran-status", new Integer(
+                _log.trace(_loc.get("invalid-tran-status", Integer.valueOf(
                         tranStatus), "setRollbackOnly"));
         } catch (OpenJPAException ke) {
             throw ke;

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedValueStateManager.java
Tue Jun 15 20:53:38 2010
@@ -309,9 +309,9 @@ public class DetachedValueStateManager
                 return (fm.fetchBooleanField(field)) ? Boolean.TRUE
                     : Boolean.FALSE;
             case JavaTypes.BYTE:
-                return new Byte(fm.fetchByteField(field));
+                return Byte.valueOf(fm.fetchByteField(field));
             case JavaTypes.CHAR:
-                return new Character(fm.fetchCharField(field));
+                return Character.valueOf(fm.fetchCharField(field));
             case JavaTypes.DOUBLE:
                 return new Double(fm.fetchDoubleField(field));
             case JavaTypes.FLOAT:
@@ -321,7 +321,7 @@ public class DetachedValueStateManager
             case JavaTypes.LONG:
                 return fm.fetchLongField(field);
             case JavaTypes.SHORT:
-                return new Short(fm.fetchShortField(field));
+                return Short.valueOf(fm.fetchShortField(field));
             default:
                 return fm.fetchObjectField(field);
         }

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
Tue Jun 15 20:53:38 2010
@@ -307,7 +307,7 @@ public class FetchConfigurationImpl
             && flush != QueryFlushModes.FLUSH_FALSE
             && flush != QueryFlushModes.FLUSH_WITH_CONNECTION)
             throw new IllegalArgumentException(_loc.get(
-                "bad-flush-before-queries", new Integer(flush)).getMessage());
+                "bad-flush-before-queries", Integer.valueOf(flush)).getMessage());
 
         if (flush == DEFAULT && _state.ctx != null)
             _state.flushQuery = _state.ctx.getConfiguration().
@@ -549,7 +549,7 @@ public class FetchConfigurationImpl
                 && scope != LockScopes.LOCKSCOPE_NORMAL
                 && scope != LockScopes.LOCKSCOPE_EXTENDED)
                 throw new IllegalArgumentException(_loc.get(
-                    "bad-lock-scope", new Integer(scope)).getMessage());
+                    "bad-lock-scope", Integer.valueOf(scope)).getMessage());
         if (scope == DEFAULT )
             _state.lockScope = LOCKSCOPE_NORMAL;
         else
@@ -575,7 +575,7 @@ public class FetchConfigurationImpl
             && level != MixedLockLevels.LOCK_PESSIMISTIC_WRITE
             && level != MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT)
             throw new IllegalArgumentException(_loc.get(
-                "bad-lock-level", new Integer(level)).getMessage());
+                "bad-lock-level", Integer.valueOf(level)).getMessage());
 
         lock();
         try {
@@ -610,7 +610,7 @@ public class FetchConfigurationImpl
             && level != MixedLockLevels.LOCK_PESSIMISTIC_WRITE
             && level != MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT)
             throw new IllegalArgumentException(_loc.get(
-                "bad-lock-level", new Integer(level)).getMessage());
+                "bad-lock-level", Integer.valueOf(level)).getMessage());
 
         lock();
         try {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/Filters.java Tue
Jun 15 20:53:38 2010
@@ -298,7 +298,7 @@ public class Filters {
             else if (type == Character.class) {
                 String str = o.toString();
                 if (str != null && str.length() == 1)
-                    return new Character(str.charAt(0));
+                    return Character.valueOf(str.charAt(0));
             } else if (Calendar.class.isAssignableFrom(type) &&
                 o instanceof Date) {
                 Calendar cal = Calendar.getInstance();
@@ -359,9 +359,9 @@ public class Filters {
         } else if (type == BigInteger.class) {
             return new BigInteger(o.toString());
         } else if (type == Short.class && allowNumericConversion(o.getClass(), type,
strictNumericConversion)) {
-            return new Short(((Number) o).shortValue());
+            return Short.valueOf(((Number) o).shortValue());
         } else if (type == Byte.class && allowNumericConversion(o.getClass(), type,
strictNumericConversion)) {
-            return new Byte(((Number) o).byteValue());
+            return Byte.valueOf(((Number) o).byteValue());
         } else if (!strictNumericConversion) {
             return ((Number) o).intValue();
         } else {
@@ -1017,15 +1017,15 @@ public class Filters {
     
     public static Object getDefaultForNull(Class<?> nType) {
         if (nType == Long.class) 
-            return new Long(0);
+            return Long.valueOf(0);
         if (nType == Integer.class)
-            return new Integer(0);
+            return Integer.valueOf(0);
         if (nType == Double.class) 
             return new Double(0.0);
         if (nType == Float.class) 
             return new Float(0.0);
         if (nType == Short.class) 
-            return new Short((short)0);
+            return Short.valueOf((short)0);
         return null;
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ObjectIdStateManager.java
Tue Jun 15 20:53:38 2010
@@ -47,11 +47,11 @@ import org.apache.openjpa.util.ImplHelpe
 public class ObjectIdStateManager
     implements OpenJPAStateManager {
 
-    private static final Byte ZERO_BYTE = new Byte((byte) 0);
-    private static final Character ZERO_CHAR = new Character((char) 0);
+    private static final Byte ZERO_BYTE = Byte.valueOf((byte)0);
+    private static final Character ZERO_CHAR = Character.valueOf((char)0);
     private static final Double ZERO_DOUBLE = new Double(0);
     private static final Float ZERO_FLOAT = new Float(0);
-    private static final Short ZERO_SHORT = new Short((short) 0);
+    private static final Short ZERO_SHORT = Short.valueOf((short)0);
 
     private Object _oid;
     private final OpenJPAStateManager _owner;
@@ -463,11 +463,11 @@ public class ObjectIdStateManager
     }
 
     public void storeByte(int field, byte extVal) {
-        setValue(field, new Byte(extVal), true);
+        setValue(field, Byte.valueOf(extVal), true);
     }
 
     public void storeChar(int field, char extVal) {
-        setValue(field, new Character(extVal), true);
+        setValue(field, Character.valueOf(extVal), true);
     }
 
     public void storeInt(int field, int extVal) {
@@ -475,7 +475,7 @@ public class ObjectIdStateManager
     }
 
     public void storeShort(int field, short extVal) {
-        setValue(field, new Short(extVal), true);
+        setValue(field, Short.valueOf(extVal), true);
     }
 
     public void storeLong(int field, long extVal) {

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=955046&r1=955045&r2=955046&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 Jun 15 20:53:38 2010
@@ -848,9 +848,9 @@ public class StateManagerImpl
                 return (fetchBooleanField(field)) ? Boolean.TRUE
                     : Boolean.FALSE;
             case JavaTypes.BYTE:
-                return new Byte(fetchByteField(field));
+                return Byte.valueOf(fetchByteField(field));
             case JavaTypes.CHAR:
-                return new Character(fetchCharField(field));
+                return Character.valueOf(fetchCharField(field));
             case JavaTypes.DOUBLE:
                 return new Double(fetchDoubleField(field));
             case JavaTypes.FLOAT:
@@ -860,7 +860,7 @@ public class StateManagerImpl
             case JavaTypes.LONG:
                 return fetchLongField(field);
             case JavaTypes.SHORT:
-                return new Short(fetchShortField(field));
+                return Short.valueOf(fetchShortField(field));
             default:
                 return fetchObjectField(field);
         }
@@ -979,9 +979,9 @@ public class StateManagerImpl
                 return (fm.fetchBooleanField(field)) ? Boolean.TRUE
                     : Boolean.FALSE;
             case JavaTypes.BYTE:
-                return new Byte(fm.fetchByteField(field));
+                return Byte.valueOf(fm.fetchByteField(field));
             case JavaTypes.CHAR:
-                return new Character(fm.fetchCharField(field));
+                return Character.valueOf(fm.fetchCharField(field));
             case JavaTypes.DOUBLE:
                 return new Double(fm.fetchDoubleField(field));
             case JavaTypes.FLOAT:
@@ -991,7 +991,7 @@ public class StateManagerImpl
             case JavaTypes.LONG:
                 return fm.fetchLongField(field);
             case JavaTypes.SHORT:
-                return new Short(fm.fetchShortField(field));
+                return Short.valueOf(fm.fetchShortField(field));
             case JavaTypes.STRING:
                 return fm.fetchStringField(field);
             default:
@@ -2444,7 +2444,7 @@ public class StateManagerImpl
         if (!fmd.isExternalized())
             storeByteField(field, externalVal);
         else
-            storeField(field, fmd.getFieldValue(new Byte(externalVal),
+            storeField(field, fmd.getFieldValue(Byte.valueOf(externalVal),
                 _broker));
     }
 
@@ -2465,7 +2465,7 @@ public class StateManagerImpl
         if (!fmd.isExternalized())
             storeCharField(field, externalVal);
         else
-            storeField(field, fmd.getFieldValue(new Character(externalVal),
+            storeField(field, fmd.getFieldValue(Character.valueOf(externalVal),
                 _broker));
     }
 
@@ -2592,7 +2592,7 @@ public class StateManagerImpl
         if (!fmd.isExternalized())
             storeShortField(field, externalVal);
         else
-            storeField(field, fmd.getFieldValue(new Short(externalVal),
+            storeField(field, fmd.getFieldValue(Short.valueOf(externalVal),
                 _broker));
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
Tue Jun 15 20:53:38 2010
@@ -1008,7 +1008,7 @@ public class JPQLExpressionBuilder
                         ? node.text.substring(0, node.text.length() - 1)
                         : node.text).
                     multiply(new BigDecimal(negative(node)));
-                return factory.newLiteral(new Long(intlit.longValue()),
+                return factory.newLiteral(Long.valueOf(intlit.longValue()),
                     Literal.TYPE_NUMBER);
 
             case JJTDECIMALLITERAL:
@@ -1431,13 +1431,13 @@ public class JPQLExpressionBuilder
             // optimize SQL for the common case of two literals
             long jpqlStart = ((Number) ((Literal) val2).getValue())
                 .longValue();
-            start = factory.newLiteral(new Long(jpqlStart - 1),
+            start = factory.newLiteral(Long.valueOf(jpqlStart - 1),
                 Literal.TYPE_NUMBER);
             if (val3 != null) {
             	long length = ((Number) ((Literal) val3).getValue())
                     .longValue();
             long endIndex = length + (jpqlStart - 1);
-            end = factory.newLiteral(new Long(endIndex),
+            end = factory.newLiteral(Long.valueOf(endIndex),
                 Literal.TYPE_NUMBER);
             }
         } else {
@@ -2140,7 +2140,7 @@ public class JPQLExpressionBuilder
     private JPQLNode child(JPQLNode node, int childNum, int assertCount) {
         if (node.children.length != assertCount)
             throw parseException(EX_USER, "wrong-child-count",
-                new Object[]{ new Integer(assertCount), node,
+                new Object[]{ Integer.valueOf(assertCount), node,
                     Arrays.asList(node.children) }, null);
 
         return node.children[childNum];

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
Tue Jun 15 20:53:38 2010
@@ -1529,7 +1529,7 @@ public class FieldMetaData
                 return Float.valueOf(val);
             case JavaTypes.CHAR:
             case JavaTypes.CHAR_OBJ:
-                return new Character(val.charAt(0));
+                return Character.valueOf(val.charAt(0));
             case JavaTypes.STRING:
                 return val;
             case JavaTypes.ENUM:

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/JavaTypes.java Tue
Jun 15 20:53:38 2010
@@ -272,20 +272,20 @@ public class JavaTypes {
                 if (val instanceof Byte)
                     return val;
                 if (val instanceof Number)
-                    return new Byte(((Number) val).byteValue());
+                    return Byte.valueOf(((Number) val).byteValue());
                 // no break
             case BYTE:
                 if (val instanceof String)
-                    return new Byte(val.toString());
+                    return Byte.valueOf((String)val);
                 return val;
             case CHAR:
             case CHAR_OBJ:
                 if (val instanceof Character)
                     return val;
                 if (val instanceof String)
-                    return new Character(val.toString().charAt(0));
+                    return Character.valueOf(val.toString().charAt(0));
                 if (val instanceof Number)
-                    return new Character((char) ((Number) val).intValue());
+                    return Character.valueOf((char) ((Number) val).intValue());
                 return val;
             case DATE:
                 if (val instanceof String)
@@ -319,7 +319,7 @@ public class JavaTypes {
                 // no break
             case INT:
                 if (val instanceof String)
-                    return new Integer(val.toString());
+                    return Integer.valueOf(val.toString());
                 return val;
             case LONG_OBJ:
                 if (val instanceof Long)
@@ -329,7 +329,7 @@ public class JavaTypes {
                 // no break
             case LONG:
                 if (val instanceof String)
-                    return new Long(val.toString());
+                    return Long.valueOf(val.toString());
                 return val;
             case NUMBER:
                 if (val instanceof Number)
@@ -341,11 +341,11 @@ public class JavaTypes {
                 if (val instanceof Short)
                     return val;
                 if (val instanceof Number)
-                    return new Short(((Number) val).shortValue());
+                    return Short.valueOf(((Number) val).shortValue());
                 // no break
             case SHORT:
                 if (val instanceof String)
-                    return new Short(val.toString());
+                    return Short.valueOf(val.toString());
                 return val;
             case STRING:
                 return val.toString();

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
Tue Jun 15 20:53:38 2010
@@ -596,15 +596,15 @@ public class ApplicationIds {
         }
 
         public void storeByteField(int field, byte val) {
-            store(new Byte(val));
+            store(Byte.valueOf(val));
         }
 
         public void storeCharField(int field, char val) {
-            store(new Character(val));
+            store(Character.valueOf(val));
         }
 
         public void storeShortField(int field, short val) {
-            store(new Short(val));
+            store(Short.valueOf(val));
         }
 
         public void storeIntField(int field, int val) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java Tue Jun
15 20:53:38 2010
@@ -50,7 +50,7 @@ public final class ByteId extends OpenJP
     }
 
     public Object getIdObject() {
-        return new Byte(key);
+        return Byte.valueOf(key);
     }
 
     public String toString() {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java Tue Jun
15 20:53:38 2010
@@ -50,7 +50,7 @@ public final class CharId extends OpenJP
     }
 
     public Object getIdObject() {
-        return new Character(key);
+        return Character.valueOf(key);
     }
 
     public String toString() {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java Tue
Jun 15 20:53:38 2010
@@ -116,7 +116,7 @@ public abstract class OpenJPAId
                     superclass = base.getSuperclass();
                 }
                 _typeHash = base.hashCode();
-                _typeCache.put(type, new Integer(_typeHash));
+                _typeCache.put(type, Integer.valueOf(_typeHash));
             } else {
                 _typeHash = typeHashInt.intValue();
             }

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java Tue Jun
15 20:53:38 2010
@@ -50,7 +50,7 @@ public final class ShortId extends OpenJ
     }
 
     public Object getIdObject() {
-        return new Short(key);
+        return Short.valueOf(key);
     }
 
     public String toString() {

Modified: openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/ParseException.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/ParseException.java?rev=955046&r1=955045&r2=955046&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/ParseException.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/ParseException.java
Tue Jun 15 20:53:38 2010
@@ -121,7 +121,7 @@ public class ParseException
         String curtok = curtokBuf.toString();
 
         return _loc.get("bad-parse", new Object[]{ curtok,
-            new Integer(currentToken.next.beginColumn), expected });
+            Integer.valueOf(currentToken.next.beginColumn), expected });
     }
 
     /**



Mime
View raw message