diff --git a/src/java/com/samskivert/jdbc/jora/FieldDescriptor.java b/src/java/com/samskivert/jdbc/jora/FieldDescriptor.java index 3e3fc05a..972059b9 100644 --- a/src/java/com/samskivert/jdbc/jora/FieldDescriptor.java +++ b/src/java/com/samskivert/jdbc/jora/FieldDescriptor.java @@ -311,32 +311,32 @@ class FieldDescriptor case tByte: byte b = result.getByte(column); - field.set(obj, result.wasNull() ? null : new Byte(b)); + field.set(obj, result.wasNull() ? null : Byte.valueOf(b)); break; case tShort: short s = result.getShort(column); - field.set(obj, result.wasNull() ? null : new Short(s)); + field.set(obj, result.wasNull() ? null : Short.valueOf(s)); break; case tInteger: int i = result.getInt(column); - field.set(obj, result.wasNull() ? null : new Integer(i)); + field.set(obj, result.wasNull() ? null : Integer.valueOf(i)); break; case tLong: long l = result.getLong(column); - field.set(obj, result.wasNull() ? null : new Long(l)); + field.set(obj, result.wasNull() ? null : Long.valueOf(l)); break; case tFloat: float f = result.getFloat(column); - field.set(obj, result.wasNull() ? null : new Float(f)); + field.set(obj, result.wasNull() ? null : Float.valueOf(f)); field.setFloat(obj, result.getFloat(column)); break; case tDouble: double d = result.getDouble(column); - field.set(obj, result.wasNull() ? null : new Double(d)); + field.set(obj, result.wasNull() ? null : Double.valueOf(d)); break; case tBoolean: boolean bl = result.getBoolean(column); - field.set(obj, result.wasNull() ? null : new Boolean(bl)); + field.set(obj, result.wasNull() ? null : Boolean.valueOf(bl)); break; case tDecimal: diff --git a/src/java/com/samskivert/jdbc/jora/FieldMask.java b/src/java/com/samskivert/jdbc/jora/FieldMask.java index 23bc9d2e..84b7cd7e 100644 --- a/src/java/com/samskivert/jdbc/jora/FieldMask.java +++ b/src/java/com/samskivert/jdbc/jora/FieldMask.java @@ -56,7 +56,7 @@ public class FieldMask _descripMap = new HashMap(); int dcount = descrips.length; for (int i = 0; i < dcount; i++) { - _descripMap.put(descrips[i].field.getName(), new Integer(i)); + _descripMap.put(descrips[i].field.getName(), Integer.valueOf(i)); } // create our modified flags _modified = new boolean[dcount]; diff --git a/src/java/com/samskivert/jdbc/jora/Table.java b/src/java/com/samskivert/jdbc/jora/Table.java index 59dce85e..6b4ef430 100644 --- a/src/java/com/samskivert/jdbc/jora/Table.java +++ b/src/java/com/samskivert/jdbc/jora/Table.java @@ -893,7 +893,7 @@ public class Table protected static Method setBypass; protected static Class serializableClass; - protected static final Object[] bypassFlag = { new Boolean(true) }; + protected static final Object[] bypassFlag = { Boolean.TRUE }; protected static final Object[] constructorArgs = {}; // used to identify byte[] fields diff --git a/src/java/com/samskivert/swing/util/MenuUtil.java b/src/java/com/samskivert/swing/util/MenuUtil.java index 6b93520a..6c0a79ea 100644 --- a/src/java/com/samskivert/swing/util/MenuUtil.java +++ b/src/java/com/samskivert/swing/util/MenuUtil.java @@ -82,7 +82,7 @@ public class MenuUtil public static JMenuItem addMenuItem ( ActionListener l, JMenu menu, String name, int mnem, KeyStroke accel) { - return addMenuItem(l, menu, name, new Integer(mnem), accel); + return addMenuItem(l, menu, name, Integer.valueOf(mnem), accel); } /** @@ -99,7 +99,7 @@ public class MenuUtil public static JMenuItem addMenuItem ( ActionListener l, JMenu menu, String name, int mnem) { - return addMenuItem(l, menu, name, new Integer(mnem), null); + return addMenuItem(l, menu, name, Integer.valueOf(mnem), null); } /** @@ -138,7 +138,7 @@ public class MenuUtil JMenu menu, String name, int mnem, KeyStroke accel, Object target, String callbackName) { - JMenuItem item = createItem(name, new Integer(mnem), accel); + JMenuItem item = createItem(name, Integer.valueOf(mnem), accel); item.addActionListener(new ReflectedAction(target, callbackName)); menu.add(item); return item; diff --git a/src/java/com/samskivert/util/ArrayIntSet.java b/src/java/com/samskivert/util/ArrayIntSet.java index 565a4b9d..8be97091 100644 --- a/src/java/com/samskivert/util/ArrayIntSet.java +++ b/src/java/com/samskivert/util/ArrayIntSet.java @@ -113,7 +113,7 @@ public class ArrayIntSet extends AbstractSet } public Integer next () { - return new Integer(nextInt()); + return Integer.valueOf(nextInt()); } public void remove () { @@ -148,7 +148,7 @@ public class ArrayIntSet extends AbstractSet public Integer[] toArray (Integer[] a) { for (int i = 0; i < _size; i++) { - a[i] = new Integer(_values[i]); + a[i] = Integer.valueOf(_values[i]); } return a; } diff --git a/src/java/com/samskivert/util/Config.java b/src/java/com/samskivert/util/Config.java index 6e9cf02b..b97d1ad1 100644 --- a/src/java/com/samskivert/util/Config.java +++ b/src/java/com/samskivert/util/Config.java @@ -203,11 +203,12 @@ public class Config Integer oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { - oldValue = new Integer(_prefs.getInt(name, getDefValue(name, 0))); + oldValue = Integer.valueOf( + _prefs.getInt(name, getDefValue(name, 0))); } _prefs.putInt(name, value); - _propsup.firePropertyChange(name, oldValue, new Integer(value)); + _propsup.firePropertyChange(name, oldValue, Integer.valueOf(value)); } /** @@ -255,11 +256,12 @@ public class Config Long oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { - oldValue = new Long(_prefs.getLong(name, getDefValue(name, 0L))); + oldValue = Long.valueOf( + _prefs.getLong(name, getDefValue(name, 0L))); } _prefs.putLong(name, value); - _propsup.firePropertyChange(name, oldValue, new Long(value)); + _propsup.firePropertyChange(name, oldValue, Long.valueOf(value)); } /** @@ -307,11 +309,12 @@ public class Config Float oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { - oldValue = new Float(_prefs.getFloat(name, getDefValue(name, 0f))); + oldValue = Float.valueOf( + _prefs.getFloat(name, getDefValue(name, 0f))); } _prefs.putFloat(name, value); - _propsup.firePropertyChange(name, oldValue, new Float(value)); + _propsup.firePropertyChange(name, oldValue, Float.valueOf(value)); } /** @@ -388,12 +391,12 @@ public class Config Boolean oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { - oldValue = new Boolean( + oldValue = Boolean.valueOf( _prefs.getBoolean(name, getDefValue(name, false))); } _prefs.putBoolean(name, value); - _propsup.firePropertyChange(name, oldValue, new Boolean(value)); + _propsup.firePropertyChange(name, oldValue, Boolean.valueOf(value)); } /** diff --git a/src/java/com/samskivert/util/ExpiringReference.java b/src/java/com/samskivert/util/ExpiringReference.java index 22ba0017..6ffd7b3f 100644 --- a/src/java/com/samskivert/util/ExpiringReference.java +++ b/src/java/com/samskivert/util/ExpiringReference.java @@ -46,14 +46,12 @@ public class ExpiringReference */ public T getValue () { - if (_value == null) { - return null; - } else if (System.currentTimeMillis() >= _expires) { + // if the value is still around and it's expired, clear it + if (_value != null && System.currentTimeMillis() >= _expires) { _value = null; - return null; - } else { - return _value; } + // then return the value (which may be cleared to null by now) + return _value; } protected T _value; diff --git a/src/java/com/samskivert/util/HashIntMap.java b/src/java/com/samskivert/util/HashIntMap.java index 751d7ac7..6f78e919 100644 --- a/src/java/com/samskivert/util/HashIntMap.java +++ b/src/java/com/samskivert/util/HashIntMap.java @@ -559,7 +559,7 @@ public class HashIntMap extends AbstractMap public Integer getKey () { - return new Integer(key); + return Integer.valueOf(key); } public int getIntKey () diff --git a/src/java/com/samskivert/util/IntIntMap.java b/src/java/com/samskivert/util/IntIntMap.java index ba18c4fc..87896a0c 100644 --- a/src/java/com/samskivert/util/IntIntMap.java +++ b/src/java/com/samskivert/util/IntIntMap.java @@ -330,7 +330,7 @@ public class IntIntMap } public Integer getKey () { - return new Integer(key); + return Integer.valueOf(key); } public int getIntKey () { @@ -338,7 +338,7 @@ public class IntIntMap } public Integer getValue () { - return new Integer(value); + return Integer.valueOf(value); } public int getIntValue () { @@ -346,7 +346,7 @@ public class IntIntMap } public Integer setValue (Integer v) { - return new Integer(setIntValue(v.intValue())); + return Integer.valueOf(setIntValue(v.intValue())); } public int setIntValue (int v) { @@ -462,7 +462,7 @@ public class IntIntMap public Integer next () { - return new Integer(nextInt()); + return Integer.valueOf(nextInt()); } public void remove () diff --git a/src/java/com/samskivert/util/StringUtil.java b/src/java/com/samskivert/util/StringUtil.java index e33a0394..9f066386 100644 --- a/src/java/com/samskivert/util/StringUtil.java +++ b/src/java/com/samskivert/util/StringUtil.java @@ -1424,22 +1424,22 @@ public class StringUtil protected static final HashIntMap _letterToBits = new HashIntMap(); static { - _letterToBits.put('e', new Integer(0)); - _letterToBits.put('t', new Integer(1)); - _letterToBits.put('a', new Integer(2)); - _letterToBits.put('o', new Integer(3)); - _letterToBits.put('i', new Integer(4)); - _letterToBits.put('n', new Integer(5)); - _letterToBits.put('s', new Integer(6)); - _letterToBits.put('r', new Integer(7)); - _letterToBits.put('h', new Integer(8)); - _letterToBits.put('l', new Integer(9)); - _letterToBits.put('d', new Integer(10)); - _letterToBits.put('c', new Integer(11)); - _letterToBits.put('u', new Integer(12)); - _letterToBits.put('m', new Integer(13)); - _letterToBits.put('f', new Integer(14)); - _letterToBits.put('p', new Integer(15)); + _letterToBits.put('e', Integer.valueOf(0)); + _letterToBits.put('t', Integer.valueOf(1)); + _letterToBits.put('a', Integer.valueOf(2)); + _letterToBits.put('o', Integer.valueOf(3)); + _letterToBits.put('i', Integer.valueOf(4)); + _letterToBits.put('n', Integer.valueOf(5)); + _letterToBits.put('s', Integer.valueOf(6)); + _letterToBits.put('r', Integer.valueOf(7)); + _letterToBits.put('h', Integer.valueOf(8)); + _letterToBits.put('l', Integer.valueOf(9)); + _letterToBits.put('d', Integer.valueOf(10)); + _letterToBits.put('c', Integer.valueOf(11)); + _letterToBits.put('u', Integer.valueOf(12)); + _letterToBits.put('m', Integer.valueOf(13)); + _letterToBits.put('f', Integer.valueOf(14)); + _letterToBits.put('p', Integer.valueOf(15)); // sorry g, w, y, b, v, k, x, j, q, z } } diff --git a/src/java/com/samskivert/velocity/DispatcherServlet.java b/src/java/com/samskivert/velocity/DispatcherServlet.java index 371721e6..98e6f58d 100644 --- a/src/java/com/samskivert/velocity/DispatcherServlet.java +++ b/src/java/com/samskivert/velocity/DispatcherServlet.java @@ -288,7 +288,7 @@ public class DispatcherServlet extends VelocityServlet siteId = ident.identifySite(req); } if (_usingSiteLoading) { - ctx.put("__siteid__", new Integer(siteId)); + ctx.put("__siteid__", Integer.valueOf(siteId)); } // put the context path in the context as well to make it easier to diff --git a/src/java/com/samskivert/velocity/InvocationContext.java b/src/java/com/samskivert/velocity/InvocationContext.java index 1d685351..ea5dcc27 100644 --- a/src/java/com/samskivert/velocity/InvocationContext.java +++ b/src/java/com/samskivert/velocity/InvocationContext.java @@ -85,7 +85,7 @@ public class InvocationContext extends VelocityContext */ public void put (String key, int value) { - put(key, new Integer(value)); + put(key, Integer.valueOf(value)); } /** @@ -93,7 +93,7 @@ public class InvocationContext extends VelocityContext */ public void put (String key, boolean value) { - put(key, new Boolean(value)); + put(key, Boolean.valueOf(value)); } /**