From 2cc17a2fa06b86fef58bd26141d29bb5cb0d715d Mon Sep 17 00:00:00 2001 From: Matt Pavlovich Date: Tue, 25 May 2021 09:34:35 -0500 Subject: [PATCH] [AMQ-8279] Compiler warning cleanups - Remove unsused imports (exept for generated classes) - Convert to T.valueOf on boxed primitives from new T() --- .../client/util/TypeConversionSupport.java | 2 +- .../message/MessageTransformationTest.java | 2 +- .../activemq/broker/jmx/OpenTypeSupport.java | 2 +- .../broker/region/BaseDestination.java | 4 +-- .../apache/activemq/broker/region/Queue.java | 2 +- .../activemq/broker/region/RegionBroker.java | 2 +- .../osgi/cf/ConnectionFactoryProvider.java | 6 ++-- .../activemq/ActiveMQConnectionConsumer.java | 5 --- .../activemq/ActiveMQMessageConsumer.java | 1 - .../blob/DefaultBlobUploadStrategy.java | 1 - .../org/apache/activemq/blob/FTPStrategy.java | 1 - .../activemq/broker/scheduler/CronParser.java | 2 +- .../activemq/command/ActiveMQMapMessage.java | 4 +-- .../activemq/command/ActiveMQMessage.java | 4 +-- .../command/ActiveMQObjectMessage.java | 2 -- .../command/ActiveMQStreamMessage.java | 18 +++++----- .../activemq/command/WireFormatInfo.java | 8 ++--- .../activemq/filter/AnyDestination.java | 1 - .../activemq/filter/ArithmeticExpression.java | 22 ++++++------ .../activemq/filter/ComparisonExpression.java | 28 +++++++-------- .../activemq/filter/ConstantExpression.java | 4 +-- .../activemq/filter/PropertyExpression.java | 2 +- .../activemq/filter/UnaryExpression.java | 8 ++--- .../activemq/openwire/OpenWireFormat.java | 4 +-- .../openwire/v1/BaseDataStreamMarshaller.java | 4 +-- .../activemq/state/ConnectionState.java | 1 - .../transport/RequestTimedOutIOException.java | 2 ++ .../transport/ResponseCorrelator.java | 2 +- .../transport/discovery/DiscoveryAgent.java | 2 -- .../failover/FailoverTransportFactory.java | 1 - .../transport/fanout/FanoutTransport.java | 4 +-- .../fanout/FanoutTransportFactory.java | 1 - .../activemq/util/MarshallingSupport.java | 4 +-- .../activemq/util/TypeConversionSupport.java | 2 +- ...lassLoadingAwareObjectInputStreamTest.java | 2 +- .../apache/activemq/util/LRUCacheTest.java | 2 +- .../HttpJMSMessagesWithCompressionTest.java | 4 +-- ...ledConnectionFactoryMaximumActiveTest.java | 6 ++-- .../jms/pool/PooledConnectionFactoryTest.java | 8 ++--- .../store/kahadb/MessageDatabase.java | 2 +- ...JournalCorruptionEofIndexRecoveryTest.java | 2 +- .../org/apache/activemq/tool/JMSMemtest.java | 36 +++++++++---------- .../activemq/tool/MemoryMonitoringTool.java | 2 +- .../activemq/web/PortfolioPublishServlet.java | 4 +-- 44 files changed, 106 insertions(+), 120 deletions(-) diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/util/TypeConversionSupport.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/util/TypeConversionSupport.java index efa10b594c..914f68c49d 100644 --- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/util/TypeConversionSupport.java +++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/util/TypeConversionSupport.java @@ -151,7 +151,7 @@ public final class TypeConversionSupport { CONVERSION_MAP.put(new ConversionKey(Float.class, Double.class), new Converter() { @Override public Object convert(Object value) { - return new Double(((Number) value).doubleValue()); + return Double.valueOf(((Number) value).doubleValue()); } }); } diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/MessageTransformationTest.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/MessageTransformationTest.java index b2ab64669a..04cedc8fa8 100644 --- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/MessageTransformationTest.java +++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/MessageTransformationTest.java @@ -216,7 +216,7 @@ public class MessageTransformationTest { Message incomingMessage = Proton.message(); - incomingMessage.setBody(new AmqpValue(new Boolean(true))); + incomingMessage.setBody(new AmqpValue(Boolean.TRUE)); EncodedMessage encoded = encode(incomingMessage); InboundTransformer inboundTransformer = getInboundTransformer(); diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java index 735d8ad45c..b72bf17ffe 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/OpenTypeSupport.java @@ -302,7 +302,7 @@ public final class OpenTypeSupport { // In 1.6 it seems it is supported.. but until then... Byte data[] = new Byte[preview.length]; for (int i = 0; i < data.length; i++) { - data[i] = new Byte(preview[i]); + data[i] = Byte.valueOf(preview[i]); } rc.put(CompositeDataConstants.BODY_PREVIEW, data); diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java index 443a8f23e2..6d86162f93 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java @@ -706,9 +706,9 @@ public abstract class BaseDestination implements Destination { } if (isFlowControlLogRequired()) { - getLog().warn("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, new Long(((System.currentTimeMillis() - start) / 1000))}); + getLog().warn("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, Long.valueOf(((System.currentTimeMillis() - start) / 1000))}); } else { - getLog().debug("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, new Long(((System.currentTimeMillis() - start) / 1000))}); + getLog().debug("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, Long.valueOf(((System.currentTimeMillis() - start) / 1000))}); } } long finish = System.currentTimeMillis(); diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java index 13e952b9ff..9e0160929d 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java @@ -304,7 +304,7 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index if ((recoveredAccumulator % 10000) == 0) { LOG.info("cursor for {} has recovered {} messages. {}% complete", getActiveMQDestination().getQualifiedName(), recoveredAccumulator, - new Integer((int) (recoveredAccumulator * 100 / totalMessageCount))); + Integer.valueOf((int) (recoveredAccumulator * 100 / totalMessageCount))); } // Message could have expired while it was being // loaded.. diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java index fc0afb205e..50481a6579 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java @@ -753,7 +753,7 @@ public class RegionBroker extends EmptyBroker { boolean stamped = false; if (message.getProperty(ORIGINAL_EXPIRATION) == null) { long expiration = message.getExpiration(); - message.setProperty(ORIGINAL_EXPIRATION, new Long(expiration)); + message.setProperty(ORIGINAL_EXPIRATION, Long.valueOf(expiration)); stamped = true; } return stamped; diff --git a/activemq-cf/src/main/java/org/apache/activemq/osgi/cf/ConnectionFactoryProvider.java b/activemq-cf/src/main/java/org/apache/activemq/osgi/cf/ConnectionFactoryProvider.java index ee284987bc..7e88377bfa 100644 --- a/activemq-cf/src/main/java/org/apache/activemq/osgi/cf/ConnectionFactoryProvider.java +++ b/activemq-cf/src/main/java/org/apache/activemq/osgi/cf/ConnectionFactoryProvider.java @@ -50,9 +50,9 @@ public class ConnectionFactoryProvider { String jndiName = getString(config, OSGI_JNDI_SERVICE_NAME, "jms/local"); String userName = getString(config, "userName", null); String password = getString(config, "password", null); - long expiryTimeout = new Long(getString(config, "expiryTimeout", "0")); - int idleTimeout = new Integer(getString(config, "idleTimeout", "30000")); - int maxConnections = new Integer(getString(config, "maxConnections", "8")); + long expiryTimeout = Long.valueOf(getString(config, "expiryTimeout", "0")); + int idleTimeout = Integer.valueOf(getString(config, "idleTimeout", "30000")); + int maxConnections = Integer.valueOf(getString(config, "maxConnections", "8")); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(brokerURL); if (userName != null) { cf.setUserName(userName); diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionConsumer.java b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionConsumer.java index ba4b9ddb84..44f63a60aa 100644 --- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionConsumer.java +++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionConsumer.java @@ -17,10 +17,6 @@ package org.apache.activemq; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; import javax.jms.ConnectionConsumer; @@ -30,7 +26,6 @@ import javax.jms.ServerSession; import javax.jms.ServerSessionPool; import javax.jms.Session; -import org.apache.activemq.command.ConsumerId; import org.apache.activemq.command.ConsumerInfo; import org.apache.activemq.command.MessageDispatch; diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java b/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java index 3fc56cf957..533c6234eb 100644 --- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java +++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java @@ -24,7 +24,6 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/activemq-client/src/main/java/org/apache/activemq/blob/DefaultBlobUploadStrategy.java b/activemq-client/src/main/java/org/apache/activemq/blob/DefaultBlobUploadStrategy.java index 6672eeccc2..4f97979ab0 100644 --- a/activemq-client/src/main/java/org/apache/activemq/blob/DefaultBlobUploadStrategy.java +++ b/activemq-client/src/main/java/org/apache/activemq/blob/DefaultBlobUploadStrategy.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; -import java.net.MalformedURLException; import java.net.URL; import javax.jms.JMSException; diff --git a/activemq-client/src/main/java/org/apache/activemq/blob/FTPStrategy.java b/activemq-client/src/main/java/org/apache/activemq/blob/FTPStrategy.java index 5983c28712..7ba6422b3e 100644 --- a/activemq-client/src/main/java/org/apache/activemq/blob/FTPStrategy.java +++ b/activemq-client/src/main/java/org/apache/activemq/blob/FTPStrategy.java @@ -23,7 +23,6 @@ import java.net.URL; import javax.jms.JMSException; -import org.apache.activemq.command.ActiveMQBlobMessage; import org.apache.commons.net.ftp.FTPClient; public class FTPStrategy { diff --git a/activemq-client/src/main/java/org/apache/activemq/broker/scheduler/CronParser.java b/activemq-client/src/main/java/org/apache/activemq/broker/scheduler/CronParser.java index a08519ed9b..bfab2eb78d 100644 --- a/activemq-client/src/main/java/org/apache/activemq/broker/scheduler/CronParser.java +++ b/activemq-client/src/main/java/org/apache/activemq/broker/scheduler/CronParser.java @@ -229,7 +229,7 @@ public class CronParser { } static boolean isCurrent(final CronEntry entry, final int current) throws MessageFormatException { - boolean result = entry.currentWhen.contains(new Integer(current)); + boolean result = entry.currentWhen.contains(Integer.valueOf(current)); return result; } diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java index a69ec169e0..97edf3e9c9 100644 --- a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java +++ b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMapMessage.java @@ -676,7 +676,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public void setFloat(String name, float value) throws JMSException { initializeWriting(); - put(name, new Float(value)); + put(name, Float.valueOf(value)); } /** @@ -693,7 +693,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public void setDouble(String name, double value) throws JMSException { initializeWriting(); - put(name, new Double(value)); + put(name, Double.valueOf(value)); } /** diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java index 6feee45972..14fc430db1 100644 --- a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java +++ b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQMessage.java @@ -723,12 +723,12 @@ public class ActiveMQMessage extends Message implements org.apache.activemq.Mess @Override public void setFloatProperty(String name, float value) throws JMSException { - setObjectProperty(name, new Float(value)); + setObjectProperty(name, Float.valueOf(value)); } @Override public void setDoubleProperty(String name, double value) throws JMSException { - setObjectProperty(name, new Double(value)); + setObjectProperty(name, Double.valueOf(value)); } @Override diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQObjectMessage.java b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQObjectMessage.java index 64f0172074..621fd1fdc0 100644 --- a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQObjectMessage.java +++ b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQObjectMessage.java @@ -24,10 +24,8 @@ import java.io.InputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.Serializable; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.concurrent.ConcurrentHashMap; import java.util.zip.DeflaterOutputStream; import java.util.zip.InflaterInputStream; diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java index e30d355a23..074ba85906 100644 --- a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java +++ b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQStreamMessage.java @@ -634,28 +634,28 @@ public class ActiveMQStreamMessage extends ActiveMQMessage implements StreamMess return this.dataIn.readUTF(); } if (type == MarshallingSupport.LONG_TYPE) { - return new Long(this.dataIn.readLong()).toString(); + return Long.toString(this.dataIn.readLong()); } if (type == MarshallingSupport.INTEGER_TYPE) { - return new Integer(this.dataIn.readInt()).toString(); + return Integer.toString(this.dataIn.readInt()); } if (type == MarshallingSupport.SHORT_TYPE) { - return new Short(this.dataIn.readShort()).toString(); + return Short.toString(this.dataIn.readShort()); } if (type == MarshallingSupport.BYTE_TYPE) { - return new Byte(this.dataIn.readByte()).toString(); + return Byte.toString(this.dataIn.readByte()); } if (type == MarshallingSupport.FLOAT_TYPE) { - return new Float(this.dataIn.readFloat()).toString(); + return Float.toString(this.dataIn.readFloat()); } if (type == MarshallingSupport.DOUBLE_TYPE) { - return new Double(this.dataIn.readDouble()).toString(); + return Double.toString(this.dataIn.readDouble()); } if (type == MarshallingSupport.BOOLEAN_TYPE) { return (this.dataIn.readBoolean() ? Boolean.TRUE : Boolean.FALSE).toString(); } if (type == MarshallingSupport.CHAR_TYPE) { - return new Character(this.dataIn.readChar()).toString(); + return Character.toString(this.dataIn.readChar()); } else { this.dataIn.reset(); throw new MessageFormatException(" not a String type"); @@ -820,10 +820,10 @@ public class ActiveMQStreamMessage extends ActiveMQMessage implements StreamMess return Byte.valueOf(this.dataIn.readByte()); } if (type == MarshallingSupport.FLOAT_TYPE) { - return new Float(this.dataIn.readFloat()); + return Float.valueOf(this.dataIn.readFloat()); } if (type == MarshallingSupport.DOUBLE_TYPE) { - return new Double(this.dataIn.readDouble()); + return Double.valueOf(this.dataIn.readDouble()); } if (type == MarshallingSupport.BOOLEAN_TYPE) { return this.dataIn.readBoolean() ? Boolean.TRUE : Boolean.FALSE; diff --git a/activemq-client/src/main/java/org/apache/activemq/command/WireFormatInfo.java b/activemq-client/src/main/java/org/apache/activemq/command/WireFormatInfo.java index 8d61578a83..9477a1298e 100644 --- a/activemq-client/src/main/java/org/apache/activemq/command/WireFormatInfo.java +++ b/activemq-client/src/main/java/org/apache/activemq/command/WireFormatInfo.java @@ -285,7 +285,7 @@ public class WireFormatInfo implements Command, MarshallAware { } public void setMaxInactivityDuration(long maxInactivityDuration) throws IOException { - setProperty("MaxInactivityDuration", new Long(maxInactivityDuration)); + setProperty("MaxInactivityDuration", Long.valueOf(maxInactivityDuration)); } public long getMaxInactivityDurationInitalDelay() throws IOException { @@ -294,7 +294,7 @@ public class WireFormatInfo implements Command, MarshallAware { } public void setMaxInactivityDurationInitalDelay(long maxInactivityDurationInitalDelay) throws IOException { - setProperty("MaxInactivityDurationInitalDelay", new Long(maxInactivityDurationInitalDelay)); + setProperty("MaxInactivityDurationInitalDelay", Long.valueOf(maxInactivityDurationInitalDelay)); } public long getMaxFrameSize() throws IOException { @@ -303,7 +303,7 @@ public class WireFormatInfo implements Command, MarshallAware { } public void setMaxFrameSize(long maxFrameSize) throws IOException { - setProperty("MaxFrameSize", new Long(maxFrameSize)); + setProperty("MaxFrameSize", Long.valueOf(maxFrameSize)); } /** @@ -315,7 +315,7 @@ public class WireFormatInfo implements Command, MarshallAware { } public void setCacheSize(int cacheSize) throws IOException { - setProperty("CacheSize", new Integer(cacheSize)); + setProperty("CacheSize", Integer.valueOf(cacheSize)); } /** diff --git a/activemq-client/src/main/java/org/apache/activemq/filter/AnyDestination.java b/activemq-client/src/main/java/org/apache/activemq/filter/AnyDestination.java index 23a607c168..bd78bf6281 100644 --- a/activemq-client/src/main/java/org/apache/activemq/filter/AnyDestination.java +++ b/activemq-client/src/main/java/org/apache/activemq/filter/AnyDestination.java @@ -17,7 +17,6 @@ package org.apache.activemq.filter; import java.lang.IllegalStateException; -import javax.jms.*; import org.apache.activemq.command.ActiveMQDestination; /* diff --git a/activemq-client/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java b/activemq-client/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java index 918ebbbb4a..f155664f93 100644 --- a/activemq-client/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java +++ b/activemq-client/src/main/java/org/apache/activemq/filter/ArithmeticExpression.java @@ -122,42 +122,42 @@ public abstract class ArithmeticExpression extends BinaryExpression { protected Number plus(Number left, Number right) { switch (numberType(left, right)) { case INTEGER: - return new Integer(left.intValue() + right.intValue()); + return Integer.valueOf(left.intValue() + right.intValue()); case LONG: - return new Long(left.longValue() + right.longValue()); + return Long.valueOf(left.longValue() + right.longValue()); default: - return new Double(left.doubleValue() + right.doubleValue()); + return Double.valueOf(left.doubleValue() + right.doubleValue()); } } protected Number minus(Number left, Number right) { switch (numberType(left, right)) { case INTEGER: - return new Integer(left.intValue() - right.intValue()); + return Integer.valueOf(left.intValue() - right.intValue()); case LONG: - return new Long(left.longValue() - right.longValue()); + return Long.valueOf(left.longValue() - right.longValue()); default: - return new Double(left.doubleValue() - right.doubleValue()); + return Double.valueOf(left.doubleValue() - right.doubleValue()); } } protected Number multiply(Number left, Number right) { switch (numberType(left, right)) { case INTEGER: - return new Integer(left.intValue() * right.intValue()); + return Integer.valueOf(left.intValue() * right.intValue()); case LONG: - return new Long(left.longValue() * right.longValue()); + return Long.valueOf(left.longValue() * right.longValue()); default: - return new Double(left.doubleValue() * right.doubleValue()); + return Double.valueOf(left.doubleValue() * right.doubleValue()); } } protected Number divide(Number left, Number right) { - return new Double(left.doubleValue() / right.doubleValue()); + return Double.valueOf(left.doubleValue() / right.doubleValue()); } protected Number mod(Number left, Number right) { - return new Double(left.doubleValue() % right.doubleValue()); + return Double.valueOf(left.doubleValue() % right.doubleValue()); } private int numberType(Number left, Number right) { diff --git a/activemq-client/src/main/java/org/apache/activemq/filter/ComparisonExpression.java b/activemq-client/src/main/java/org/apache/activemq/filter/ComparisonExpression.java index 4bb62de95e..f87ed13e79 100644 --- a/activemq-client/src/main/java/org/apache/activemq/filter/ComparisonExpression.java +++ b/activemq-client/src/main/java/org/apache/activemq/filter/ComparisonExpression.java @@ -116,7 +116,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B regexp.append(".*?"); // Do a non-greedy match } else if (c == '_') { regexp.append("."); // match one - } else if (REGEXP_CONTROL_CHARS.contains(new Character(c))) { + } else if (REGEXP_CONTROL_CHARS.contains(Character.valueOf(c))) { regexp.append("\\x"); regexp.append(Integer.toHexString(0xFFFF & c)); } else { @@ -387,9 +387,9 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } else if (rc == Long.class) { lv = Long.valueOf(((Number)lv).longValue()); } else if (rc == Float.class) { - lv = new Float(((Number)lv).floatValue()); + lv = Float.valueOf(((Number)lv).floatValue()); } else if (rc == Double.class) { - lv = new Double(((Number)lv).doubleValue()); + lv = Double.valueOf(((Number)lv).doubleValue()); } else if (convertStringExpressions && rc == String.class) { rv = Byte.valueOf((String)rv); } else { @@ -401,9 +401,9 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } else if (rc == Long.class) { lv = Long.valueOf(((Number)lv).longValue()); } else if (rc == Float.class) { - lv = new Float(((Number)lv).floatValue()); + lv = Float.valueOf(((Number)lv).floatValue()); } else if (rc == Double.class) { - lv = new Double(((Number)lv).doubleValue()); + lv = Double.valueOf(((Number)lv).doubleValue()); } else if (convertStringExpressions && rc == String.class) { rv = Short.valueOf((String)rv); } else { @@ -413,9 +413,9 @@ public abstract class ComparisonExpression extends BinaryExpression implements B if (rc == Long.class) { lv = Long.valueOf(((Number)lv).longValue()); } else if (rc == Float.class) { - lv = new Float(((Number)lv).floatValue()); + lv = Float.valueOf(((Number)lv).floatValue()); } else if (rc == Double.class) { - lv = new Double(((Number)lv).doubleValue()); + lv = Double.valueOf(((Number)lv).doubleValue()); } else if (convertStringExpressions && rc == String.class) { rv = Integer.valueOf((String)rv); } else { @@ -425,9 +425,9 @@ public abstract class ComparisonExpression extends BinaryExpression implements B if (rc == Integer.class) { rv = Long.valueOf(((Number)rv).longValue()); } else if (rc == Float.class) { - lv = new Float(((Number)lv).floatValue()); + lv = Float.valueOf(((Number)lv).floatValue()); } else if (rc == Double.class) { - lv = new Double(((Number)lv).doubleValue()); + lv = Double.valueOf(((Number)lv).doubleValue()); } else if (convertStringExpressions && rc == String.class) { rv = Long.valueOf((String)rv); } else { @@ -435,11 +435,11 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } } else if (lc == Float.class) { if (rc == Integer.class) { - rv = new Float(((Number)rv).floatValue()); + rv = Float.valueOf(((Number)rv).floatValue()); } else if (rc == Long.class) { - rv = new Float(((Number)rv).floatValue()); + rv = Float.valueOf(((Number)rv).floatValue()); } else if (rc == Double.class) { - lv = new Double(((Number)lv).doubleValue()); + lv = Double.valueOf(((Number)lv).doubleValue()); } else if (convertStringExpressions && rc == String.class) { rv = Float.valueOf((String)rv); } else { @@ -447,9 +447,9 @@ public abstract class ComparisonExpression extends BinaryExpression implements B } } else if (lc == Double.class) { if (rc == Integer.class) { - rv = new Double(((Number)rv).doubleValue()); + rv = Double.valueOf(((Number)rv).doubleValue()); } else if (rc == Long.class) { - rv = new Double(((Number)rv).doubleValue()); + rv = Double.valueOf(((Number)rv).doubleValue()); } else if (rc == Float.class) { rv = new Float(((Number)rv).doubleValue()); } else if (convertStringExpressions && rc == String.class) { diff --git a/activemq-client/src/main/java/org/apache/activemq/filter/ConstantExpression.java b/activemq-client/src/main/java/org/apache/activemq/filter/ConstantExpression.java index d362300d3a..47c1a5e0a5 100644 --- a/activemq-client/src/main/java/org/apache/activemq/filter/ConstantExpression.java +++ b/activemq-client/src/main/java/org/apache/activemq/filter/ConstantExpression.java @@ -57,7 +57,7 @@ public class ConstantExpression implements Expression { Number value; try { - value = new Long(text); + value = Long.valueOf(text); } catch (NumberFormatException e) { // The number may be too big to fit in a long. value = new BigDecimal(text); @@ -89,7 +89,7 @@ public class ConstantExpression implements Expression { } public static ConstantExpression createFloat(String text) { - Number value = new Double(text); + Number value = Double.valueOf(text); return new ConstantExpression(value); } diff --git a/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java b/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java index 964a81d695..730a1b1df5 100644 --- a/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java +++ b/activemq-client/src/main/java/org/apache/activemq/filter/PropertyExpression.java @@ -157,7 +157,7 @@ public class PropertyExpression implements Expression { @Override public Object evaluate(Message message) { - return new Integer(message.getGroupSequence()); + return Integer.valueOf(message.getGroupSequence()); } }); JMS_PROPERTY_EXPRESSIONS.put("JMSXProducerTXID", new SubExpression() { diff --git a/activemq-client/src/main/java/org/apache/activemq/filter/UnaryExpression.java b/activemq-client/src/main/java/org/apache/activemq/filter/UnaryExpression.java index 9002a2cd1b..c5d0606ef0 100644 --- a/activemq-client/src/main/java/org/apache/activemq/filter/UnaryExpression.java +++ b/activemq-client/src/main/java/org/apache/activemq/filter/UnaryExpression.java @@ -181,13 +181,13 @@ public abstract class UnaryExpression implements Expression { private static Number negate(Number left) { Class clazz = left.getClass(); if (clazz == Integer.class) { - return new Integer(-left.intValue()); + return Integer.valueOf(-left.intValue()); } else if (clazz == Long.class) { - return new Long(-left.longValue()); + return Long.valueOf(-left.longValue()); } else if (clazz == Float.class) { - return new Float(-left.floatValue()); + return Float.valueOf(-left.floatValue()); } else if (clazz == Double.class) { - return new Double(-left.doubleValue()); + return Double.valueOf(-left.doubleValue()); } else if (clazz == BigDecimal.class) { // We ussually get a big deciamal when we have Long.MIN_VALUE // constant in the diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java b/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java index c1297a24d1..a28ea64bc2 100644 --- a/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java +++ b/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java @@ -520,13 +520,13 @@ public final class OpenWireFormat implements WireFormat { // We can only cache that item if there is space left. if (marshallCacheMap.size() < marshallCache.length) { marshallCache[i] = o; - Short index = new Short(i); + Short index = Short.valueOf(i); marshallCacheMap.put(o, index); return index; } else { // Use -1 to indicate that the value was not cached due to cache // being full. - return new Short((short)-1); + return Short.valueOf((short)-1); } } diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java index b2c997ea73..94ba66d405 100644 --- a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java +++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java @@ -201,7 +201,7 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller { .newInstance(new Object[] {tightUnmarshalString(dataIn, bs), tightUnmarshalString(dataIn, bs), tightUnmarshalString(dataIn, bs), - new Integer(dataIn.readInt())}); + Integer.valueOf(dataIn.readInt())}); } catch (IOException e) { throw e; } catch (Throwable e) { @@ -522,7 +522,7 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller { .newInstance(new Object[] {looseUnmarshalString(dataIn), looseUnmarshalString(dataIn), looseUnmarshalString(dataIn), - new Integer(dataIn.readInt())}); + Integer.valueOf(dataIn.readInt())}); } catch (IOException e) { throw e; } catch (Throwable e) { diff --git a/activemq-client/src/main/java/org/apache/activemq/state/ConnectionState.java b/activemq-client/src/main/java/org/apache/activemq/state/ConnectionState.java index fb663d7114..5ebf33ae3f 100644 --- a/activemq-client/src/main/java/org/apache/activemq/state/ConnectionState.java +++ b/activemq-client/src/main/java/org/apache/activemq/state/ConnectionState.java @@ -20,7 +20,6 @@ package org.apache.activemq.state; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/RequestTimedOutIOException.java b/activemq-client/src/main/java/org/apache/activemq/transport/RequestTimedOutIOException.java index 1191735db1..3f32ebd4eb 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/RequestTimedOutIOException.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/RequestTimedOutIOException.java @@ -23,4 +23,6 @@ import java.io.IOException; * a reply or response is received */ public class RequestTimedOutIOException extends IOException { + + private static final long serialVersionUID = -5938342624821415513L; } diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java b/activemq-client/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java index ad18ea6142..6d12d8f2c8 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java @@ -69,7 +69,7 @@ public class ResponseCorrelator extends TransportFilter { synchronized (requestMap) { priorError = this.error; if (priorError == null) { - requestMap.put(new Integer(command.getCommandId()), future); + requestMap.put(Integer.valueOf(command.getCommandId()), future); } } diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java b/activemq-client/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java index 99c2e80ea0..db18dccd00 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java @@ -18,8 +18,6 @@ package org.apache.activemq.transport.discovery; import java.io.IOException; -import javax.jms.JMSException; - import org.apache.activemq.Service; import org.apache.activemq.command.DiscoveryEvent; diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java b/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java index 91310c5a92..14b5b16e70 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java @@ -19,7 +19,6 @@ package org.apache.activemq.transport.failover; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.util.HashMap; import java.util.Map; import org.apache.activemq.transport.MutexTransport; import org.apache.activemq.transport.ResponseCorrelator; diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java b/activemq-client/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java index d7f4f85ef3..4935029309 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java @@ -115,7 +115,7 @@ public class FanoutTransport implements CompositeTransport { public void onCommand(Object o) { Command command = (Command) o; if (command.isResponse()) { - Integer id = new Integer(((Response) command).getCorrelationId()); + Integer id = Integer.valueOf(((Response) command).getCorrelationId()); RequestCounter rc = requestMap.get(id); if (rc != null) { if (rc.ackCount.decrementAndGet() <= 0) { @@ -403,7 +403,7 @@ public class FanoutTransport implements CompositeTransport { boolean fanout = isFanoutCommand(command); if (stateTracker.track(command) == null && command.isResponseRequired()) { int size = fanout ? minAckCount : 1; - requestMap.put(new Integer(command.getCommandId()), new RequestCounter(command, size)); + requestMap.put(Integer.valueOf(command.getCommandId()), new RequestCounter(command, size)); } // Send the message. diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java b/activemq-client/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java index cc5568577c..e35842e3d8 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java @@ -19,7 +19,6 @@ package org.apache.activemq.transport.fanout; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.util.HashMap; import java.util.Map; import org.apache.activemq.transport.MutexTransport; diff --git a/activemq-client/src/main/java/org/apache/activemq/util/MarshallingSupport.java b/activemq-client/src/main/java/org/apache/activemq/util/MarshallingSupport.java index f2907312e7..4962cf7787 100644 --- a/activemq-client/src/main/java/org/apache/activemq/util/MarshallingSupport.java +++ b/activemq-client/src/main/java/org/apache/activemq/util/MarshallingSupport.java @@ -184,10 +184,10 @@ public final class MarshallingSupport { value = Long.valueOf(in.readLong()); break; case FLOAT_TYPE: - value = new Float(in.readFloat()); + value = Float.valueOf(in.readFloat()); break; case DOUBLE_TYPE: - value = new Double(in.readDouble()); + value = Double.valueOf(in.readDouble()); break; case BYTE_ARRAY_TYPE: value = new byte[in.readInt()]; diff --git a/activemq-client/src/main/java/org/apache/activemq/util/TypeConversionSupport.java b/activemq-client/src/main/java/org/apache/activemq/util/TypeConversionSupport.java index d84f94ac87..6ece357a69 100644 --- a/activemq-client/src/main/java/org/apache/activemq/util/TypeConversionSupport.java +++ b/activemq-client/src/main/java/org/apache/activemq/util/TypeConversionSupport.java @@ -178,7 +178,7 @@ public final class TypeConversionSupport { CONVERSION_MAP.put(new ConversionKey(Float.class, Double.class), new Converter() { @Override public Object convert(Object value) { - return new Double(((Number)value).doubleValue()); + return Double.valueOf(((Number)value).doubleValue()); } }); CONVERSION_MAP.put(new ConversionKey(String.class, ActiveMQDestination.class), new Converter() { diff --git a/activemq-client/src/test/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStreamTest.java b/activemq-client/src/test/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStreamTest.java index a30d81330b..2e3e919ee4 100644 --- a/activemq-client/src/test/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStreamTest.java +++ b/activemq-client/src/test/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStreamTest.java @@ -321,7 +321,7 @@ public class ClassLoadingAwareObjectInputStreamTest { } // Replace the filtered type and try again - value[3] = new Integer(20); + value[3] = Integer.valueOf(20); serialized = serializeObject(value); diff --git a/activemq-client/src/test/java/org/apache/activemq/util/LRUCacheTest.java b/activemq-client/src/test/java/org/apache/activemq/util/LRUCacheTest.java index 0dd5e31db5..67761b2678 100644 --- a/activemq-client/src/test/java/org/apache/activemq/util/LRUCacheTest.java +++ b/activemq-client/src/test/java/org/apache/activemq/util/LRUCacheTest.java @@ -29,7 +29,7 @@ public class LRUCacheTest { public void testResize() throws Exception { LRUCache underTest = new LRUCache(1000); - Long count = new Long(0); + Long count = Long.valueOf(0); long max = 0; for (; count < 27276827; count++) { long start = System.currentTimeMillis(); diff --git a/activemq-http/src/test/java/org/apache/activemq/transport/http/HttpJMSMessagesWithCompressionTest.java b/activemq-http/src/test/java/org/apache/activemq/transport/http/HttpJMSMessagesWithCompressionTest.java index a86c6c2b84..15d671e348 100644 --- a/activemq-http/src/test/java/org/apache/activemq/transport/http/HttpJMSMessagesWithCompressionTest.java +++ b/activemq-http/src/test/java/org/apache/activemq/transport/http/HttpJMSMessagesWithCompressionTest.java @@ -187,7 +187,7 @@ public class HttpJMSMessagesWithCompressionTest { @Test public void testObjectMessage() throws Exception { executeTest(new MessageCommand() { - private Long value = new Long(101); + private Long value = Long.valueOf(101); public ObjectMessage createMessage(Session session) throws JMSException { return session.createObjectMessage(value); @@ -202,7 +202,7 @@ public class HttpJMSMessagesWithCompressionTest { @Test public void testStreamMessage() throws Exception { executeTest(new MessageCommand() { - private Long value = new Long(1013); + private Long value = Long.valueOf(1013); public StreamMessage createMessage(Session session) throws JMSException { StreamMessage message = session.createStreamMessage(); diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java index 4f36487fdc..071bb6ba8b 100644 --- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java +++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java @@ -109,7 +109,7 @@ public class PooledConnectionFactoryMaximumActiveTest extends JmsPoolTestSupport if (PooledConnectionFactoryMaximumActiveTest.conn == null) { TASK_LOG.error("Connection not yet initialized. Aborting test."); - return new Boolean(false); + return Boolean.FALSE; } one = PooledConnectionFactoryMaximumActiveTest.conn.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -118,7 +118,7 @@ public class PooledConnectionFactoryMaximumActiveTest extends JmsPoolTestSupport Thread.sleep(2 * PooledConnectionFactoryMaximumActiveTest.sleepTimeout); } catch (Exception ex) { TASK_LOG.error(ex.getMessage()); - return new Boolean(false); + return Boolean.FALSE; } finally { if (one != null) try { @@ -129,7 +129,7 @@ public class PooledConnectionFactoryMaximumActiveTest extends JmsPoolTestSupport } // all good, test succeeded - return new Boolean(true); + return Boolean.TRUE; } } } diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java index a13f3129d8..7e1c653d97 100644 --- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java +++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java @@ -381,14 +381,14 @@ public class PooledConnectionFactoryTest extends JmsPoolTestSupport { fail("seconds call to Connection.createSession() was supposed" + "to raise an JMSException as internal session pool" + "is exhausted. This did not happen and indiates a problem"); - return new Boolean(false); + return Boolean.FALSE; } catch (JMSException ex) { if (ex.getCause().getClass() == java.util.NoSuchElementException.class) { // expected, ignore but log LOG.info("Caught expected " + ex); } else { LOG.error(ex); - return new Boolean(false); + return Boolean.FALSE; } } finally { if (one != null) { @@ -400,7 +400,7 @@ public class PooledConnectionFactoryTest extends JmsPoolTestSupport { } } catch (Exception ex) { LOG.error(ex.getMessage()); - return new Boolean(false); + return Boolean.FALSE; } finally { if (cf != null) { cf.stop(); @@ -408,7 +408,7 @@ public class PooledConnectionFactoryTest extends JmsPoolTestSupport { } // all good, test succeeded - return new Boolean(true); + return Boolean.FALSE; } } } diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java index 886695b810..a41c15a75b 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java @@ -3866,7 +3866,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe void setBatch(Transaction tx, Long sequence) throws IOException { if (sequence != null) { - Long nextPosition = new Long(sequence.longValue() + 1); + Long nextPosition = Long.valueOf(sequence.longValue() + 1); lastDefaultKey = sequence; cursor.defaultCursorPosition = nextPosition.longValue(); lastHighKey = sequence; diff --git a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java index 614242e832..b41f3c9a5b 100644 --- a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java +++ b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java @@ -342,7 +342,7 @@ public class JournalCorruptionEofIndexRecoveryTest { private void corruptLocation(Location toCorrupt) throws IOException { - DataFile dataFile = ((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).getStore().getJournal().getFileMap().get(new Integer(toCorrupt.getDataFileId())); + DataFile dataFile = ((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).getStore().getJournal().getFileMap().get(Integer.valueOf(toCorrupt.getDataFileId())); RecoverableRandomAccessFile randomAccessFile = dataFile.openRandomAccessFile(); diff --git a/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/tool/JMSMemtest.java b/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/tool/JMSMemtest.java index cc7dfbc8d4..1cf2ef1938 100644 --- a/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/tool/JMSMemtest.java +++ b/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/tool/JMSMemtest.java @@ -82,16 +82,16 @@ public class JMSMemtest { 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.parseBoolean(settings.getProperty("topic")); + durable = Boolean.parseBoolean(settings.getProperty("durable")); + 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"); @@ -290,17 +290,17 @@ public class JMSMemtest { Properties settings = new Properties(); settings.setProperty("domain", topic ? "topic" : "queue"); settings.setProperty("durable", durable ? "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; } diff --git a/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/tool/MemoryMonitoringTool.java b/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/tool/MemoryMonitoringTool.java index 31d2a4623c..c4aa99abfe 100644 --- a/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/tool/MemoryMonitoringTool.java +++ b/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/tool/MemoryMonitoringTool.java @@ -67,7 +67,7 @@ public class MemoryMonitoringTool implements Runnable { public Thread startMonitor() { String intervalStr = this.getTestSettings().getProperty("checkpoint_interval"); - checkpointInterval = new Integer(intervalStr).intValue(); + checkpointInterval = Integer.valueOf(intervalStr).intValue(); this.getTestSettings().remove("checkpoint_interval"); memoryBean = ManagementFactory.getMemoryMXBean(); diff --git a/activemq-web/src/main/java/org/apache/activemq/web/PortfolioPublishServlet.java b/activemq-web/src/main/java/org/apache/activemq/web/PortfolioPublishServlet.java index 513009cc2a..6ad9f011a3 100644 --- a/activemq-web/src/main/java/org/apache/activemq/web/PortfolioPublishServlet.java +++ b/activemq-web/src/main/java/org/apache/activemq/web/PortfolioPublishServlet.java @@ -102,12 +102,12 @@ public class PortfolioPublishServlet extends MessageServletSupport { protected String createStockText(String stock) { Double value = LAST_PRICES.get(stock); if (value == null) { - value = new Double(Math.random() * 100); + value = Double.valueOf(Math.random() * 100); } // lets mutate the value by some percentage double oldPrice = value.doubleValue(); - value = new Double(mutatePrice(oldPrice)); + value = Double.valueOf(mutatePrice(oldPrice)); LAST_PRICES.put(stock, value); double price = value.doubleValue();