Index: activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java =================================================================== --- activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java (revision 550057) +++ activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java (working copy) @@ -109,7 +109,7 @@ GlobalWriter.print("Stopping broker: " + brokerName); try { - server.invoke(brokerObjName, "terminateJVM", new Object[] {new Integer(0)}, new String[] {"int"}); + server.invoke(brokerObjName, "terminateJVM", new Object[] {Integer.valueOf(0)}, new String[] {"int"}); GlobalWriter.print("Succesfully stopped broker: " + brokerName); } catch (Exception e) { // TODO: Check exceptions throwned Index: activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java =================================================================== --- activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java (revision 550057) +++ activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToMsgSelectorTransformFilter.java (working copy) @@ -39,7 +39,6 @@ int pos = key.indexOf("="); if (pos >= 0) { val = key.substring(pos + 1); - key = key.substring(0, pos); } // If the value contains wildcards and is enclose by ' Index: activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java =================================================================== --- activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java (revision 550057) +++ activemq-console/src/main/java/org/apache/activemq/console/filter/WildcardToRegExTransformFilter.java (working copy) @@ -39,7 +39,6 @@ int pos = key.indexOf("="); if (pos >= 0) { val = key.substring(pos + 1); - key = key.substring(0, pos); } // If the value contains wildcards Index: activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java =================================================================== --- activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java (revision 550057) +++ activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java (working copy) @@ -81,16 +81,16 @@ return query.replaceAll("%1", param); } - public static String createQueryString(String query, List params) { + public static String createQueryString(String query, List params) { + String output = query; + int count = 1; + for (Iterator i = params.iterator(); i.hasNext();) { + output = output.replaceAll("%" + count++, i.next().toString()); + } - int count = 1; - for (Iterator i=params.iterator();i.hasNext();) { - query.replaceAll("%" + count++, i.next().toString()); - } + return output; + } - return query; - } - public static QueryFilter createMBeansObjectNameQuery(JMXServiceURL jmxUrl) { return new WildcardToRegExTransformFilter( // Let us be able to accept wildcard queries new MBeansRegExQueryFilter( // Use regular expressions to filter the query results Index: activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java (working copy) @@ -387,7 +387,7 @@ mbeanServer.registerMBean(cl.newInstance(),namingServiceObjectName); // mbeanServer.createMBean("mx4j.tools.naming.NamingService", namingServiceObjectName, null); // set the naming port - Attribute attr=new Attribute("Port",new Integer(connectorPort)); + Attribute attr=new Attribute("Port",Integer.valueOf(connectorPort)); mbeanServer.setAttribute(namingServiceObjectName,attr); }catch(Throwable e){ log.debug("Failed to create local registry",e); Index: activemq-core/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java (working copy) @@ -124,9 +124,9 @@ rc.put("JMSReplyTo", ""+m.getJMSReplyTo()); rc.put("JMSType", m.getJMSType()); rc.put("JMSDeliveryMode", m.getJMSDeliveryMode()==DeliveryMode.PERSISTENT ? "PERSISTENT" : "NON-PERSISTENT"); - rc.put("JMSExpiration", new Long(m.getJMSExpiration())); - rc.put("JMSPriority", new Integer(m.getJMSPriority())); - rc.put("JMSRedelivered", new Boolean(m.getJMSRedelivered())); + rc.put("JMSExpiration", Long.valueOf(m.getJMSExpiration())); + rc.put("JMSPriority", Integer.valueOf(m.getJMSPriority())); + rc.put("JMSRedelivered", Boolean.valueOf(m.getJMSRedelivered())); rc.put("JMSTimestamp", new Date(m.getJMSTimestamp())); try { rc.put("Properties", ""+m.getProperties()); @@ -155,9 +155,9 @@ long length=0; try { length = m.getBodyLength(); - rc.put("BodyLength", new Long(length)); + rc.put("BodyLength", Long.valueOf(length)); } catch (JMSException e) { - rc.put("BodyLength", new Long(0)); + rc.put("BodyLength", Long.valueOf(0)); } try { byte preview[] = new byte[ (int)Math.min(length, 255) ]; Index: activemq-core/src/main/java/org/apache/activemq/broker/PropertiesBrokerFactory.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/broker/PropertiesBrokerFactory.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/broker/PropertiesBrokerFactory.java (working copy) @@ -76,6 +76,7 @@ } } properties.load(inputStream); + inputStream.close(); // should we append any system properties? try { Index: activemq-core/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java (working copy) @@ -119,9 +119,9 @@ MessageReference node=(MessageReference)iter.next(); Integer count=(Integer)redeliveredMessages.get(node.getMessageId()); if(count!=null){ - redeliveredMessages.put(node.getMessageId(),new Integer(count.intValue()+1)); + redeliveredMessages.put(node.getMessageId(),Integer.valueOf(count.intValue()+1)); }else{ - redeliveredMessages.put(node.getMessageId(),new Integer(1)); + redeliveredMessages.put(node.getMessageId(),Integer.valueOf(1)); } if(keepDurableSubsActive){ synchronized(pending){ Index: activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java (working copy) @@ -477,7 +477,7 @@ */ public void setByte(String name, byte value) throws JMSException { initializeWriting(); - put(name, new Byte(value)); + put(name, Byte.valueOf(value)); } /** @@ -491,7 +491,7 @@ */ public void setShort(String name, short value) throws JMSException { initializeWriting(); - put(name, new Short(value)); + put(name, Short.valueOf(value)); } /** @@ -505,7 +505,7 @@ */ public void setChar(String name, char value) throws JMSException { initializeWriting(); - put(name, new Character(value)); + put(name, Character.valueOf(value)); } /** @@ -519,7 +519,7 @@ */ public void setInt(String name, int value) throws JMSException { initializeWriting(); - put(name, new Integer(value)); + put(name, Integer.valueOf(value)); } /** @@ -533,7 +533,7 @@ */ public void setLong(String name, long value) throws JMSException { initializeWriting(); - put(name, new Long(value)); + put(name, Long.valueOf(value)); } /** Index: activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java (working copy) @@ -53,7 +53,6 @@ } transient protected Callback acknowledgeCallback; - transient int hashCode; public Message copy() { ActiveMQMessage copy = new ActiveMQMessage(); @@ -545,23 +544,23 @@ setBooleanProperty(name,value,true); } public void setBooleanProperty(String name, boolean value,boolean checkReadOnly) throws JMSException { - setObjectProperty(name, value ? Boolean.TRUE : Boolean.FALSE,checkReadOnly); + setObjectProperty(name, Boolean.valueOf(value), checkReadOnly); } public void setByteProperty(String name, byte value) throws JMSException { - setObjectProperty(name, new Byte(value)); + setObjectProperty(name, Byte.valueOf(value)); } public void setShortProperty(String name, short value) throws JMSException { - setObjectProperty(name, new Short(value)); + setObjectProperty(name, Short.valueOf(value)); } public void setIntProperty(String name, int value) throws JMSException { - setObjectProperty(name, new Integer(value)); + setObjectProperty(name, Integer.valueOf(value)); } public void setLongProperty(String name, long value) throws JMSException { - setObjectProperty(name, new Long(value)); + setObjectProperty(name, Long.valueOf(value)); } public void setFloatProperty(String name, float value) throws JMSException { Index: activemq-core/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java (working copy) @@ -819,16 +819,16 @@ return this.dataIn.readUTF(); } if (type == MarshallingSupport.LONG_TYPE) { - return new Long(this.dataIn.readLong()); + return Long.valueOf(this.dataIn.readLong()); } if (type == MarshallingSupport.INTEGER_TYPE) { - return new Integer(this.dataIn.readInt()); + return Integer.valueOf(this.dataIn.readInt()); } if (type == MarshallingSupport.SHORT_TYPE) { - return new Short(this.dataIn.readShort()); + return Short.valueOf(this.dataIn.readShort()); } if (type == MarshallingSupport.BYTE_TYPE) { - return new Byte(this.dataIn.readByte()); + return Byte.valueOf(this.dataIn.readByte()); } if (type == MarshallingSupport.FLOAT_TYPE) { return new Float(this.dataIn.readFloat()); @@ -840,7 +840,7 @@ return this.dataIn.readBoolean() ? Boolean.TRUE : Boolean.FALSE; } if (type == MarshallingSupport.CHAR_TYPE) { - return new Character(this.dataIn.readChar()); + return Character.valueOf(this.dataIn.readChar()); } if (type == MarshallingSupport.BYTE_ARRAY_TYPE) { int len = this.dataIn.readInt(); Index: activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/filter/ComparisonExpression.java (working copy) @@ -41,26 +41,26 @@ static final private HashSet REGEXP_CONTROL_CHARS = new HashSet(); static { - REGEXP_CONTROL_CHARS.add(new Character('.')); - REGEXP_CONTROL_CHARS.add(new Character('\\')); - REGEXP_CONTROL_CHARS.add(new Character('[')); - REGEXP_CONTROL_CHARS.add(new Character(']')); - REGEXP_CONTROL_CHARS.add(new Character('^')); - REGEXP_CONTROL_CHARS.add(new Character('$')); - REGEXP_CONTROL_CHARS.add(new Character('?')); - REGEXP_CONTROL_CHARS.add(new Character('*')); - REGEXP_CONTROL_CHARS.add(new Character('+')); - REGEXP_CONTROL_CHARS.add(new Character('{')); - REGEXP_CONTROL_CHARS.add(new Character('}')); - REGEXP_CONTROL_CHARS.add(new Character('|')); - REGEXP_CONTROL_CHARS.add(new Character('(')); - REGEXP_CONTROL_CHARS.add(new Character(')')); - REGEXP_CONTROL_CHARS.add(new Character(':')); - REGEXP_CONTROL_CHARS.add(new Character('&')); - REGEXP_CONTROL_CHARS.add(new Character('<')); - REGEXP_CONTROL_CHARS.add(new Character('>')); - REGEXP_CONTROL_CHARS.add(new Character('=')); - REGEXP_CONTROL_CHARS.add(new Character('!')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('.')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('\\')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('[')); + REGEXP_CONTROL_CHARS.add(Character.valueOf(']')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('^')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('$')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('?')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('*')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('+')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('{')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('}')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('|')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('(')); + REGEXP_CONTROL_CHARS.add(Character.valueOf(')')); + REGEXP_CONTROL_CHARS.add(Character.valueOf(':')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('&')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('<')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('>')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('=')); + REGEXP_CONTROL_CHARS.add(Character.valueOf('!')); } static class LikeExpression extends UnaryExpression implements BooleanExpression { @@ -354,13 +354,13 @@ if (lc != rc) { if (lc == Byte.class) { if (rc == Short.class) { - lv = new Short(((Number) lv).shortValue()); + lv = Short.valueOf(((Number) lv).shortValue()); } else if (rc == Integer.class) { - lv = new Integer(((Number) lv).intValue()); + lv = Integer.valueOf(((Number) lv).intValue()); } else if (rc == Long.class) { - lv = new Long(((Number) lv).longValue()); + lv = Long.valueOf(((Number) lv).longValue()); } else if (rc == Float.class) { lv = new Float(((Number) lv).floatValue()); @@ -373,10 +373,10 @@ } } else if (lc == Short.class) { if (rc == Integer.class) { - lv = new Integer(((Number) lv).intValue()); + lv = Integer.valueOf(((Number) lv).intValue()); } else if (rc == Long.class) { - lv = new Long(((Number) lv).longValue()); + lv = Long.valueOf(((Number) lv).longValue()); } else if (rc == Float.class) { lv = new Float(((Number) lv).floatValue()); @@ -389,7 +389,7 @@ } } else if (lc == Integer.class) { if (rc == Long.class) { - lv = new Long(((Number) lv).longValue()); + lv = Long.valueOf(((Number) lv).longValue()); } else if (rc == Float.class) { lv = new Float(((Number) lv).floatValue()); @@ -403,7 +403,7 @@ } else if (lc == Long.class) { if (rc == Integer.class) { - rv = new Long(((Number) rv).longValue()); + rv = Long.valueOf(((Number) rv).longValue()); } else if (rc == Float.class) { lv = new Float(((Number) lv).floatValue()); Index: activemq-core/src/main/java/org/apache/activemq/filter/ConstantExpression.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/filter/ConstantExpression.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/filter/ConstantExpression.java (working copy) @@ -60,25 +60,25 @@ long l = value.longValue(); if (Integer.MIN_VALUE <= l && l <= Integer.MAX_VALUE) { - value = new Integer(value.intValue()); + value = Integer.valueOf(value.intValue()); } return new ConstantExpression(value); } public static ConstantExpression createFromHex(String text) { - Number value = new Long(Long.parseLong(text.substring(2), 16)); + Number value = Long.valueOf(Long.parseLong(text.substring(2), 16)); long l = value.longValue(); if (Integer.MIN_VALUE <= l && l <= Integer.MAX_VALUE) { - value = new Integer(value.intValue()); + value = Integer.valueOf(value.intValue()); } return new ConstantExpression(value); } public static ConstantExpression createFromOctal(String text) { - Number value = new Long(Long.parseLong(text, 8)); + Number value = Long.valueOf(Long.parseLong(text, 8)); long l = value.longValue(); if (Integer.MIN_VALUE <= l && l <= Integer.MAX_VALUE) { - value = new Integer(value.intValue()); + value = Integer.valueOf(value.intValue()); } return new ConstantExpression(value); } Index: activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/filter/PropertyExpression.java (working copy) @@ -66,12 +66,12 @@ }); JMS_PROPERTY_EXPRESSIONS.put("JMSDeliveryMode", new SubExpression() { public Object evaluate(Message message) { - return new Integer(message.isPersistent() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT ); + return Integer.valueOf(message.isPersistent() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT ); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSPriority", new SubExpression() { public Object evaluate(Message message) { - return new Integer(message.getPriority()); + return Integer.valueOf(message.getPriority()); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSMessageID", new SubExpression() { @@ -83,7 +83,7 @@ }); JMS_PROPERTY_EXPRESSIONS.put("JMSTimestamp", new SubExpression() { public Object evaluate(Message message) { - return new Long(message.getTimestamp()); + return Long.valueOf(message.getTimestamp()); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSCorrelationID", new SubExpression() { @@ -93,28 +93,28 @@ }); JMS_PROPERTY_EXPRESSIONS.put("JMSExpiration", new SubExpression() { public Object evaluate(Message message) { - return new Long(message.getExpiration()); + return Long.valueOf(message.getExpiration()); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSPriority", new SubExpression() { public Object evaluate(Message message) { - return new Integer(message.getPriority()); + return Integer.valueOf(message.getPriority()); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSTimestamp", new SubExpression() { public Object evaluate(Message message) { - return new Long(message.getTimestamp()); + return Long.valueOf(message.getTimestamp()); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSRedelivered", new SubExpression() { public Object evaluate(Message message) { - return new Boolean(message.isRedelivered()); + return Boolean.valueOf(message.isRedelivered()); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSXDeliveryCount", new SubExpression() { public Object evaluate(Message message) { - return new Integer(message.getRedeliveryCounter()+1); + return Integer.valueOf(message.getRedeliveryCounter()+1); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSXGroupID", new SubExpression() { Index: activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/filter/UnaryExpression.java (working copy) @@ -195,7 +195,7 @@ bd = bd.negate(); if( BD_LONG_MIN_VALUE.compareTo(bd)==0 ) { - return new Long(Long.MIN_VALUE); + return Long.valueOf(Long.MIN_VALUE); } return bd; } Index: activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/AsyncDataManager.java (working copy) @@ -51,7 +51,7 @@ private static final Log log=LogFactory.getLog(AsyncDataManager.class); - public static int CONTROL_RECORD_MAX_LENGTH=1024; + public static final int CONTROL_RECORD_MAX_LENGTH=1024; public static final int ITEM_HEAD_RESERVED_SPACE=21; // ITEM_HEAD_SPACE = length + type+ reserved space + SOR @@ -67,9 +67,9 @@ public static final byte DATA_ITEM_TYPE=1; public static final byte REDO_ITEM_TYPE=2; - public static String DEFAULT_DIRECTORY="data"; - public static String DEFAULT_FILE_PREFIX="data-"; - public static int DEFAULT_MAX_FILE_LENGTH=1024*1024*32; + public static final String DEFAULT_DIRECTORY="data"; + public static final String DEFAULT_FILE_PREFIX="data-"; + public static final int DEFAULT_MAX_FILE_LENGTH=1024*1024*32; private File directory = new File(DEFAULT_DIRECTORY); private String filePrefix=DEFAULT_FILE_PREFIX; @@ -314,7 +314,7 @@ public synchronized void addInterestInFile(int file) throws IOException{ if(file>=0){ - Integer key=new Integer(file); + Integer key=Integer.valueOf(file); DataFile dataFile=(DataFile) fileMap.get(key); if(dataFile==null){ throw new IOException("That data file does not exist"); @@ -331,7 +331,7 @@ public synchronized void removeInterestInFile(int file) throws IOException{ if(file>=0){ - Integer key=new Integer(file); + Integer key=Integer.valueOf(file); DataFile dataFile=(DataFile) fileMap.get(key); removeInterestInFile(dataFile); } Index: activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java (working copy) @@ -352,7 +352,7 @@ write = (WriteCommand) write.getNext(); } } - + buff.close(); } catch (IOException e) { synchronized( enqueueMutex ) { firstAsyncException = e; Index: activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/kaha/impl/data/DataManagerImpl.java (working copy) @@ -41,7 +41,7 @@ public final class DataManagerImpl implements DataManager { private static final Log log=LogFactory.getLog(DataManagerImpl.class); - public static long MAX_FILE_LENGTH=1024*1024*32; + public static final long MAX_FILE_LENGTH=1024*1024*32; private static final String NAME_PREFIX="data-"; private final File dir; private final String name; @@ -239,7 +239,7 @@ */ public synchronized void addInterestInFile(int file) throws IOException{ if(file>=0){ - Integer key=new Integer(file); + Integer key=Integer.valueOf(file); DataFile dataFile=(DataFile) fileMap.get(key); if(dataFile==null){ dataFile=createAndAddDataFile(file); @@ -259,7 +259,7 @@ */ public synchronized void removeInterestInFile(int file) throws IOException{ if(file>=0){ - Integer key=new Integer(file); + Integer key=Integer.valueOf(file); DataFile dataFile=(DataFile) fileMap.get(key); removeInterestInFile(dataFile); } Index: activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/IndexManager.java (working copy) @@ -151,7 +151,7 @@ return result; } - long getLength(){ + synchronized long getLength(){ return length; } Index: activemq-core/src/main/java/org/apache/activemq/network/ForwardingBridge.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/network/ForwardingBridge.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/network/ForwardingBridge.java (working copy) @@ -72,9 +72,6 @@ private boolean dispatchAsync; private String destinationFilter = ">"; - private int queueDispatched; - private int topicDispatched; - BrokerId localBrokerId; BrokerId remoteBrokerId; private NetworkBridgeFailedListener bridgeFailedListener; Index: activemq-core/src/main/java/org/apache/activemq/openwire/CommandIdComparator.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/openwire/CommandIdComparator.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/openwire/CommandIdComparator.java (working copy) @@ -17,16 +17,17 @@ */ package org.apache.activemq.openwire; +import java.io.Serializable; +import java.util.Comparator; + import org.apache.activemq.command.Command; -import java.util.Comparator; - /** * A @{link Comparator} of commands using their {@link Command#getCommandId()} * * @version $Revision$ */ -public class CommandIdComparator implements Comparator { +public class CommandIdComparator implements Comparator, Serializable { public int compare(Object o1, Object o2) { assert o1 instanceof Command; Index: activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java (working copy) @@ -183,7 +183,7 @@ tightUnmarshalString(dataIn, bs), tightUnmarshalString(dataIn, bs), tightUnmarshalString(dataIn, bs), - new Integer(dataIn.readInt()) + Integer.valueOf(dataIn.readInt()) }); } catch (IOException e) { throw e; @@ -484,7 +484,7 @@ looseUnmarshalString(dataIn), looseUnmarshalString(dataIn), looseUnmarshalString(dataIn), - new Integer(dataIn.readInt()) + Integer.valueOf(dataIn.readInt()) }); } catch (IOException e) { throw e; Index: activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java (working copy) @@ -182,7 +182,7 @@ tightUnmarshalString(dataIn, bs), tightUnmarshalString(dataIn, bs), tightUnmarshalString(dataIn, bs), - new Integer(dataIn.readInt()) + Integer.valueOf(dataIn.readInt()) }); } catch (IOException e) { throw e; @@ -483,7 +483,7 @@ looseUnmarshalString(dataIn), looseUnmarshalString(dataIn), looseUnmarshalString(dataIn), - new Integer(dataIn.readInt()) + Integer.valueOf(dataIn.readInt()) }); } catch (IOException e) { throw e; Index: activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java (working copy) @@ -108,7 +108,7 @@ paramClass[0] = String.class; Object[] param = new Object[1]; - param[0] = new String(name); + param[0] = name; try { Class cls = Class.forName(groupClass); Index: activemq-core/src/main/java/org/apache/activemq/security/LDAPAuthorizationMap.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/security/LDAPAuthorizationMap.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/security/LDAPAuthorizationMap.java (working copy) @@ -133,8 +133,8 @@ String queueSearchSubtree = (String) options.get(QUEUE_SEARCH_SUBTREE); topicSearchMatchingFormat = new MessageFormat(topicSearchMatching); queueSearchMatchingFormat = new MessageFormat(queueSearchMatching); - topicSearchSubtreeBool = new Boolean(topicSearchSubtree).booleanValue(); - queueSearchSubtreeBool = new Boolean(queueSearchSubtree).booleanValue(); + topicSearchSubtreeBool = Boolean.valueOf(topicSearchSubtree).booleanValue(); + queueSearchSubtreeBool = Boolean.valueOf(queueSearchSubtree).booleanValue(); } public Set getTempDestinationAdminACLs() { Index: activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java (working copy) @@ -162,7 +162,7 @@ } synchronized void addInterestInRecordFile(int recordNumber) { - Integer key = new Integer(recordNumber); + Integer key = Integer.valueOf(recordNumber); AtomicInteger rr = recordReferences.get(key); if (rr == null) { rr = new AtomicInteger(); @@ -172,7 +172,7 @@ } synchronized void removeInterestInRecordFile(int recordNumber) { - Integer key = new Integer(recordNumber); + Integer key = Integer.valueOf(recordNumber); AtomicInteger rr = recordReferences.get(key); if (rr != null && rr.decrementAndGet() <= 0) { recordReferences.remove(key); Index: activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java (working copy) @@ -217,7 +217,7 @@ if(msg!=null){ recoverReference(listener,msg); count++; - container.setBatchEntry(msg.getMessageId().toString(),entry); + container.setBatchEntry(msg.getMessageId(),entry); }else { container.reset(); } Index: activemq-core/src/main/java/org/apache/activemq/thread/Scheduler.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/thread/Scheduler.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/thread/Scheduler.java (working copy) @@ -30,7 +30,7 @@ public class Scheduler { - static public ScheduledThreadPoolExecutor clockDaemon = new ScheduledThreadPoolExecutor(5, new ThreadFactory(){ + public static final ScheduledThreadPoolExecutor clockDaemon = new ScheduledThreadPoolExecutor(5, new ThreadFactory(){ public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable,"ActiveMQ Scheduler"); thread.setDaemon(true); Index: activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java (working copy) @@ -51,10 +51,10 @@ int max = size - 1; while (map.size() >= max) { // lets find things to evict - Object evictedBuffer = map.remove(new Integer(++lowestCommandId)); + Object evictedBuffer = map.remove(Integer.valueOf(++lowestCommandId)); onEvictedBuffer(lowestCommandId, evictedBuffer); } - map.put(new Integer(commandId), buffer); + map.put(Integer.valueOf(commandId), buffer); } } @@ -72,7 +72,7 @@ for (int i = fromCommandId; i <= toCommandId; i++) { Object buffer = null; synchronized (lock) { - buffer = map.get(new Integer(i)); + buffer = map.get(Integer.valueOf(i)); } replayer.sendBuffer(i, buffer); } Index: activemq-core/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java (working copy) @@ -84,7 +84,7 @@ Response response=(Response)command; FutureResponse future=null; synchronized(requestMap){ - future=(FutureResponse)requestMap.remove(new Integer(response.getCorrelationId())); + future=(FutureResponse)requestMap.remove(Integer.valueOf(response.getCorrelationId())); } if(future!=null){ future.set(response); Index: activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java (working copy) @@ -114,7 +114,7 @@ command.setCommandId(generateCommandId()); if(handler!=null) { command.setResponseRequired(true); - resposeHandlers.put(new Integer(command.getCommandId()), handler); + resposeHandlers.put(Integer.valueOf(command.getCommandId()), handler); } transportFilter.sendToActiveMQ(command); } @@ -472,7 +472,7 @@ if ( command.isResponse() ) { Response response = (Response) command; - ResponseHandler rh = (ResponseHandler) resposeHandlers.remove(new Integer(response.getCorrelationId())); + ResponseHandler rh = (ResponseHandler) resposeHandlers.remove(Integer.valueOf(response.getCorrelationId())); if( rh !=null ) { rh.onResponse(this, response); } Index: activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java (working copy) @@ -189,6 +189,7 @@ throw new ProtocolException(errorMessage, true); baos.write(b); } + baos.close(); ByteSequence sequence = baos.toByteSequence(); return new String(sequence.getData(),sequence.getOffset(),sequence.getLength(),"UTF-8"); } Index: activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java (working copy) @@ -165,9 +165,9 @@ } else { HashMap options = new HashMap(); - options.put("maxInactivityDuration", new Long(maxInactivityDuration)); - options.put("minmumWireFormatVersion", new Integer(minmumWireFormatVersion)); - options.put("trace", new Boolean(trace)); + options.put("maxInactivityDuration", Long.valueOf(maxInactivityDuration)); + options.put("minmumWireFormatVersion", Integer.valueOf(minmumWireFormatVersion)); + options.put("trace", Boolean.valueOf(trace)); options.putAll(transportOptions); WireFormat format = wireFormatFactory.createWireFormat(); Transport transport = createTransport(socket, format); Index: activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java (working copy) @@ -155,22 +155,22 @@ Object value=null; switch( in.readByte() ) { case BYTE_TYPE: - value = new Byte(in.readByte()); + value = Byte.valueOf(in.readByte()); break; case BOOLEAN_TYPE: value = in.readBoolean() ? Boolean.TRUE : Boolean.FALSE; break; case CHAR_TYPE: - value = new Character(in.readChar()); + value = Character.valueOf(in.readChar()); break; case SHORT_TYPE: - value = new Short(in.readShort()); + value = Short.valueOf(in.readShort()); break; case INTEGER_TYPE: - value = new Integer(in.readInt()); + value = Integer.valueOf(in.readInt()); break; case LONG_TYPE: - value = new Long(in.readLong()); + value = Long.valueOf(in.readLong()); break; case FLOAT_TYPE: value = new Float(in.readFloat()); @@ -378,6 +378,7 @@ DataByteArrayOutputStream dataOut=new DataByteArrayOutputStream(); props.store(dataOut,""); result=new String(dataOut.getData(),0,dataOut.size()); + dataOut.close(); } return result; } @@ -387,6 +388,7 @@ if (str != null && str.length() > 0 ) { DataByteArrayInputStream dataIn = new DataByteArrayInputStream(str.getBytes()); result.load(dataIn); + dataIn.close(); } return result; } Index: activemq-core/src/main/java/org/apache/activemq/util/MemoryIntPropertyEditor.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/util/MemoryIntPropertyEditor.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/util/MemoryIntPropertyEditor.java (working copy) @@ -32,28 +32,28 @@ Pattern p = Pattern.compile("^\\s*(\\d+)\\s*(b)?\\s*$",Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(text); if (m.matches()) { - setValue(new Integer(Integer.parseInt(m.group(1)))); + setValue(Integer.valueOf(Integer.parseInt(m.group(1)))); return; } p = Pattern.compile("^\\s*(\\d+)\\s*k(b)?\\s*$",Pattern.CASE_INSENSITIVE); m = p.matcher(text); if (m.matches()) { - setValue(new Integer(Integer.parseInt(m.group(1)) * 1024)); + setValue(Integer.valueOf(Integer.parseInt(m.group(1)) * 1024)); return; } p = Pattern.compile("^\\s*(\\d+)\\s*m(b)?\\s*$", Pattern.CASE_INSENSITIVE); m = p.matcher(text); if (m.matches()) { - setValue(new Integer(Integer.parseInt(m.group(1)) * 1024 * 1024 )); + setValue(Integer.valueOf(Integer.parseInt(m.group(1)) * 1024 * 1024 )); return; } p = Pattern.compile("^\\s*(\\d+)\\s*g(b)?\\s*$", Pattern.CASE_INSENSITIVE); m = p.matcher(text); if (m.matches()) { - setValue(new Integer(Integer.parseInt(m.group(1)) * 1024 * 1024 * 1024 )); + setValue(Integer.valueOf(Integer.parseInt(m.group(1)) * 1024 * 1024 * 1024 )); return; } Index: activemq-core/src/main/java/org/apache/activemq/util/MemoryPropertyEditor.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/util/MemoryPropertyEditor.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/util/MemoryPropertyEditor.java (working copy) @@ -32,28 +32,28 @@ Pattern p = Pattern.compile("^\\s*(\\d+)\\s*(b)?\\s*$",Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(text); if (m.matches()) { - setValue(new Long(Long.parseLong(m.group(1)))); + setValue(Long.valueOf(Long.parseLong(m.group(1)))); return; } p = Pattern.compile("^\\s*(\\d+)\\s*k(b)?\\s*$",Pattern.CASE_INSENSITIVE); m = p.matcher(text); if (m.matches()) { - setValue(new Long(Long.parseLong(m.group(1)) * 1024)); + setValue(Long.valueOf(Long.parseLong(m.group(1)) * 1024)); return; } p = Pattern.compile("^\\s*(\\d+)\\s*m(b)?\\s*$", Pattern.CASE_INSENSITIVE); m = p.matcher(text); if (m.matches()) { - setValue(new Long(Long.parseLong(m.group(1)) * 1024 * 1024 )); + setValue(Long.valueOf(Long.parseLong(m.group(1)) * 1024 * 1024 )); return; } p = Pattern.compile("^\\s*(\\d+)\\s*g(b)?\\s*$", Pattern.CASE_INSENSITIVE); m = p.matcher(text); if (m.matches()) { - setValue(new Long(Long.parseLong(m.group(1)) * 1024 * 1024 * 1024 )); + setValue(Long.valueOf(Long.parseLong(m.group(1)) * 1024 * 1024 * 1024 )); return; } Index: activemq-core/src/main/java/org/apache/activemq/util/MessageComparatorSupport.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/util/MessageComparatorSupport.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/util/MessageComparatorSupport.java (working copy) @@ -17,16 +17,17 @@ */ package org.apache.activemq.util; +import java.io.Serializable; +import java.util.Comparator; + import javax.jms.Message; -import java.util.Comparator; - /** * A base class for comparators which works on JMS {@link Message} objects * * @version $Revision$ */ -public abstract class MessageComparatorSupport implements Comparator { +public abstract class MessageComparatorSupport implements Comparator, Serializable { public int compare(Object object1, Object object2) { Message command1 = (Message) object1; Index: activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java =================================================================== --- activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java (revision 550057) +++ activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java (working copy) @@ -102,7 +102,7 @@ Converter longConverter = new Converter() { public Object convert(Object value) { - return new Long(((Number) value).longValue()); + return Long.valueOf(((Number) value).longValue()); } }; CONVERSION_MAP.put(new ConversionKey(Byte.class, Long.class), longConverter); @@ -110,13 +110,13 @@ CONVERSION_MAP.put(new ConversionKey(Integer.class, Long.class), longConverter); CONVERSION_MAP.put(new ConversionKey(Date.class, Long.class), new Converter() { public Object convert(Object value) { - return new Long(((Date) value).getTime()); + return Long.valueOf(((Date) value).getTime()); } }); Converter intConverter = new Converter() { public Object convert(Object value) { - return new Integer(((Number) value).intValue()); + return Integer.valueOf(((Number) value).intValue()); } }; CONVERSION_MAP.put(new ConversionKey(Byte.class, Integer.class), intConverter); @@ -124,7 +124,7 @@ CONVERSION_MAP.put(new ConversionKey(Byte.class, Short.class), new Converter() { public Object convert(Object value) { - return new Short(((Number) value).shortValue()); + return Short.valueOf(((Number) value).shortValue()); } }); Index: activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java (working copy) @@ -321,7 +321,7 @@ } - private class PooledProducerTask implements Runnable { + private static class PooledProducerTask implements Runnable { private final String queueName; @@ -377,7 +377,7 @@ } - private class NonPooledProducerTask implements Runnable { + private static class NonPooledProducerTask implements Runnable { private final String queueName; Index: activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/broker/BrokerTest.java (working copy) @@ -47,8 +47,8 @@ public void initCombosForTestQueuBrowserWith2Consumers() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); } /** @@ -114,13 +114,13 @@ public void initCombosForTestConsumerPrefetchAndStandardAck() { addCombinationValues( "deliveryMode", new Object[]{ -// new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); +// Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) } ); } @@ -168,13 +168,13 @@ public void initCombosForTestTransactedAckWithPrefetchOfOne() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) } ); } @@ -222,13 +222,13 @@ public void initCombosForTestTransactedSend() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testTransactedSend() throws Exception { @@ -276,11 +276,11 @@ public void initCombosForTestQueueTransactedAck() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), } ); } @@ -329,8 +329,8 @@ public void initCombosForTestConsumerCloseCausesRedelivery() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destination", new Object[]{ new ActiveMQQueue("TEST")} ); } @@ -442,8 +442,8 @@ public void initCombosForTestGroupedMessagesDeliveredToOnlyOneConsumer() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); } public void testGroupedMessagesDeliveredToOnlyOneConsumer() throws Exception { @@ -503,8 +503,8 @@ public void initCombosForTestTopicConsumerOnlySeeMessagesAfterCreation() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "durableConsumer", new Object[]{ Boolean.TRUE, Boolean.FALSE}); @@ -551,8 +551,8 @@ public void initCombosForTestTopicRetroactiveConsumerSeeMessagesBeforeCreation() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "durableConsumer", new Object[]{ Boolean.TRUE, Boolean.FALSE}); @@ -611,11 +611,11 @@ // // public void initCombosForTestTempDestinationsRemovedOnConnectionClose() { // addCombinationValues( "deliveryMode", new Object[]{ -// new Integer(DeliveryMode.NON_PERSISTENT), -// new Integer(DeliveryMode.PERSISTENT)} ); +// Integer.valueOf(DeliveryMode.NON_PERSISTENT), +// Integer.valueOf(DeliveryMode.PERSISTENT)} ); // addCombinationValues( "destinationType", new Object[]{ -// new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), -// new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); +// Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), +// Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); // } // // public void testTempDestinationsRemovedOnConnectionClose() throws Exception { @@ -657,11 +657,11 @@ // public void initCombosForTestTempDestinationsAreNotAutoCreated() { // addCombinationValues( "deliveryMode", new Object[]{ -// new Integer(DeliveryMode.NON_PERSISTENT), -// new Integer(DeliveryMode.PERSISTENT)} ); +// Integer.valueOf(DeliveryMode.NON_PERSISTENT), +// Integer.valueOf(DeliveryMode.PERSISTENT)} ); // addCombinationValues( "destinationType", new Object[]{ -// new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), -// new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); +// Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), +// Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); // } // // @@ -697,11 +697,11 @@ public void initCombosForTestTempDestinationsOnlyAllowsLocalConsumers() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testTempDestinationsOnlyAllowsLocalConsumers() throws Exception { @@ -739,8 +739,8 @@ public void initCombosForTestExclusiveQueueDeliversToOnlyOneConsumer() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); } public void testExclusiveQueueDeliversToOnlyOneConsumer() throws Exception { @@ -803,11 +803,11 @@ public void initCombosForTestWildcardConsume() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)} ); } public void testWildcardConsume() throws Exception { @@ -850,11 +850,11 @@ public void initCombosForTestCompositeConsume() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)} ); } public void testCompositeConsume() throws Exception { @@ -895,11 +895,11 @@ public void initCombosForTestCompositeSend() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)} ); } public void testCompositeSend() throws Exception { @@ -964,8 +964,8 @@ public void initCombosForTestConnectionCloseCascades() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destination", new Object[]{ new ActiveMQTopic("TEST"), new ActiveMQQueue("TEST")} ); @@ -1018,8 +1018,8 @@ public void initCombosForTestSessionCloseCascades() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destination", new Object[]{ new ActiveMQTopic("TEST"), new ActiveMQQueue("TEST")} ); @@ -1072,8 +1072,8 @@ public void initCombosForTestConsumerClose() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destination", new Object[]{ new ActiveMQTopic("TEST"), new ActiveMQQueue("TEST")} ); @@ -1125,8 +1125,8 @@ } public void initCombosForTestTopicNoLocal() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); } public void testTopicNoLocal() throws Exception { @@ -1192,8 +1192,8 @@ public void initCombosForTopicDispatchIsBroadcast() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); } public void testTopicDispatchIsBroadcast() throws Exception { @@ -1242,11 +1242,11 @@ public void initCombosForTestQueueDispatchedAreRedeliveredOnConsumerClose() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), } ); } @@ -1301,11 +1301,11 @@ public void initCombosForTestQueueBrowseMessages() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), } ); } public void testQueueBrowseMessages() throws Exception { @@ -1343,8 +1343,8 @@ public void initCombosForTestQueueOnlyOnceDeliveryWith2Consumers() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); } public void testQueueOnlyOnceDeliveryWith2Consumers() throws Exception { @@ -1397,11 +1397,11 @@ public void initCombosForTestQueueSendThenAddConsumer() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), } ); } public void testQueueSendThenAddConsumer() throws Exception { @@ -1432,11 +1432,11 @@ public void initCombosForTestQueueAckRemovesMessage() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), } ); } @@ -1477,10 +1477,10 @@ new ActiveMQTopic("TEST_TOPIC"), new ActiveMQQueue("TEST_QUEUE")} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testSelectorSkipsMessages() throws Exception { @@ -1518,13 +1518,13 @@ public void initCombosForTestAddConsumerThenSend() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testAddConsumerThenSend() throws Exception { @@ -1552,13 +1552,13 @@ public void initCombosForTestConsumerPrefetchAtOne() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testConsumerPrefetchAtOne() throws Exception { @@ -1591,13 +1591,13 @@ public void initCombosForTestConsumerPrefetchAtTwo() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testConsumerPrefetchAtTwo() throws Exception { @@ -1633,13 +1633,13 @@ public void initCombosForTestConsumerPrefetchAndDeliveredAck() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testConsumerPrefetchAndDeliveredAck() throws Exception { Index: activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java (working copy) @@ -65,7 +65,7 @@ /** * Setting this to false makes the test run faster but they may be less accurate. */ - public static boolean FAST_NO_MESSAGE_LEFT_ASSERT = System.getProperty("FAST_NO_MESSAGE_LEFT_ASSERT", "true").equals("true"); + public static final boolean FAST_NO_MESSAGE_LEFT_ASSERT = System.getProperty("FAST_NO_MESSAGE_LEFT_ASSERT", "true").equals("true"); protected RegionBroker regionBroker; protected BrokerService broker; Index: activemq-core/src/test/java/org/apache/activemq/broker/Main.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/broker/Main.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/broker/Main.java (working copy) @@ -33,7 +33,7 @@ * @version $Revision$ */ public class Main { - protected static boolean createConsumers = false; + protected static final boolean createConsumers = false; /** * @param args Index: activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/broker/MessageExpirationTest.java (working copy) @@ -54,13 +54,13 @@ public void initCombosForTestMessagesWaitingForUssageDecreaseExpire() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE), - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), } ); } @@ -162,14 +162,14 @@ */ public void initCombosForTestMessagesInLongTransactionExpire() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - //new Integer(DeliveryMode.PERSISTENT) + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + //Integer.valueOf(DeliveryMode.PERSISTENT) } ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) } ); } @@ -232,25 +232,25 @@ public void TestMessagesInSubscriptionPendingListExpire() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) } ); } public void initCombosForTestMessagesInSubscriptionPendingListExpire() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) } ); } Index: activemq-core/src/test/java/org/apache/activemq/broker/StubBroker.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/broker/StubBroker.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/broker/StubBroker.java (working copy) @@ -58,7 +58,7 @@ } } - public class RemoveConnectionData { + public static class RemoveConnectionData { public final ConnectionContext connectionContext; public final ConnectionInfo connectionInfo; public final Throwable error; Index: activemq-core/src/test/java/org/apache/activemq/broker/virtual/CompositeQueueTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/broker/virtual/CompositeQueueTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/broker/virtual/CompositeQueueTest.java (working copy) @@ -92,7 +92,7 @@ protected TextMessage createMessage(Session session, int i) throws JMSException { TextMessage textMessage = session.createTextMessage("message: " + i); - if (i % 2 == 1) { + if (i % 2 != 0) { textMessage.setStringProperty("odd", "yes"); } textMessage.setIntProperty("i", i); Index: activemq-core/src/test/java/org/apache/activemq/bugs/JmsDurableTopicSlowReceiveTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/bugs/JmsDurableTopicSlowReceiveTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/bugs/JmsDurableTopicSlowReceiveTest.java (working copy) @@ -46,12 +46,12 @@ protected MessageProducer producer2; protected Destination consumerDestination2; BrokerService broker; - final int NMSG=100; - final int MSIZE=256000; + static final int NMSG=100; + static final int MSIZE=256000; private Connection connection3; private Session consumeSession3; private TopicSubscriber consumer3; - private final String countProperyName = "count"; + private static final String countProperyName = "count"; /** * Set up a durable suscriber test. Index: activemq-core/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java (working copy) @@ -243,11 +243,11 @@ try { msg.writeObject("fred"); msg.writeObject(Boolean.TRUE); - msg.writeObject(new Character('q')); - msg.writeObject(new Byte((byte) 1)); - msg.writeObject(new Short((short) 3)); - msg.writeObject(new Integer(3)); - msg.writeObject(new Long(300l)); + msg.writeObject(Character.valueOf('q')); + msg.writeObject(Byte.valueOf((byte) 1)); + msg.writeObject(Short.valueOf((short) 3)); + msg.writeObject(Integer.valueOf(3)); + msg.writeObject(Long.valueOf(300l)); msg.writeObject(new Float(3.3f)); msg.writeObject(new Double(3.3)); msg.writeObject(new byte[3]); Index: activemq-core/src/test/java/org/apache/activemq/command/ActiveMQStreamMessageTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/command/ActiveMQStreamMessageTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/command/ActiveMQStreamMessageTest.java (working copy) @@ -364,7 +364,7 @@ msg.reset(); assertTrue(msg.readLong() == test); msg.reset(); - assertTrue(msg.readString().equals(new Long(test).toString())); + assertTrue(msg.readString().equals(Long.valueOf(test).toString())); msg.reset(); try { msg.readBoolean(); Index: activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java (working copy) @@ -65,13 +65,13 @@ public void initCombosForTestMessageListenerWithConsumerCanBeStopped() { addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destinationType", new Object[] { - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) }); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) }); } public void testMessageListenerWithConsumerCanBeStopped() throws Exception { @@ -115,17 +115,17 @@ public void initCombosForTestMutiReceiveWithPrefetch1() { addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("ackMode", new Object[] { - new Integer(Session.AUTO_ACKNOWLEDGE), - new Integer(Session.DUPS_OK_ACKNOWLEDGE), - new Integer(Session.CLIENT_ACKNOWLEDGE) }); + Integer.valueOf(Session.AUTO_ACKNOWLEDGE), + Integer.valueOf(Session.DUPS_OK_ACKNOWLEDGE), + Integer.valueOf(Session.CLIENT_ACKNOWLEDGE) }); addCombinationValues("destinationType", new Object[] { - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) }); } @@ -155,10 +155,10 @@ public void initCombosForTestDurableConsumerSelectorChange() { addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destinationType", new Object[] { - new Byte(ActiveMQDestination.TOPIC_TYPE)}); + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)}); } public void testDurableConsumerSelectorChange() throws Exception { @@ -200,11 +200,11 @@ } public void initCombosForTestSendReceiveBytesMessage() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); - addCombinationValues("destinationType", new Object[] { new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); + addCombinationValues("destinationType", new Object[] { Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) }); } public void testSendReceiveBytesMessage() throws Exception { @@ -233,13 +233,13 @@ public void initCombosForTestSetMessageListenerAfterStart() { addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destinationType", new Object[] { - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) }); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) }); } public void testSetMessageListenerAfterStart() throws Exception { @@ -273,15 +273,15 @@ public void initCombosForTestMessageListenerUnackedWithPrefetch1StayInQueue() { addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("ackMode", new Object[] { - new Integer(Session.AUTO_ACKNOWLEDGE), - new Integer(Session.DUPS_OK_ACKNOWLEDGE), - new Integer(Session.CLIENT_ACKNOWLEDGE) + Integer.valueOf(Session.AUTO_ACKNOWLEDGE), + Integer.valueOf(Session.DUPS_OK_ACKNOWLEDGE), + Integer.valueOf(Session.CLIENT_ACKNOWLEDGE) }); - addCombinationValues("destinationType", new Object[] { new Byte(ActiveMQDestination.QUEUE_TYPE), }); + addCombinationValues("destinationType", new Object[] { Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), }); } public void testMessageListenerUnackedWithPrefetch1StayInQueue() throws Exception { @@ -364,13 +364,13 @@ public void initCombosForTestMessageListenerWithConsumerWithPrefetch1() { addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destinationType", new Object[] { - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) }); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) }); } public void testMessageListenerWithConsumerWithPrefetch1() throws Exception { @@ -404,13 +404,13 @@ public void initCombosForTestMessageListenerWithConsumer() { addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destinationType", new Object[] { - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) }); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) }); } public void testMessageListenerWithConsumer() throws Exception { @@ -441,11 +441,11 @@ } public void initCombosForTestUnackedWithPrefetch1StayInQueue() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); - addCombinationValues("ackMode", new Object[] { new Integer(Session.AUTO_ACKNOWLEDGE), - new Integer(Session.DUPS_OK_ACKNOWLEDGE), new Integer(Session.CLIENT_ACKNOWLEDGE) }); - addCombinationValues("destinationType", new Object[] { new Byte(ActiveMQDestination.QUEUE_TYPE), }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); + addCombinationValues("ackMode", new Object[] { Integer.valueOf(Session.AUTO_ACKNOWLEDGE), + Integer.valueOf(Session.DUPS_OK_ACKNOWLEDGE), Integer.valueOf(Session.CLIENT_ACKNOWLEDGE) }); + addCombinationValues("destinationType", new Object[] { Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), }); } public void testUnackedWithPrefetch1StayInQueue() throws Exception { @@ -490,8 +490,8 @@ } public void initCombosForTestPrefetch1MessageNotDispatched() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); } public void testPrefetch1MessageNotDispatched() throws Exception { @@ -532,9 +532,9 @@ } public void initCombosForTestDontStart() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), }); - addCombinationValues("destinationType", new Object[] { new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), }); + addCombinationValues("destinationType", new Object[] { Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), }); } public void testDontStart() throws Exception { @@ -551,9 +551,9 @@ } public void initCombosForTestStartAfterSend() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), }); - addCombinationValues("destinationType", new Object[] { new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), }); + addCombinationValues("destinationType", new Object[] { Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), }); } public void testStartAfterSend() throws Exception { @@ -574,11 +574,11 @@ } public void initCombosForTestReceiveMessageWithConsumer() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); - addCombinationValues("destinationType", new Object[] { new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE) }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); + addCombinationValues("destinationType", new Object[] { Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE) }); } public void testReceiveMessageWithConsumer() throws Exception { Index: activemq-core/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/JMSExclusiveConsumerTest.java (working copy) @@ -45,8 +45,8 @@ public int deliveryMode; public void initCombosForTestRoundRobinDispatchOnNonExclusive() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); } /** @@ -82,8 +82,8 @@ } public void initCombosForTestDispatchExclusive() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); } /** Index: activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/JMSMessageTest.java (working copy) @@ -65,10 +65,10 @@ "vm://localhost?marshal=true" }); addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destinationType", new Object[] { - new Byte(ActiveMQDestination.QUEUE_TYPE)}); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE)}); } public void testTextMessage() throws Exception { Index: activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java (working copy) @@ -54,8 +54,8 @@ protected Destination destination; // for message listener test - private final int messageCount = 5; - private final String messageText = "message"; + private static final int messageCount = 5; + private static final String messageText = "message"; private List unackMessages = new ArrayList(messageCount); private List ackMessages = new ArrayList(messageCount); private boolean resendPhase = false; Index: activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/JMSUsecaseTest.java (working copy) @@ -50,11 +50,11 @@ public void initCombosForTestQueueBrowser() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), } ); } public void testQueueBrowser() throws Exception { @@ -80,13 +80,13 @@ public void initCombosForTestSendReceive() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testSendReceive() throws Exception { // Send a message to the broker. @@ -105,13 +105,13 @@ public void initCombosForTestSendReceiveTransacted() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT)} ); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT)} ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.QUEUE_TYPE), - new Byte(ActiveMQDestination.TOPIC_TYPE), - new Byte(ActiveMQDestination.TEMP_QUEUE_TYPE), - new Byte(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); + Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TEMP_TOPIC_TYPE)} ); } public void testSendReceiveTransacted() throws Exception { // Send a message to the broker. Index: activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/LargeStreamletTest.java (working copy) @@ -94,7 +94,7 @@ }); final Thread writerThread = new Thread(new Runnable() { - + private final Random random = new Random(); public void run() { totalWritten.set(0); int count = MESSAGE_COUNT; @@ -103,7 +103,7 @@ .createOutputStream(destination); try { final byte[] buf = new byte[BUFFER_SIZE]; - new Random().nextBytes(buf); + random.nextBytes(buf); while (count > 0 && !stopThreads.get()) { outputStream.write(buf); totalWritten.addAndGet(buf.length); Index: activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/LoadTestBurnIn.java (working copy) @@ -97,25 +97,25 @@ public void initCombosForTestSendReceive() { addCombinationValues("deliveryMode", new Object[] { - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destinationType", new Object[] { - new Byte(ActiveMQDestination.TOPIC_TYPE), -// new Byte(ActiveMQDestination.QUEUE_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), +// Byte.valueOf(ActiveMQDestination.QUEUE_TYPE), }); addCombinationValues("durableConsumer", new Object[] { Boolean.TRUE, // Boolean.FALSE, }); addCombinationValues("messageSize", new Object[] { - new Integer(101), - new Integer(102), - new Integer(103), - new Integer(104), - new Integer(105), - new Integer(106), - new Integer(107), - new Integer(108), + Integer.valueOf(101), + Integer.valueOf(102), + Integer.valueOf(103), + Integer.valueOf(104), + Integer.valueOf(105), + Integer.valueOf(106), + Integer.valueOf(107), + Integer.valueOf(108), }); } Index: activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageTest.java (working copy) @@ -39,7 +39,7 @@ public class ActiveMQTextMessageTest extends ActiveMQMessageTest { - public static ActiveMQTextMessageTest SINGLETON = new ActiveMQTextMessageTest(); + public static final ActiveMQTextMessageTest SINGLETON = new ActiveMQTextMessageTest(); public Object createObject() throws Exception { ActiveMQTextMessage info = new ActiveMQTextMessage(); Index: activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerInfoTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerInfoTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerInfoTest.java (working copy) @@ -39,7 +39,7 @@ public class BrokerInfoTest extends BaseCommandTestSupport { - public static BrokerInfoTest SINGLETON = new BrokerInfoTest(); + public static final BrokerInfoTest SINGLETON = new BrokerInfoTest(); public Object createObject() throws Exception { BrokerInfo info = new BrokerInfo(); Index: activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageAckTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageAckTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageAckTest.java (working copy) @@ -39,7 +39,7 @@ public class MessageAckTest extends BaseCommandTestSupport { - public static MessageAckTest SINGLETON = new MessageAckTest(); + public static final MessageAckTest SINGLETON = new MessageAckTest(); public Object createObject() throws Exception { MessageAck info = new MessageAck(); Index: activemq-core/src/test/java/org/apache/activemq/proxy/ProxyConnectorTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/proxy/ProxyConnectorTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/proxy/ProxyConnectorTest.java (working copy) @@ -51,11 +51,11 @@ public void initCombosForTestSendAndConsume() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) } ); addCombinationValues( "destinationType", new Object[]{ - new Byte(ActiveMQDestination.TOPIC_TYPE), + Byte.valueOf(ActiveMQDestination.TOPIC_TYPE), } ); } public void testSendAndConsume() throws Exception { Index: activemq-core/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java (working copy) @@ -48,7 +48,6 @@ * */ public class LDAPAuthorizationMapTest extends TestCase { - private HashMap options; private LDAPAuthorizationMap authMap; protected void setUp() throws Exception { Index: activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java (working copy) @@ -104,7 +104,7 @@ return new SimpleAuthorizationMap(writeAccess, readAccess, adminAccess); } - class SimpleAuthenticationFactory implements BrokerPlugin { + static class SimpleAuthenticationFactory implements BrokerPlugin { public Broker installPlugin(Broker broker) { HashMap u = new HashMap(); Index: activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java (working copy) @@ -49,8 +49,8 @@ Map map = (Map) mapMessage.getObject("mapField"); assertNotNull(map); assertEquals("mapField.a", "foo", map.get("a")); - assertEquals("mapField.b", new Integer(23), map.get("b")); - assertEquals("mapField.c", new Long(45), map.get("c")); + assertEquals("mapField.b", Integer.valueOf(23), map.get("b")); + assertEquals("mapField.c", Long.valueOf(45), map.get("c")); value = map.get("d"); assertTrue("mapField.d should be a Map", value instanceof Map); @@ -84,8 +84,8 @@ Map nestedMap = new HashMap(); nestedMap.put("a", "foo"); - nestedMap.put("b", new Integer(23)); - nestedMap.put("c", new Long(45)); + nestedMap.put("b", Integer.valueOf(23)); + nestedMap.put("c", Long.valueOf(45)); nestedMap.put("d", grandChildMap); answer.setObject("mapField", nestedMap); Index: activemq-core/src/test/java/org/apache/activemq/test/retroactive/DummyMessageQuery.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/test/retroactive/DummyMessageQuery.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/test/retroactive/DummyMessageQuery.java (working copy) @@ -34,7 +34,7 @@ protected static final Log log = LogFactory.getLog(DummyMessageQuery.class); - public static int messageCount = 10; + public static final int messageCount = 10; public void execute(ActiveMQDestination destination, MessageListener listener) throws Exception { log.info("Initial query is creating: " + messageCount + " messages"); Index: activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java (working copy) @@ -47,8 +47,8 @@ public void initCombosForTestPublisherFailsOver() { addCombinationValues( "deliveryMode", new Object[]{ - new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) + Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) } ); addCombinationValues( "destination", new Object[]{ new ActiveMQQueue("TEST"), Index: activemq-core/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java (working copy) @@ -61,8 +61,8 @@ } public void initCombosForTestPublisherFansout() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destination", new Object[] { new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"), }); } @@ -109,8 +109,8 @@ public void initCombosForTestPublisherWaitsForServerToBeUp() { - addCombinationValues("deliveryMode", new Object[] { new Integer(DeliveryMode.NON_PERSISTENT), - new Integer(DeliveryMode.PERSISTENT) }); + addCombinationValues("deliveryMode", new Object[] { Integer.valueOf(DeliveryMode.NON_PERSISTENT), + Integer.valueOf(DeliveryMode.PERSISTENT) }); addCombinationValues("destination", new Object[] { new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST"), }); } public void testPublisherWaitsForServerToBeUp() throws Exception { Index: activemq-core/src/test/java/org/apache/activemq/transport/peer/PeerTransportTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/transport/peer/PeerTransportTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/transport/peer/PeerTransportTest.java (working copy) @@ -48,8 +48,8 @@ protected Log log = LogFactory.getLog(getClass()); protected ActiveMQDestination destination; protected boolean topic = true; - protected static int MESSAGE_COUNT = 50; - protected static int NUMBER_IN_CLUSTER = 3; + protected static final int MESSAGE_COUNT = 50; + protected static final int NUMBER_IN_CLUSTER = 3; protected int deliveryMode = DeliveryMode.NON_PERSISTENT; protected MessageProducer[] producers; protected Connection[] connections; Index: activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java (working copy) @@ -204,8 +204,8 @@ startClient(); - addCombinationValues("clientInactivityLimit", new Object[] { new Long(1000)}); - addCombinationValues("serverInactivityLimit", new Object[] { new Long(1000)}); + addCombinationValues("clientInactivityLimit", new Object[] { Long.valueOf(1000)}); + addCombinationValues("serverInactivityLimit", new Object[] { Long.valueOf(1000)}); addCombinationValues("serverRunOnCommand", new Object[] { new Runnable() { public void run() { try { Index: activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportTest.java (working copy) @@ -37,7 +37,6 @@ public class SslTransportTest extends TestCase { SSLSocket sslSocket; - SslTransport transport; StubTransportListener stubListener; String username; Index: activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java (working copy) @@ -54,8 +54,8 @@ protected Destination destination; protected boolean topic = true; protected AtomicInteger receivedMessageCount = new AtomicInteger(0); - protected static int MESSAGE_COUNT = 50; - protected static int NUMBER_IN_CLUSTER = 3; + protected static final int MESSAGE_COUNT = 50; + protected static final int NUMBER_IN_CLUSTER = 3; protected int deliveryMode = DeliveryMode.NON_PERSISTENT; protected MessageProducer[] producers; protected Connection[] connections; Index: activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java (working copy) @@ -241,7 +241,7 @@ return acf; } - private class TestMessageListener1 implements MessageListener { + private static class TestMessageListener1 implements MessageListener { private final long waitTime; final AtomicInteger count = new AtomicInteger(0); Index: activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java (working copy) @@ -174,7 +174,7 @@ } } - private class PooledProducerTask implements Runnable{ + private static class PooledProducerTask implements Runnable{ private final String queueName; private final PooledConnectionFactory pcf; Index: activemq-core/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java (working copy) @@ -49,7 +49,7 @@ HashMap map = new HashMap(); ObjectMessage message = publisherSession.createObjectMessage(); for (int i = 0;i < COUNT;i++) { - map.put(VALUE_NAME, new Integer(i)); + map.put(VALUE_NAME, Integer.valueOf(i)); message.setObject(map); producer.send(message); assertTrue(message.getObject()==map); Index: activemq-core/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java =================================================================== --- activemq-core/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java (revision 550057) +++ activemq-core/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java (working copy) @@ -45,7 +45,7 @@ super(n); } - protected void setup() throws Exception{ + protected void setUp() throws Exception{ super.setUp(); topic = true; } Index: activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java =================================================================== --- activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java (revision 550057) +++ activemq-jaas/src/main/java/org/apache/activemq/jaas/LDAPLoginModule.java (working copy) @@ -119,8 +119,8 @@ userRoleName = (String) options.get(USER_ROLE_NAME); userSearchMatchingFormat = new MessageFormat(userSearchMatching); roleSearchMatchingFormat = new MessageFormat(roleSearchMatching); - userSearchSubtreeBool = new Boolean(userSearchSubtree).booleanValue(); - roleSearchSubtreeBool = new Boolean(roleSearchSubtree).booleanValue(); + userSearchSubtreeBool = Boolean.valueOf(userSearchSubtree).booleanValue(); + roleSearchSubtreeBool = Boolean.valueOf(roleSearchSubtree).booleanValue(); } public boolean login() throws LoginException { Index: activemq-jaas/src/main/java/org/apache/activemq/jaas/PropertiesLoginModule.java =================================================================== --- activemq-jaas/src/main/java/org/apache/activemq/jaas/PropertiesLoginModule.java (revision 550057) +++ activemq-jaas/src/main/java/org/apache/activemq/jaas/PropertiesLoginModule.java (working copy) @@ -44,8 +44,8 @@ */ public class PropertiesLoginModule implements LoginModule { - private final String USER_FILE = "org.apache.activemq.jaas.properties.user"; - private final String GROUP_FILE = "org.apache.activemq.jaas.properties.group"; + private static final String USER_FILE = "org.apache.activemq.jaas.properties.user"; + private static final String GROUP_FILE = "org.apache.activemq.jaas.properties.group"; private static final Log log = LogFactory.getLog(PropertiesLoginModule.class); @@ -83,13 +83,17 @@ public boolean login() throws LoginException { File f = new File(baseDir,usersFile); try { - users.load(new java.io.FileInputStream(f)); + java.io.FileInputStream in = new java.io.FileInputStream(f); + users.load(in); + in.close(); } catch (IOException ioe) { throw new LoginException("Unable to load user properties file " + f); } f = new File(baseDir, groupsFile); try { - groups.load(new java.io.FileInputStream(f)); + java.io.FileInputStream in = new java.io.FileInputStream(f); + groups.load(in); + in.close(); } catch (IOException ioe) { throw new LoginException("Unable to load group properties file " + f); } Index: activemq-jaas/src/main/java/org/apache/activemq/jaas/TextFileCertificateLoginModule.java =================================================================== --- activemq-jaas/src/main/java/org/apache/activemq/jaas/TextFileCertificateLoginModule.java (revision 550057) +++ activemq-jaas/src/main/java/org/apache/activemq/jaas/TextFileCertificateLoginModule.java (working copy) @@ -47,8 +47,8 @@ */ public class TextFileCertificateLoginModule extends CertificateLoginModule { - private final String USER_FILE = "org.apache.activemq.jaas.textfiledn.user"; - private final String GROUP_FILE = "org.apache.activemq.jaas.textfiledn.group"; + private static final String USER_FILE = "org.apache.activemq.jaas.textfiledn.user"; + private static final String GROUP_FILE = "org.apache.activemq.jaas.textfiledn.group"; private File baseDir; private String usersFilePathname; @@ -88,7 +88,9 @@ Properties users = new Properties(); try { - users.load(new java.io.FileInputStream(usersFile)); + java.io.FileInputStream in = new java.io.FileInputStream(usersFile); + users.load(in); + in.close(); } catch (IOException ioe) { throw new LoginException("Unable to load user properties file " + usersFile); } @@ -119,7 +121,9 @@ Properties groups = new Properties(); try { - groups.load(new java.io.FileInputStream(groupsFile)); + java.io.FileInputStream in = new java.io.FileInputStream(groupsFile); + groups.load(in); + in.close(); } catch (IOException ioe) { throw new LoginException("Unable to load group properties file " + groupsFile); } Index: activemq-jaas/src/test/java/org/apache/activemq/jaas/CertificateLoginModuleTest.java =================================================================== --- activemq-jaas/src/test/java/org/apache/activemq/jaas/CertificateLoginModuleTest.java (revision 550057) +++ activemq-jaas/src/test/java/org/apache/activemq/jaas/CertificateLoginModuleTest.java (working copy) @@ -35,8 +35,8 @@ import javax.security.auth.login.LoginException; public class CertificateLoginModuleTest extends TestCase { - private final String userName = "testUser"; - private final List groupNames = new Vector(); + private static final String userName = "testUser"; + private static final List groupNames = new Vector(); private StubCertificateLoginModule loginModule; private Subject subject; Index: activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/CHeadersGenerator.java =================================================================== --- activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/CHeadersGenerator.java (revision 550057) +++ activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/CHeadersGenerator.java (working copy) @@ -235,7 +235,6 @@ protected void generateFile(PrintWriter out) throws Exception { String structName = jclass.getSimpleName(); - String type = "OW_" + structName.toUpperCase() + "_TYPE"; out.println(""); out.println("typedef struct ow_"+structName+" {"); Index: activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/JavaTestsGenerator.java =================================================================== --- activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/JavaTestsGenerator.java (revision 550057) +++ activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/JavaTestsGenerator.java (working copy) @@ -108,8 +108,6 @@ } } - boolean marshallerAware = isMarshallAware(jclass); - out.println(""); out.println("/**"); out.println(" * Test case for the OpenWire marshalling for "+jclass.getSimpleName()+""); Index: activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/MultiSourceGenerator.java =================================================================== --- activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/MultiSourceGenerator.java (revision 550057) +++ activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/MultiSourceGenerator.java (working copy) @@ -146,7 +146,7 @@ } public boolean isAbstractClass() { - return jclass != null & jclass.isAbstract(); + return jclass != null && jclass.isAbstract(); } public String getAbstractClassText() { Index: activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/SingleSourceGenerator.java =================================================================== --- activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/SingleSourceGenerator.java (revision 550057) +++ activemq-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/SingleSourceGenerator.java (working copy) @@ -158,7 +158,7 @@ } public boolean isAbstractClass() { - return jclass != null & jclass.isAbstract(); + return jclass != null && jclass.isAbstract(); } public String getAbstractClassText() { Index: activemq-optional/src/main/java/org/apache/activemq/axis/ActiveMQVendorAdapter.java =================================================================== --- activemq-optional/src/main/java/org/apache/activemq/axis/ActiveMQVendorAdapter.java (revision 550057) +++ activemq-optional/src/main/java/org/apache/activemq/axis/ActiveMQVendorAdapter.java (working copy) @@ -94,7 +94,7 @@ // compare broker url String propertyBrokerURL = (String) properties.get(BROKER_URL); - if (!brokerURL.equals(propertyBrokerURL)) { + if (brokerURL == null || !brokerURL.equals(propertyBrokerURL)) { return false; } return true; Index: activemq-optional/src/main/java/org/apache/activemq/benchmark/BenchmarkSupport.java =================================================================== --- activemq-optional/src/main/java/org/apache/activemq/benchmark/BenchmarkSupport.java (revision 550057) +++ activemq-optional/src/main/java/org/apache/activemq/benchmark/BenchmarkSupport.java (working copy) @@ -184,7 +184,7 @@ times++; } if (times > 0) { - average = total / times; + average = total / (double) times; } long oldtime = time; Index: activemq-optional/src/main/java/org/apache/activemq/benchmark/Producer.java =================================================================== --- activemq-optional/src/main/java/org/apache/activemq/benchmark/Producer.java (revision 550057) +++ activemq-optional/src/main/java/org/apache/activemq/benchmark/Producer.java (working copy) @@ -178,6 +178,7 @@ buffer.append(line); buffer.append(File.separator); } + in.close(); return buffer.toString(); } } Index: activemq-optional/src/main/java/org/apache/activemq/tool/AcidTestTool.java =================================================================== --- activemq-optional/src/main/java/org/apache/activemq/tool/AcidTestTool.java (revision 550057) +++ activemq-optional/src/main/java/org/apache/activemq/tool/AcidTestTool.java (working copy) @@ -53,7 +53,6 @@ private Random random = new Random(); private byte data[]; private int workerCount = 10; - private PrintWriter statWriter; // Worker configuration. protected int recordSize = 1024; Index: activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java =================================================================== --- activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java (revision 550057) +++ activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java (working copy) @@ -72,7 +72,7 @@ String text = getTextWireFormat().marshalText(command); Writer writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(text); - writer.flush(); + writer.close(); int answer = connection.getResponseCode(); if (answer != HttpURLConnection.HTTP_OK) { throw new IOException("Failed to post command: " + command + " as response was: " + answer); @@ -109,6 +109,7 @@ while( (c=is.read())>= 0 ) { baos.write(c); } + baos.close(); ByteSequence sequence = baos.toByteSequence(); String data = new String(sequence.data, sequence.offset, sequence.length, "UTF-8"); Index: activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java =================================================================== --- activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java (revision 550057) +++ activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java (working copy) @@ -533,7 +533,7 @@ } public String getMaxMessagesPerSessions() { - return maxMessagesPerSessions.toString(); + return maxMessagesPerSessions; } /** @@ -592,14 +592,14 @@ } public boolean isUseRAManagedTransactionEnabled() { - return new Boolean(useRAManagedTransaction).booleanValue(); + return Boolean.valueOf(useRAManagedTransaction).booleanValue(); } /** * */ public boolean getNoLocalBooleanValue() { - return new Boolean(noLocal).booleanValue(); + return Boolean.valueOf(noLocal).booleanValue(); } public String getEnableBatch() { @@ -616,7 +616,7 @@ } public boolean getEnableBatchBooleanValue() { - return new Boolean(enableBatch).booleanValue(); + return Boolean.valueOf(enableBatch).booleanValue(); } public int getMaxMessagesPerBatchIntValue() { @@ -624,7 +624,7 @@ } public String getMaxMessagesPerBatch() { - return maxMessagesPerBatch.toString(); + return maxMessagesPerBatch; } /** Index: activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java =================================================================== --- activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java (revision 550057) +++ activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java (working copy) @@ -199,19 +199,19 @@ } public Short getRedeliveryBackOffMultiplier() { - return new Short(redeliveryPolicy().getBackOffMultiplier()); + return Short.valueOf(redeliveryPolicy().getBackOffMultiplier()); } public Long getInitialRedeliveryDelay() { - return new Long(redeliveryPolicy().getInitialRedeliveryDelay()); + return Long.valueOf(redeliveryPolicy().getInitialRedeliveryDelay()); } public Integer getMaximumRedeliveries() { - return new Integer(redeliveryPolicy().getMaximumRedeliveries()); + return Integer.valueOf(redeliveryPolicy().getMaximumRedeliveries()); } public Boolean getRedeliveryUseExponentialBackOff() { - return new Boolean(redeliveryPolicy().isUseExponentialBackOff()); + return Boolean.valueOf(redeliveryPolicy().isUseExponentialBackOff()); } public void setRedeliveryBackOffMultiplier(Short value) { @@ -239,23 +239,23 @@ } public Integer getDurableTopicPrefetch() { - return new Integer(prefetchPolicy().getDurableTopicPrefetch()); + return Integer.valueOf(prefetchPolicy().getDurableTopicPrefetch()); } public Integer getInputStreamPrefetch() { - return new Integer(prefetchPolicy().getInputStreamPrefetch()); + return Integer.valueOf(prefetchPolicy().getInputStreamPrefetch()); } public Integer getQueueBrowserPrefetch() { - return new Integer(prefetchPolicy().getQueueBrowserPrefetch()); + return Integer.valueOf(prefetchPolicy().getQueueBrowserPrefetch()); } public Integer getQueuePrefetch() { - return new Integer(prefetchPolicy().getQueuePrefetch()); + return Integer.valueOf(prefetchPolicy().getQueuePrefetch()); } public Integer getTopicPrefetch() { - return new Integer(prefetchPolicy().getTopicPrefetch()); + return Integer.valueOf(prefetchPolicy().getTopicPrefetch()); } public void setAllPrefetchValues(Integer i) { Index: activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointActivationKey.java =================================================================== --- activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointActivationKey.java (revision 550057) +++ activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointActivationKey.java (working copy) @@ -68,7 +68,7 @@ if (this == obj) { return true; } - if (obj == null) { + if (obj == null || !(obj instanceof ActiveMQEndpointActivationKey)) { return false; } ActiveMQEndpointActivationKey o = (ActiveMQEndpointActivationKey) obj; Index: activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java =================================================================== --- activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java (revision 550057) +++ activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java (working copy) @@ -55,7 +55,7 @@ public class MDBTest extends TestCase { - private final class StubBootstrapContext implements BootstrapContext { + private static final class StubBootstrapContext implements BootstrapContext { public WorkManager getWorkManager() { return new WorkManager() { public void doWork(Work work) throws WorkException { Index: activemq-ra/src/test/java/org/apache/activemq/ra/MessageEndpointProxyTest.java =================================================================== --- activemq-ra/src/test/java/org/apache/activemq/ra/MessageEndpointProxyTest.java (revision 550057) +++ activemq-ra/src/test/java/org/apache/activemq/ra/MessageEndpointProxyTest.java (working copy) @@ -51,7 +51,7 @@ public void testInvalidConstruction() { Mock mockEndpoint = new Mock(MessageEndpoint.class); try { - MessageEndpointProxy proxy = new MessageEndpointProxy((MessageEndpoint) mockEndpoint.proxy()); + new MessageEndpointProxy((MessageEndpoint) mockEndpoint.proxy()); fail("An exception should have been thrown"); } catch (IllegalArgumentException e) { assertTrue(true); Index: activemq-tooling/maven-activemq-memtest-plugin/src/main/java/org/apache/activemq/tool/JMSMemtest.java =================================================================== --- activemq-tooling/maven-activemq-memtest-plugin/src/main/java/org/apache/activemq/tool/JMSMemtest.java (revision 550057) +++ activemq-tooling/maven-activemq-memtest-plugin/src/main/java/org/apache/activemq/tool/JMSMemtest.java (working copy) @@ -107,16 +107,16 @@ public JMSMemtest(Properties settings) { url = settings.getProperty("url"); - topic = new Boolean(settings.getProperty("topic")).booleanValue(); - durable = new Boolean(settings.getProperty("durable")).booleanValue(); - connectionCheckpointSize = new Integer(settings.getProperty("connectionCheckpointSize")).intValue(); - producerCount = new Integer(settings.getProperty("producerCount")).intValue(); - consumerCount = new Integer(settings.getProperty("consumerCount")).intValue(); - messageCount = new Integer(settings.getProperty("messageCount")).intValue(); - messageSize = new Integer(settings.getProperty("messageSize")).intValue(); - prefetchSize = new Integer(settings.getProperty("prefetchSize")).intValue(); - checkpointInterval = new Integer(settings.getProperty("checkpointInterval")).intValue() * 1000; - producerCount = new Integer(settings.getProperty("producerCount")).intValue(); + topic = Boolean.valueOf(settings.getProperty("topic")).booleanValue(); + durable = Boolean.valueOf(settings.getProperty("durable")).booleanValue(); + connectionCheckpointSize = Integer.valueOf(settings.getProperty("connectionCheckpointSize")).intValue(); + producerCount = Integer.valueOf(settings.getProperty("producerCount")).intValue(); + consumerCount = Integer.valueOf(settings.getProperty("consumerCount")).intValue(); + messageCount = Integer.valueOf(settings.getProperty("messageCount")).intValue(); + messageSize = Integer.valueOf(settings.getProperty("messageSize")).intValue(); + prefetchSize = Integer.valueOf(settings.getProperty("prefetchSize")).intValue(); + checkpointInterval = Integer.valueOf(settings.getProperty("checkpointInterval")).intValue() * 1000; + producerCount = Integer.valueOf(settings.getProperty("producerCount")).intValue(); reportName = settings.getProperty("reportName"); destinationName = settings.getProperty("destinationName"); reportDirectory = settings.getProperty("reportDirectory"); @@ -171,7 +171,7 @@ protected boolean resetConnection(int counter) { if (connectionInterval > 0) { - long totalMsgSizeConsumed = counter * 1024; + long totalMsgSizeConsumed = counter * 1024L; if (connectionInterval < totalMsgSizeConsumed) { return true; } @@ -290,17 +290,17 @@ Properties settings = new Properties(); settings.setProperty("domain", topic == true ? "topic" : "queue"); settings.setProperty("durable", durable == true ? "durable" : "non-durable"); - settings.setProperty("connection_checkpoint_size_kb", new Integer(connectionCheckpointSize).toString()); - settings.setProperty("producer_count", new Integer(producerCount).toString()); - settings.setProperty("consumer_count", new Integer(consumerCount).toString()); - settings.setProperty("message_count", new Long(messageCount).toString()); - settings.setProperty("message_size", new Integer(messageSize).toString()); - settings.setProperty("prefetchSize", new Integer(prefetchSize).toString()); - settings.setProperty("checkpoint_interval", new Integer(checkpointInterval).toString()); + settings.setProperty("connection_checkpoint_size_kb", Integer.valueOf(connectionCheckpointSize).toString()); + settings.setProperty("producer_count", Integer.valueOf(producerCount).toString()); + settings.setProperty("consumer_count", Integer.valueOf(consumerCount).toString()); + settings.setProperty("message_count", Long.valueOf(messageCount).toString()); + settings.setProperty("message_size", Integer.valueOf(messageSize).toString()); + settings.setProperty("prefetchSize", Integer.valueOf(prefetchSize).toString()); + settings.setProperty("checkpoint_interval", Integer.valueOf(checkpointInterval).toString()); settings.setProperty("destination_name", destinationName); settings.setProperty("report_name", reportName); settings.setProperty("report_directory", reportDirectory); - settings.setProperty("connection_checkpoint_size", new Integer(connectionCheckpointSize).toString()); + settings.setProperty("connection_checkpoint_size", Integer.valueOf(connectionCheckpointSize).toString()); return settings; } Index: activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java =================================================================== --- activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java (revision 550057) +++ activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java (working copy) @@ -261,7 +261,9 @@ try { if (configFile != null) { log.info("Loading properties file: " + configFile.getAbsolutePath()); - fileProps.load(new FileInputStream(configFile)); + FileInputStream in = new FileInputStream(configFile); + fileProps.load(in); + in.close(); } } catch (IOException e) { e.printStackTrace(); Index: activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java =================================================================== --- activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java (revision 550057) +++ activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java (working copy) @@ -108,7 +108,7 @@ } else if (paramType == Byte.TYPE) { setterMethod.invoke(target, new Object[] {Byte.valueOf(val)}); } else if (paramType == Character.TYPE) { - setterMethod.invoke(target, new Object[] {new Character(val.charAt(0))}); + setterMethod.invoke(target, new Object[] {Character.valueOf(val.charAt(0))}); } } else { // Set String type Index: activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/XmlFilePerfReportWriter.java =================================================================== --- activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/XmlFilePerfReportWriter.java (revision 550057) +++ activemq-tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/XmlFilePerfReportWriter.java (working copy) @@ -210,6 +210,7 @@ xmlFileWriter.println("" + line + ""); } } + reader.close(); xmlFileWriter.println(""); xmlFileWriter.println(""); Index: activemq-tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java =================================================================== --- activemq-tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java (revision 550057) +++ activemq-tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java (working copy) @@ -284,7 +284,7 @@ } } - public class TestClass4 { + public static class TestClass4 { private File testFile; public String getTestFile() { @@ -296,7 +296,7 @@ } } - public class TestClass5 implements ReflectionConfigurable { + public static class TestClass5 implements ReflectionConfigurable { public boolean intercepted = false; public boolean willIntercept = true; public TestClass5 nest = null; @@ -324,7 +324,7 @@ } } - public class TestClass6 { + public static class TestClass6 { public TestClass6 nestNotConfig = null; public TestClass5 nestConfig = null; Index: activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java =================================================================== --- activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java (revision 550057) +++ activemq-web/src/main/java/org/apache/activemq/web/MessageServlet.java (working copy) @@ -402,7 +402,7 @@ /* * Listen for available messages and wakeup any continuations. */ - private class Listener implements MessageAvailableListener { + private static class Listener implements MessageAvailableListener { MessageConsumer consumer; Continuation continuation; List queue = new LinkedList(); Index: activemq-web/src/main/java/org/apache/activemq/web/PortfolioPublishServlet.java =================================================================== --- activemq-web/src/main/java/org/apache/activemq/web/PortfolioPublishServlet.java (revision 550057) +++ activemq-web/src/main/java/org/apache/activemq/web/PortfolioPublishServlet.java (working copy) @@ -56,11 +56,11 @@ else { Integer total=(Integer)request.getSession(true).getAttribute("total"); if (total==null) - total=new Integer(0); + total=Integer.valueOf(0); int count = getNumberOfMessages(request); - total=new Integer(total.intValue()+count); + total=Integer.valueOf(total.intValue()+count); request.getSession().setAttribute("total",total); try { Index: activemq-xmpp/src/main/java/org/apache/activemq/transport/xmpp/ProtocolConverter.java =================================================================== --- activemq-xmpp/src/main/java/org/apache/activemq/transport/xmpp/ProtocolConverter.java (revision 550057) +++ activemq-xmpp/src/main/java/org/apache/activemq/transport/xmpp/ProtocolConverter.java (working copy) @@ -146,7 +146,7 @@ public void onActiveMQCommad(Command command) throws Exception { if (command.isResponse()) { Response response = (Response) command; - Handler handler = resposeHandlers.remove(new Integer(response.getCorrelationId())); + Handler handler = resposeHandlers.remove(Integer.valueOf(response.getCorrelationId())); if (handler != null) { handler.handle(response); } Index: assembly/src/test/java/org/apache/activemq/benchmark/BenchmarkSupport.java =================================================================== --- assembly/src/test/java/org/apache/activemq/benchmark/BenchmarkSupport.java (revision 550057) +++ assembly/src/test/java/org/apache/activemq/benchmark/BenchmarkSupport.java (working copy) @@ -184,7 +184,7 @@ times++; } if (times > 0) { - average = total / times; + average = total / (double) times; } long oldtime = time; Index: assembly/src/test/java/org/apache/activemq/benchmark/Producer.java =================================================================== --- assembly/src/test/java/org/apache/activemq/benchmark/Producer.java (revision 550057) +++ assembly/src/test/java/org/apache/activemq/benchmark/Producer.java (working copy) @@ -178,6 +178,7 @@ buffer.append(line); buffer.append(File.separator); } + in.close(); return buffer.toString(); } }