From 30c617da3c14885b3a81732e23c42889387a3f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 25 Aug 2016 12:07:24 +0300 Subject: [PATCH 1/7] Unnecessary @SuppressWarnings fixes --- .../apache/activemq/artemis/jms/client/ActiveMQMessage.java | 3 +-- .../activemq/artemis/jms/client/ActiveMQObjectMessage.java | 2 +- .../activemq/artemis/jms/client/ActiveMQStreamMessage.java | 1 - .../core/protocol/proton/converter/ActiveMQJMSVendor.java | 1 - .../artemis/ra/ActiveMQRAManagedConnectionFactory.java | 2 +- .../org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java | 1 - .../java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java | 3 +-- .../org/apache/activemq/transport/tcp/TcpTransportFactory.java | 1 - 8 files changed, 4 insertions(+), 10 deletions(-) diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java index ab9e311b97..78acdb78e5 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java @@ -609,7 +609,6 @@ public class ActiveMQMessage implements javax.jms.Message { return val; } - @SuppressWarnings("rawtypes") @Override public Enumeration getPropertyNames() throws JMSException { return Collections.enumeration(MessageUtil.getPropertyNames(message)); @@ -771,7 +770,7 @@ public class ActiveMQMessage implements javax.jms.Message { } @Override - public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) { + public boolean isBodyAssignableTo(Class c) { /** * From the specs: *

diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java index 0e6bbda2f8..a149dbd024 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQObjectMessage.java @@ -176,7 +176,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess } @Override - public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) { + public boolean isBodyAssignableTo(Class c) { if (data == null) // we have no body return true; try { diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java index 4b3f5c358c..1c7772cc6b 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQStreamMessage.java @@ -394,7 +394,6 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre return message.getBodyBuffer(); } - @SuppressWarnings("rawtypes") @Override public boolean isBodyAssignableTo(Class c) { return false; diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/ActiveMQJMSVendor.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/ActiveMQJMSVendor.java index ed887cfff2..3cfb0a559b 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/ActiveMQJMSVendor.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/ActiveMQJMSVendor.java @@ -81,7 +81,6 @@ public class ActiveMQJMSVendor implements JMSVendor { } @Override - @SuppressWarnings("deprecation") public Destination createDestination(String name) { return new ServerDestination(name); } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java index 73b443f100..a3e5f4cb82 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java @@ -184,7 +184,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * @throws ResourceException Thrown if the managed connection can not be found */ @Override - public ManagedConnection matchManagedConnections(@SuppressWarnings("rawtypes") final Set connectionSet, + public ManagedConnection matchManagedConnections(final Set connectionSet, final Subject subject, final ConnectionRequestInfo cxRequestInfo) throws ResourceException { if (ActiveMQRAManagedConnectionFactory.trace) { diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java index c22cc8d9c3..0b2cb6111b 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java @@ -181,7 +181,6 @@ public class ActiveMQRAMapMessage extends ActiveMQRAMessage implements MapMessag * @throws JMSException Thrown if an error occurs */ @Override - @SuppressWarnings("rawtypes") public Enumeration getMapNames() throws JMSException { if (ActiveMQRAMapMessage.trace) { ActiveMQRALogger.LOGGER.trace("getMapNames()"); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java index 7872459d62..d0600097ac 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java @@ -384,7 +384,6 @@ public class ActiveMQRAMessage implements Message { * @throws JMSException Thrown if an error occurs */ @Override - @SuppressWarnings("rawtypes") public Enumeration getPropertyNames() throws JMSException { if (ActiveMQRAMessage.trace) { ActiveMQRALogger.LOGGER.trace("getPropertyNames()"); @@ -776,7 +775,7 @@ public class ActiveMQRAMessage implements Message { } @Override - public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) throws JMSException { + public boolean isBodyAssignableTo(Class c) throws JMSException { if (ActiveMQRAMessage.trace) { ActiveMQRALogger.LOGGER.trace("isBodyAssignableTo(" + c + ")"); } diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java index a81f9aa1b3..1d102805a6 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java @@ -108,7 +108,6 @@ public class TcpTransportFactory extends TransportFactory { } @Override - @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { TcpTransport tcpTransport = transport.narrow(TcpTransport.class); From 9d0dcf7f63904928f1c69e110647d75b241b37d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 25 Aug 2016 12:08:08 +0300 Subject: [PATCH 2/7] Unchecked warning suppression fixes --- .../activemq/artemis/jms/client/ActiveMQBytesMessage.java | 3 ++- .../apache/activemq/artemis/jms/client/ActiveMQMapMessage.java | 3 ++- .../activemq/artemis/jms/client/ActiveMQTextMessage.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQBytesMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQBytesMessage.java index e1707015ec..b585caf046 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQBytesMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQBytesMessage.java @@ -378,7 +378,8 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag } @Override - public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) { + @SuppressWarnings("unchecked") + public boolean isBodyAssignableTo(Class c) { return c.isAssignableFrom(byte[].class); } diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java index d067593b1c..a80d550f7b 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java @@ -384,7 +384,8 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess } @Override - public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) { + @SuppressWarnings("unchecked") + public boolean isBodyAssignableTo(Class c) { if (hasNoBody()) { return true; } diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java index aa3633632e..7d84bd4644 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java @@ -120,7 +120,8 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage } @Override - public boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class c) { + @SuppressWarnings("unchecked") + public boolean isBodyAssignableTo(ctiClass c) { if (text == null) return true; return c.isAssignableFrom(java.lang.String.class); From d57378f2afba056b0f97daf35d27d11ba5dd0213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 25 Aug 2016 12:08:39 +0300 Subject: [PATCH 3/7] Missing @Override fixes --- .../artemis/jms/client/ActiveMQConnectionFactory.java | 4 ++++ .../activemq/artemis/core/server/impl/ActiveMQServerImpl.java | 1 + 2 files changed, 5 insertions(+) diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java index 183745d555..ce531f5063 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java @@ -154,18 +154,22 @@ public class ActiveMQConnectionFactory implements ConnectionFactoryOptions, Exte } } + @Override public String getDeserializationBlackList() { return deserializationBlackList; } + @Override public void setDeserializationBlackList(String blackList) { this.deserializationBlackList = blackList; } + @Override public String getDeserializationWhiteList() { return deserializationWhiteList; } + @Override public void setDeserializationWhiteList(String whiteList) { this.deserializationWhiteList = whiteList; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index 25511b0ba9..dba7e5bfe7 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -381,6 +381,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { this.serviceRegistry = serviceRegistry == null ? new ServiceRegistryImpl() : serviceRegistry; } + @Override public ReloadManager getReloadManager() { return reloadManager; } From 8c6e04474521399112f416da55be522560198398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 25 Aug 2016 12:31:57 +0300 Subject: [PATCH 4/7] Potential resource leak fixes --- .../artemis/jdbc/store/JDBCUtils.java | 5 +++-- .../file/JDBCSequentialFileFactoryDriver.java | 5 +++-- .../jms/server/impl/JMSServerManagerImpl.java | 6 ++++-- .../core/config/impl/ConfigurationImpl.java | 10 ++++------ .../artemis/tests/util/ActiveMQTestBase.java | 20 ++----------------- 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java index 61293af59f..69747c9340 100644 --- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java +++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java @@ -70,8 +70,9 @@ public class JDBCUtils { try (ResultSet rs = connection.getMetaData().getTables(null, null, tableName, null)) { if (rs != null && !rs.next()) { logger.tracef("Table %s did not exist, creating it with SQL=%s", tableName, sql); - Statement statement = connection.createStatement(); - statement.executeUpdate(sql); + try (Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } } } connection.commit(); diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java index 0ce65db697..8937992430 100644 --- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java +++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java @@ -294,8 +294,9 @@ public class JDBCSequentialFileFactoryDriver extends AbstractJDBCDriver { public synchronized void destroy() throws SQLException { try { connection.setAutoCommit(false); - Statement statement = connection.createStatement(); - statement.executeUpdate(sqlProvider.getDropFileTableSQL()); + try (Statement statement = connection.createStatement()) { + statement.executeUpdate(sqlProvider.getDropFileTableSQL()); + } connection.commit(); } catch (SQLException e) { diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java index 8e313a3354..392a7d9986 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java @@ -1764,8 +1764,10 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback ActiveMQServerLogger.LOGGER.reloadingConfiguration("jms"); InputStream input = url.openStream(); - Reader reader = new InputStreamReader(input); - String xml = XMLUtil.readerToString(reader); + String xml; + try (Reader reader = new InputStreamReader(input)) { + xml = XMLUtil.readerToString(reader); + } xml = XMLUtil.replaceSystemProps(xml); Element e = XMLUtil.stringToElement(xml); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java index 216348c6e4..0604c44097 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java @@ -1332,15 +1332,13 @@ public class ConfigurationImpl implements Configuration, Serializable { @Override public String debugConnectors() { StringWriter stringWriter = new StringWriter(); - PrintWriter writer = new PrintWriter(stringWriter); - - for (Map.Entry connector : getConnectorConfigurations().entrySet()) { - writer.println("Connector::" + connector.getKey() + " value = " + connector.getValue()); + try (PrintWriter writer = new PrintWriter(stringWriter)) { + for (Map.Entry connector : getConnectorConfigurations().entrySet()) { + writer.println("Connector::" + connector.getKey() + " value = " + connector.getValue()); + } } - writer.close(); - return stringWriter.toString(); } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index f9a9535f77..761af7d948 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -2103,30 +2103,14 @@ public abstract class ActiveMQTestBase extends Assert { } } else { - InputStream in = null; - - OutputStream out = null; - - try { - in = new BufferedInputStream(new FileInputStream(from)); - - out = new BufferedOutputStream(new FileOutputStream(to)); - + try (InputStream in = new BufferedInputStream(new FileInputStream(from)); + OutputStream out = new BufferedOutputStream(new FileOutputStream(to))) { int b; while ((b = in.read()) != -1) { out.write(b); } } - finally { - if (in != null) { - in.close(); - } - - if (out != null) { - out.close(); - } - } } } From e1728f07976c870f5c6bf55d4b8afd363b7e3edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 25 Aug 2016 12:53:30 +0300 Subject: [PATCH 5/7] Spelling fixes --- .../spi/core/protocol/RemotingConnection.java | 2 +- .../artemis/util/CompressionUtilTest.java | 32 +++++++++---------- .../apache/activemq/artemis/dto/XmlUtil.java | 2 +- ...e_activemq_artemis_jlibaio_LibaioContext.c | 2 +- .../converter/jms/ServerDestination.java | 2 +- .../protocol/openwire/OpenWireConnection.java | 2 +- .../artemis/rest/queue/PostMessageNoDups.java | 4 +-- .../artemis/core/server/impl/QueueImpl.java | 3 +- .../impl/SharedNothingLiveActivation.java | 2 +- .../spi/core/protocol/ProtocolManager.java | 2 +- docs/hacking-guide/en/ide.md | 4 +-- docs/user-manual/en/aerogear-integration.md | 2 +- docs/user-manual/en/vertx-integration.md | 2 +- .../example/HAPolicyAutoBackupExample.java | 2 +- .../artemis/jms/example/PerfBase.java | 2 +- .../artemis/jms/soak/example/SoakBase.java | 2 +- .../aerogear/ActiveMQAeroGearLogger.java | 2 +- pom.xml | 2 +- .../activemq/EmbeddedBrokerTestSupport.java | 2 +- .../org/apache/activemq/OptimizedAckTest.java | 2 +- .../activemq/security/SecurityJMXTest.java | 2 +- .../failover/FailoverTransactionTest.java | 2 +- .../NonBlockingConsumerRedeliveryTest.java | 6 ++-- .../usecases/StartAndStopBrokerTest.java | 2 +- .../jms/tests/tools/container/Server.java | 2 +- .../connection/TopicConnectionTest.java | 2 +- 26 files changed, 45 insertions(+), 46 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java index 0f16db7c17..0f5abf3af9 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java @@ -105,7 +105,7 @@ public interface RemotingConnection extends BufferHandler { /** * set the failure listeners. *

- * These will be called in the event of the connection being closed. Any previosuly added listeners will be removed. + * These will be called in the event of the connection being closed. Any previously added listeners will be removed. * * @param listeners the listeners to add. */ diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java index 71e2ce0a95..e864822821 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java @@ -60,10 +60,10 @@ public class CompressionUtilTest extends Assert { } byte[] output = new byte[30]; - Deflater compresser = new Deflater(); - compresser.setInput(input); - compresser.finish(); - int compressedDataLength = compresser.deflate(output); + Deflater compressor = new Deflater(); + compressor.setInput(input); + compressor.finish(); + int compressedDataLength = compressor.deflate(output); compareByteArray(allCompressed, output, compressedDataLength); } @@ -97,10 +97,10 @@ public class CompressionUtilTest extends Assert { } byte[] output = new byte[30]; - Deflater compresser = new Deflater(); - compresser.setInput(input); - compresser.finish(); - int compressedDataLength = compresser.deflate(output); + Deflater compressor = new Deflater(); + compressor.setInput(input); + compressor.finish(); + int compressedDataLength = compressor.deflate(output); compareByteArray(allCompressed, output, compressedDataLength); } @@ -110,10 +110,10 @@ public class CompressionUtilTest extends Assert { String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla"; byte[] input = inputString.getBytes(StandardCharsets.UTF_8); byte[] output = new byte[30]; - Deflater compresser = new Deflater(); - compresser.setInput(input); - compresser.finish(); - int compressedDataLength = compresser.deflate(output); + Deflater compressor = new Deflater(); + compressor.setInput(input); + compressor.finish(); + int compressedDataLength = compressor.deflate(output); byte[] zipBytes = new byte[compressedDataLength]; @@ -146,10 +146,10 @@ public class CompressionUtilTest extends Assert { String inputString = "blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla"; byte[] input = inputString.getBytes(StandardCharsets.UTF_8); byte[] output = new byte[30]; - Deflater compresser = new Deflater(); - compresser.setInput(input); - compresser.finish(); - int compressedDataLength = compresser.deflate(output); + Deflater compressor = new Deflater(); + compressor.setInput(input); + compressor.finish(); + int compressedDataLength = compressor.deflate(output); byte[] zipBytes = new byte[compressedDataLength]; diff --git a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java index f4744533d0..fa0ff9aef4 100644 --- a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java +++ b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/XmlUtil.java @@ -79,7 +79,7 @@ public class XmlUtil { return decode(clazz, configuration, null, null); } - /** We offer parameters for artemisInstance and artemisHoms as they could be coming from the CLI or Maven Plugin */ + /** We offer parameters for artemisInstance and artemisHome as they could be coming from the CLI or Maven Plugin */ public static T decode(Class clazz, File configuration, String artemisHome, String artemisInstance) throws Exception { JAXBContext jaxbContext = JAXBContext.newInstance("org.apache.activemq.artemis.dto"); diff --git a/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c b/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c index 860d192644..74545fc508 100644 --- a/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c +++ b/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c @@ -48,7 +48,7 @@ struct io_control { pthread_mutex_t pollLock; - // a resuable pool of iocb + // a reusable pool of iocb struct iocb ** iocb; int queueSize; int iocbPut; diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/jms/ServerDestination.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/jms/ServerDestination.java index ab26264223..0a8bb293e1 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/jms/ServerDestination.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/jms/ServerDestination.java @@ -22,7 +22,7 @@ import javax.jms.JMSException; import javax.jms.Queue; /** - * This is just here to avoid all the client checks we ned with valid JMS destinations, protocol convertors don't need to + * This is just here to avoid all the client checks we need with valid JMS destinations, protocol convertors don't need to * adhere to the jms. semantics. */ public class ServerDestination extends ActiveMQDestination implements Queue { diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java index 7c52b279d0..8f53bdb093 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java @@ -477,7 +477,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se if (context.isReconnect() || (context.isNetworkConnection())) { // once implemented ARTEMIS-194, we need to set the storedSequenceID here somehow // We have different semantics on Artemis Journal, but we could adapt something for this - // TBD during the implemetnation of ARTEMIS-194 + // TBD during the implementation of ARTEMIS-194 result.setLastStoredSequenceId(0); } SessionState ss = state.getSessionState(id.getParentId()); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/PostMessageNoDups.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/PostMessageNoDups.java index b2b34e2ab5..9c3a88d875 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/PostMessageNoDups.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/PostMessageNoDups.java @@ -24,7 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; /** - * implements reliable "create", "create-next" pattern defined by REST-* Messaging specificaiton + * implements reliable "create", "create-next" pattern defined by REST-* Messaging specification */ public class PostMessageNoDups extends PostMessage { @@ -37,4 +37,4 @@ public class PostMessageNoDups extends PostMessage { res.location(uriInfo.getAbsolutePathBuilder().path(id).build()); return res.build(); } -} \ No newline at end of file +} diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index dfcba279ea..1514748ac1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -615,7 +615,7 @@ public class QueueImpl implements Queue { } if (logger.isTraceEnabled()) { - logger.trace("Force delivery deliverying async"); + logger.trace("Force delivery delivering async"); } deliverAsync(); @@ -3045,4 +3045,3 @@ public class QueueImpl implements Queue { } } } - diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java index f17bcc5693..938f5dd3b7 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java @@ -304,7 +304,7 @@ public class SharedNothingLiveActivation extends LiveActivation { NodeManager nodeManagerInUse = activeMQServer.getNodeManager(); if (nodeManagerInUse != null) { - //todo does this actually make any difference, we only set a different flag in the lock file which replication doesnt use + //todo does this actually make any difference, we only set a different flag in the lock file which replication doesn't use if (permanently) { nodeManagerInUse.crashLiveServer(); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/ProtocolManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/ProtocolManager.java index 62befaf8fc..3d5be393fc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/ProtocolManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/ProtocolManager.java @@ -56,7 +56,7 @@ public interface ProtocolManager

{ MessageConverter getConverter(); /** If this protocols accepts connectoins without an initial handshake. - * If true this protocol will be the failback case no other conenctions are made. + * If true this protocol will be the failback case no other connections are made. * New designed protocols should always require a handshake. This is only useful for legacy protocols. */ boolean acceptsNoHandshake(); diff --git a/docs/hacking-guide/en/ide.md b/docs/hacking-guide/en/ide.md index 8853780251..c96ccef61c 100644 --- a/docs/hacking-guide/en/ide.md +++ b/docs/hacking-guide/en/ide.md @@ -49,7 +49,7 @@ imported properly. To (re)import the "tests" Maven profile in an existing proje * Open the Maven Projects Tool Window: View -> Tool Windows -> Maven Projects * Select the "profiles" drop down * Unselect then reselect the checkbox next to "tests". -* Click on the "Reimport all maven projects" button in the top left hand corner of the window. (It looks like a ciruclar +* Click on the "Reimport all maven projects" button in the top left hand corner of the window. (It looks like a circular blue arrow. * Wait for IDEA to reload and try running a JUnit test again. The option to run should now be present. @@ -94,4 +94,4 @@ Importing all ActiveMQ Artemis subprojects will create _too many_ projects in Ec and _Project Explorer_ views. One way to address that is to use [Eclipse's Working Sets](http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcworkset.htm) feature. A good introduction to it can be found at a -[Dzone article on Eclipse Working Sets](http://eclipse.dzone.com/articles/categorise-projects-package). \ No newline at end of file +[Dzone article on Eclipse Working Sets](http://eclipse.dzone.com/articles/categorise-projects-package). diff --git a/docs/user-manual/en/aerogear-integration.md b/docs/user-manual/en/aerogear-integration.md index 2a83f4d7dc..0dbafb26ed 100644 --- a/docs/user-manual/en/aerogear-integration.md +++ b/docs/user-manual/en/aerogear-integration.md @@ -35,7 +35,7 @@ Shown are the required params for the connector service and are: - `master-secret`. The secret of your mobile application in AeroGear. -As well as these required paramaters there are the following optional +As well as these required parameters there are the following optional parameters - `ttl`. The time to live for the message once AeroGear receives it. diff --git a/docs/user-manual/en/vertx-integration.md b/docs/user-manual/en/vertx-integration.md index 9c52a0fed3..f823f118da 100644 --- a/docs/user-manual/en/vertx-integration.md +++ b/docs/user-manual/en/vertx-integration.md @@ -64,7 +64,7 @@ Shown are the required params for the connector service: - `queue`. The name of the Apache ActiveMQ Artemis queue to fetch message from. -As well as these required paramaters there are the following optional +As well as these required parameters there are the following optional parameters - `host`. The host name on which the vertx target container is diff --git a/examples/features/ha/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java b/examples/features/ha/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java index 0401617c63..d2b8d95802 100644 --- a/examples/features/ha/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java +++ b/examples/features/ha/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java @@ -103,7 +103,7 @@ public class HAPolicyAutoBackupExample { System.out.println("Got message: " + message0.getText() + " from node 0"); } - // Step 14.close the consumer so it doesnt get any messages + // Step 14.close the consumer so it doesn't get any messages consumer1.close(); // Step 15.now kill server1, messages will be scaled down to server0 diff --git a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java index 0b3e741dcf..ad92b08c02 100644 --- a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java +++ b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java @@ -88,7 +88,7 @@ public abstract class PerfBase { boolean drainQueue = Boolean.valueOf(props.getProperty("drain-queue")); String destinationName = props.getProperty("destination-name"); int throttleRate = Integer.valueOf(props.getProperty("throttle-rate")); - boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege")); + boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowledge")); boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id")); boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp")); String clientLibrary = props.getProperty("client-library", "core"); diff --git a/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakBase.java b/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakBase.java index 3b0b105f87..bd17b38853 100644 --- a/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakBase.java +++ b/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakBase.java @@ -69,7 +69,7 @@ public class SoakBase { String destinationLookup = props.getProperty("destination-lookup"); String connectionFactoryLookup = props.getProperty("connection-factory-lookup"); int throttleRate = Integer.valueOf(props.getProperty("throttle-rate")); - boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege")); + boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowledge")); boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id")); boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp")); diff --git a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearLogger.java b/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearLogger.java index c8e7c57bc3..66c000e209 100644 --- a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearLogger.java +++ b/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearLogger.java @@ -57,7 +57,7 @@ public interface ActiveMQAeroGearLogger extends BasicLogger { void reply404(); @LogMessage(level = Logger.Level.WARN) - @Message(id = 232005, value = "removing aerogear connector as unexpected respone {0} returned", format = Message.Format.MESSAGE_FORMAT) + @Message(id = 232005, value = "removing aerogear connector as unexpected response {0} returned", format = Message.Format.MESSAGE_FORMAT) void replyUnknown(int status); @LogMessage(level = Logger.Level.WARN) diff --git a/pom.xml b/pom.xml index 778143108f..26dfb39972 100644 --- a/pom.xml +++ b/pom.xml @@ -198,7 +198,7 @@ - + junit junit diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java index 49ef2987e1..9096c06dd2 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/EmbeddedBrokerTestSupport.java @@ -128,7 +128,7 @@ public abstract class EmbeddedBrokerTestSupport extends CombinationTestSupport { /** * Factory method to create a new {@link Destination} * - * @return newly created Destinaiton + * @return newly created Destination */ protected ActiveMQDestination createDestination() { return createDestination(getDestinationString()); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/OptimizedAckTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/OptimizedAckTest.java index 8da4cf7dbb..fb44c71626 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/OptimizedAckTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/OptimizedAckTest.java @@ -69,7 +69,7 @@ public class OptimizedAckTest extends TestSupport { Binding binding = broker.getServer().getPostOffice().getBinding(new SimpleString("jms.queue.test")); final QueueImpl coreQueue = (QueueImpl) binding.getBindable(); - assertTrue("deliverying count is 10", Wait.waitFor(new Wait.Condition() { + assertTrue("delivering count is 10", Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisified() throws Exception { return 10 == coreQueue.getDeliveringCount(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SecurityJMXTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SecurityJMXTest.java index eb7fc046aa..ab85bb41fb 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SecurityJMXTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SecurityJMXTest.java @@ -85,7 +85,7 @@ public class SecurityJMXTest extends TestCase { Connection c = new ActiveMQConnectionFactory("vm://localhost").createConnection("system", "manager"); c.start(); - // browser consumer will force expriation check on addConsumer + // browser consumer will force expiration check on addConsumer QueueBrowser browser = c.createSession(false, Session.AUTO_ACKNOWLEDGE).createBrowser(new ActiveMQQueue("TEST.Q")); assertTrue("no message in the q", !browser.getEnumeration().hasMoreElements()); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java index 1557854087..44f2f438b3 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java @@ -875,7 +875,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest { try { consumerSession.commit(); - Assert.fail("expected transaciton rolledback ex"); + Assert.fail("expected transaction rolledback ex"); } catch (TransactionRolledBackException expected) { } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NonBlockingConsumerRedeliveryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NonBlockingConsumerRedeliveryTest.java index f29680fa4a..00e9c2becd 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NonBlockingConsumerRedeliveryTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NonBlockingConsumerRedeliveryTest.java @@ -312,7 +312,7 @@ public class NonBlockingConsumerRedeliveryTest { count = 0; } catch (JMSException e) { - LOG.warn("Caught an unexcepted exception: " + e.getMessage()); + LOG.warn("Caught an unexpected exception: " + e.getMessage()); } } else { @@ -321,7 +321,7 @@ public class NonBlockingConsumerRedeliveryTest { session.commit(); } catch (JMSException e) { - LOG.warn("Caught an unexcepted exception: " + e.getMessage()); + LOG.warn("Caught an unexpected exception: " + e.getMessage()); } } } @@ -388,7 +388,7 @@ public class NonBlockingConsumerRedeliveryTest { session.rollback(); } catch (JMSException e) { - LOG.warn("Caught an unexcepted exception: " + e.getMessage()); + LOG.warn("Caught an unexpected exception: " + e.getMessage()); } } }); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndStopBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndStopBrokerTest.java index eb20e10dac..2776548210 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndStopBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndStopBrokerTest.java @@ -36,7 +36,7 @@ public class StartAndStopBrokerTest extends TestCase { // have persistence messages as a default System.setProperty("activemq.persistenceAdapter", "org.apache.activemq.store.vm.VMPersistenceAdapter"); - // configuration of container and all protocolls + // configuration of container and all protocols BrokerService broker = createBroker(); // start a client diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java index 55b717f40e..1180726018 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java @@ -53,7 +53,7 @@ public interface Server extends Remote { void kill() throws Exception; /** - * When kill is called you are actually schedulling the server to be killed in few milliseconds. + * When kill is called you are actually scheduling the server to be killed in few milliseconds. * There are certain cases where we need to assure the server was really killed. * For that we have this simple ping we can use to verify if the server still alive or not. */ diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java index 129e6f9d3b..2d8200ffb9 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java @@ -26,7 +26,7 @@ import org.objectweb.jtests.jms.framework.PubSubTestCase; /** * Test topic-specific connection features. * - * Test setting of client ID which is relevant only for Durable Subscribtion + * Test setting of client ID which is relevant only for Durable Subscription */ public class TopicConnectionTest extends PubSubTestCase { From d5242978d55051ddf5b0ef245e48f851f5147f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 25 Aug 2016 13:51:18 +0300 Subject: [PATCH 6/7] for and while loop to foreach conversions --- .../activemq/artemis/utils/uri/URISchema.java | 12 +++++------ .../artemis/utils/uri/URISupport.java | 10 ++++----- .../core/remoting/impl/ssl/SSLSupport.java | 4 ++-- .../artemis/utils/SecurityFormatter.java | 4 ++-- .../activemq/artemis/utils/XMLUtil.java | 4 ++-- .../jms/bridge/impl/JMSBridgeImpl.java | 5 +---- .../core/io/mapped/MappedByteBufferCache.java | 10 +++------ .../protocol/openwire/OpenWireConnection.java | 10 +++------ .../openwire/OpenWireMessageConverter.java | 10 ++------- .../core/protocol/stomp/StompSession.java | 4 +--- .../ActiveMQRAManagedConnectionFactory.java | 7 +------ .../ra/inflow/ActiveMQActivationSpec.java | 5 ++--- .../selector/filter/UnaryExpression.java | 4 +--- .../ClusterConnectionConfiguration.java | 4 ++-- .../config/impl/SecurityConfiguration.java | 9 ++------ .../core/messagecounter/MessageCounter.java | 4 +--- .../impl/MessageCounterManagerImpl.java | 19 +++-------------- .../remoting/impl/netty/NettyAcceptor.java | 9 ++------ .../cluster/impl/ClusterConnectionBridge.java | 8 +++---- .../security/jaas/JaasCallbackHandler.java | 3 +-- .../core/security/jaas/LDAPLoginModule.java | 14 ++++++------- .../amqp/client/sasl/CramMD5Mechanism.java | 4 ++-- .../amqp/client/util/PropertyUtil.java | 21 ++++++++----------- 23 files changed, 64 insertions(+), 120 deletions(-) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISchema.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISchema.java index 3120292bcc..9751659e69 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISchema.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISchema.java @@ -106,16 +106,16 @@ public abstract class URISchema { Map rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { String[] parameters = uri.split("&"); - for (int i = 0; i < parameters.length; i++) { - int p = parameters[i].indexOf("="); + for (String parameter : parameters) { + int p = parameter.indexOf("="); if (p >= 0) { - String name = BeanSupport.decodeURI(parameters[i].substring(0, p)); - String value = BeanSupport.decodeURI(parameters[i].substring(p + 1)); + String name = BeanSupport.decodeURI(parameter.substring(0, p)); + String value = BeanSupport.decodeURI(parameter.substring(p + 1)); rc.put(name, value); } else { - if (!parameters[i].trim().isEmpty()) { - rc.put(parameters[i], null); + if (!parameter.trim().isEmpty()) { + rc.put(parameter, null); } } } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java index f3744f1f31..a95f810982 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java @@ -135,15 +135,15 @@ public class URISupport { private static void parseParameters(Map rc, String[] parameters) throws UnsupportedEncodingException { - for (int i = 0; i < parameters.length; i++) { - int p = parameters[i].indexOf("="); + for (String parameter : parameters) { + int p = parameter.indexOf("="); if (p >= 0) { - String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); - String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); + String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8"); + String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8"); rc.put(name, value); } else { - rc.put(parameters[i], null); + rc.put(parameter, null); } } } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java index 2b97c75888..d5e0fdc78b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java @@ -67,8 +67,8 @@ public class SSLSupport { public static String parseArrayIntoCommandSeparatedList(String[] suites) { StringBuilder supportedSuites = new StringBuilder(); - for (int i = 0; i < suites.length; i++) { - supportedSuites.append(suites[i]); + for (String suite : suites) { + supportedSuites.append(suite); supportedSuites.append(", "); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java index b64cc77ef9..90994fb5f6 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java @@ -65,8 +65,8 @@ public class SecurityFormatter { return list; } String[] values = commaSeparatedString.split(","); - for (int i = 0; i < values.length; i++) { - list.add(values[i].trim()); + for (String value : values) { + list.add(value.trim()); } return list; } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java index ca51c085bf..7a492c4a97 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java @@ -366,8 +366,8 @@ public final class XMLUtil { for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); short type = n.getNodeType(); - for (int j = 0; j < typesToFilter.length; j++) { - if (typesToFilter[j] == type) { + for (short typeToFilter : typesToFilter) { + if (typeToFilter == type) { continue outer; } } diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java index c3636514e9..339ebcff0c 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java @@ -1602,11 +1602,8 @@ public final class JMSBridgeImpl implements JMSBridge { msg.clearProperties(); if (oldProps != null) { - Iterator> oldPropsIter = oldProps.entrySet().iterator(); - - while (oldPropsIter.hasNext()) { - Entry entry = oldPropsIter.next(); + for (Entry entry : oldProps.entrySet()) { String propName = entry.getKey(); Object val = entry.getValue(); diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedByteBufferCache.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedByteBufferCache.java index d097055c4b..5bba39179c 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedByteBufferCache.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedByteBufferCache.java @@ -140,9 +140,7 @@ final class MappedByteBufferCache implements AutoCloseable { public void closeAndResize(long length) { if (!closed) { //TO_FIX: unmap in this way is not portable BUT required on Windows that can't resize a memmory mapped file! - final int mappedBuffers = this.byteBuffers.size(); - for (int i = 0; i < mappedBuffers; i++) { - final WeakReference mbbRef = byteBuffers.get(i); + for (final WeakReference mbbRef : this.byteBuffers) { if (mbbRef != null) { final MappedByteBuffer mbb = mbbRef.get(); if (mbb != null) { @@ -204,9 +202,7 @@ final class MappedByteBufferCache implements AutoCloseable { public void close() { if (!closed) { //TO_FIX: unmap in this way is not portable BUT required on Windows that can't resize a memory mapped file! - final int mappedBuffers = this.byteBuffers.size(); - for (int i = 0; i < mappedBuffers; i++) { - final WeakReference mbbRef = byteBuffers.get(i); + for (final WeakReference mbbRef : this.byteBuffers) { if (mbbRef != null) { final MappedByteBuffer mbb = mbbRef.get(); if (mbb != null) { @@ -237,4 +233,4 @@ final class MappedByteBufferCache implements AutoCloseable { closed = true; } } -} \ No newline at end of file +} diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java index 8f53bdb093..aeb0f2b7f0 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java @@ -25,7 +25,6 @@ import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; import java.io.IOException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Map; @@ -764,9 +763,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se } public void addSessions(Set sessionSet) { - Iterator iter = sessionSet.iterator(); - while (iter.hasNext()) { - SessionId sid = iter.next(); + for (SessionId sid : sessionSet) { addSession(getState().getSessionState(sid).getInfo(), true); } } @@ -805,10 +802,9 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se } else { Bindings bindings = server.getPostOffice().getBindingsForAddress(OpenWireUtil.toCoreAddress(dest)); - Iterator iterator = bindings.getBindings().iterator(); - while (iterator.hasNext()) { - Queue b = (Queue) iterator.next().getBindable(); + for (Binding binding : bindings.getBindings()) { + Queue b = (Queue) binding.getBindable(); if (b.getConsumerCount() > 0) { throw new Exception("Destination still has an active subscription: " + dest.getPhysicalName()); } diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java index 8096b932ef..fd6aef2cc7 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; -import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -353,10 +352,7 @@ public class OpenWireMessageConverter implements MessageConverter { //unmarshall properties to core so selector will work Map props = messageSend.getProperties(); //Map props = MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(propBytes))); - Iterator> iterEntries = props.entrySet().iterator(); - while (iterEntries.hasNext()) { - Entry ent = iterEntries.next(); - + for (Entry ent : props.entrySet()) { Object value = ent.getValue(); try { coreMessage.putObjectProperty(ent.getKey(), value); @@ -394,9 +390,7 @@ public class OpenWireMessageConverter implements MessageConverter { } private static void loadMapIntoProperties(TypedProperties props, Map map) { - Iterator> iter = map.entrySet().iterator(); - while (iter.hasNext()) { - Entry entry = iter.next(); + for (Entry entry : map.entrySet()) { SimpleString key = new SimpleString(entry.getKey()); Object value = entry.getValue(); if (value instanceof UTF8Buffer) { diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java index 1ab7c42f2c..ba0abbfe88 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java @@ -343,9 +343,7 @@ public class StompSession implements SessionCallback { } boolean containsSubscription(String subscriptionID) { - Iterator> iterator = subscriptions.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); + for (Entry entry : subscriptions.entrySet()) { StompSubscription sub = entry.getValue(); if (sub.getID().equals(subscriptionID)) { return true; diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java index a3e5f4cb82..c46efcac2f 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java @@ -27,7 +27,6 @@ import javax.resource.spi.ResourceAdapterAssociation; import javax.security.auth.Subject; import java.io.PrintWriter; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -203,11 +202,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti ActiveMQRALogger.LOGGER.trace("Looking for connection matching credentials: " + credential); } - Iterator connections = connectionSet.iterator(); - - while (connections.hasNext()) { - Object obj = connections.next(); - + for (Object obj : connectionSet) { if (obj instanceof ActiveMQRAManagedConnection) { ActiveMQRAManagedConnection mc = (ActiveMQRAManagedConnection) obj; ManagedConnectionFactory mcf = mc.getManagedConnectionFactory(); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java index 61dc37a125..4d8b18fbf7 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java @@ -28,7 +28,6 @@ import java.beans.PropertyDescriptor; import java.io.Serializable; import java.util.ArrayList; import java.util.Hashtable; -import java.util.Iterator; import java.util.List; import org.apache.activemq.artemis.ra.ConnectionFactoryProperties; @@ -722,9 +721,9 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen if (propsNotSet.size() > 0) { StringBuffer b = new StringBuffer(); b.append("Invalid settings:"); - for (Iterator iter = errorMessages.iterator(); iter.hasNext(); ) { + for (String errorMessage : errorMessages) { b.append(" "); - b.append(iter.next()); + b.append(errorMessage); } InvalidPropertyException e = new InvalidPropertyException(b.toString()); final PropertyDescriptor[] descriptors = propsNotSet.toArray(new PropertyDescriptor[propsNotSet.size()]); diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java index e0853c6529..ecdcf2389c 100755 --- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java +++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java @@ -19,7 +19,6 @@ package org.apache.activemq.artemis.selector.filter; import java.math.BigDecimal; import java.util.Collection; import java.util.HashSet; -import java.util.Iterator; import java.util.List; /** @@ -98,8 +97,7 @@ public abstract class UnaryExpression implements Expression { answer.append(" ( "); int count = 0; - for (Iterator i = inList.iterator(); i.hasNext(); ) { - Object o = i.next(); + for (Object o : inList) { if (count != 0) { answer.append(", "); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ClusterConnectionConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ClusterConnectionConfiguration.java index 3f5778280f..90c9db5108 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ClusterConnectionConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ClusterConnectionConfiguration.java @@ -382,8 +382,8 @@ public final class ClusterConnectionConfiguration implements Serializable { List list = new LinkedList<>(); - for (int i = 0; i < members.length; i++) { - list.addAll(connectorTransportConfigurationParser.newObject(members[i], null)); + for (URI member : members) { + list.addAll(connectorTransportConfigurationParser.newObject(member, null)); } return list.toArray(new TransportConfiguration[list.size()]); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java index 3325d5de55..76b814d0ed 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java @@ -25,7 +25,6 @@ import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -47,14 +46,10 @@ public class SecurityConfiguration extends Configuration { } public SecurityConfiguration(Map users, Map> roles) { - Iterator> iter = users.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = iter.next(); + for (Map.Entry entry : users.entrySet()) { addUser(entry.getKey(), entry.getValue()); } - Iterator>> iter1 = roles.entrySet().iterator(); - while (iter1.hasNext()) { - Map.Entry> entry = iter1.next(); + for (Map.Entry> entry : roles.entrySet()) { for (String role : entry.getValue()) { addRole(entry.getKey(), role); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/MessageCounter.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/MessageCounter.java index 1d912797bf..9ceb8eaf13 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/MessageCounter.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/MessageCounter.java @@ -288,9 +288,7 @@ public class MessageCounter { ret.append(dayCounters.size() + "\n"); // following lines: day counter data - for (int i = 0; i < dayCounters.size(); i++) { - DayCounter counter = dayCounters.get(i); - + for (DayCounter counter : dayCounters) { ret.append(counter.getDayCounterAsString() + "\n"); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/impl/MessageCounterManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/impl/MessageCounterManagerImpl.java index 1183ce5a0b..0f60cf66c8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/impl/MessageCounterManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/impl/MessageCounterManagerImpl.java @@ -18,7 +18,6 @@ package org.apache.activemq.artemis.core.messagecounter.impl; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.Future; @@ -141,11 +140,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager { @Override public void resetAllCounters() { synchronized (messageCounters) { - Iterator iter = messageCounters.values().iterator(); - - while (iter.hasNext()) { - MessageCounter counter = iter.next(); - + for (MessageCounter counter : messageCounters.values()) { counter.resetCounter(); } } @@ -154,11 +149,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager { @Override public void resetAllCounterHistories() { synchronized (messageCounters) { - Iterator iter = messageCounters.values().iterator(); - - while (iter.hasNext()) { - MessageCounter counter = iter.next(); - + for (MessageCounter counter : messageCounters.values()) { counter.resetHistory(); } } @@ -177,11 +168,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager { } synchronized (messageCounters) { - Iterator iter = messageCounters.values().iterator(); - - while (iter.hasNext()) { - MessageCounter counter = iter.next(); - + for (MessageCounter counter : messageCounters.values()) { counter.onTimer(); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java index 783f4ac9c3..8cff70b4b4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java @@ -26,7 +26,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -513,9 +512,7 @@ public class NettyAcceptor extends AbstractAcceptor { if (!future.isSuccess()) { ActiveMQServerLogger.LOGGER.nettyChannelGroupError(); - Iterator iterator = future.group().iterator(); - while (iterator.hasNext()) { - Channel channel = iterator.next(); + for (Channel channel : future.group()) { if (channel.isActive()) { ActiveMQServerLogger.LOGGER.nettyChannelStillOpen(channel, channel.remoteAddress()); } @@ -573,9 +570,7 @@ public class NettyAcceptor extends AbstractAcceptor { ChannelGroupFuture future = serverChannelGroup.close().awaitUninterruptibly(); if (!future.isSuccess()) { ActiveMQServerLogger.LOGGER.nettyChannelGroupBindError(); - Iterator iterator = future.group().iterator(); - while (iterator.hasNext()) { - Channel channel = iterator.next(); + for (Channel channel : future.group()) { if (channel.isActive()) { ActiveMQServerLogger.LOGGER.nettyChannelStillBound(channel, channel.remoteAddress()); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java index a8c87b9ce4..425e26a22a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java @@ -295,12 +295,12 @@ public class ClusterConnectionBridge extends BridgeImpl { List excludes = new ArrayList<>(); // Split the list into addresses to match and addresses to exclude. - for (int i = 0; i < list.length; i++) { - if (list[i].startsWith("!")) { - excludes.add(list[i].substring(1, list[i].length())); + for (String s : list) { + if (s.startsWith("!")) { + excludes.add(s.substring(1, s.length())); } else { - includes.add(list[i]); + includes.add(s); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/JaasCallbackHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/JaasCallbackHandler.java index 71a617228a..97beffab8c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/JaasCallbackHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/JaasCallbackHandler.java @@ -41,8 +41,7 @@ public class JaasCallbackHandler implements CallbackHandler { @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { - for (int i = 0; i < callbacks.length; i++) { - Callback callback = callbacks[i]; + for (Callback callback : callbacks) { if (callback instanceof PasswordCallback) { PasswordCallback passwordCallback = (PasswordCallback) callback; if (password == null) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java index 8bb5405e3a..942b328270 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java @@ -274,8 +274,8 @@ public class LDAPLoginModule implements LoginModule { if (logger.isDebugEnabled()) { logger.debug("Roles " + roles + " for user " + username); } - for (int i = 0; i < roles.size(); i++) { - groups.add(new RolePrincipal(roles.get(i))); + for (String role : roles) { + groups.add(new RolePrincipal(role)); } } else { @@ -488,15 +488,15 @@ public class LDAPLoginModule implements LoginModule { } private String getLDAPPropertyValue(String propertyName) { - for (int i = 0; i < config.length; i++) - if (config[i].getPropertyName().equals(propertyName)) - return config[i].getPropertyValue(); + for (LDAPLoginProperty conf : config) + if (conf.getPropertyName().equals(propertyName)) + return conf.getPropertyValue(); return null; } private boolean isLoginPropertySet(String propertyName) { - for (int i = 0; i < config.length; i++) { - if (config[i].getPropertyName().equals(propertyName) && (config[i].getPropertyValue() != null && !"".equals(config[i].getPropertyValue()))) + for (LDAPLoginProperty conf : config) { + if (conf.getPropertyName().equals(propertyName) && (conf.getPropertyValue() != null && !"".equals(conf.getPropertyValue()))) return true; } return false; diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/sasl/CramMD5Mechanism.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/sasl/CramMD5Mechanism.java index 4821314f24..a7c885879a 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/sasl/CramMD5Mechanism.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/sasl/CramMD5Mechanism.java @@ -61,8 +61,8 @@ public class CramMD5Mechanism extends AbstractMechanism { StringBuffer hash = new StringBuffer(getUsername()); hash.append(' '); - for (int i = 0; i < bytes.length; i++) { - String hex = Integer.toHexString(0xFF & bytes[i]); + for (byte b : bytes) { + String hex = Integer.toHexString(0xFF & b); if (hex.length() == 1) { hash.append('0'); } diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/PropertyUtil.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/PropertyUtil.java index 1285a0fc55..20979a8192 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/PropertyUtil.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/util/PropertyUtil.java @@ -172,15 +172,15 @@ public class PropertyUtil { if (queryString != null && !queryString.isEmpty()) { Map rc = new HashMap<>(); String[] parameters = queryString.split("&"); - for (int i = 0; i < parameters.length; i++) { - int p = parameters[i].indexOf("="); + for (String parameter : parameters) { + int p = parameter.indexOf("="); if (p >= 0) { - String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); - String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); + String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8"); + String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8"); rc.put(name, value); } else { - rc.put(parameters[i], null); + rc.put(parameter, null); } } return rc; @@ -352,8 +352,7 @@ public class PropertyUtil { Object[] NULL_ARG = {}; PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); if (propertyDescriptors != null) { - for (int i = 0; i < propertyDescriptors.length; i++) { - PropertyDescriptor pd = propertyDescriptors[i]; + for (PropertyDescriptor pd : propertyDescriptors) { if (pd.getReadMethod() != null && !pd.getName().equals("class") && !pd.getName().equals("properties") && !pd.getName().equals("reference")) { Object value = pd.getReadMethod().invoke(object, NULL_ARG); if (value != null) { @@ -365,7 +364,7 @@ public class PropertyUtil { } else { Map inner = getProperties(value); - for (Map.Entry entry : inner.entrySet()) { + for (Entry entry : inner.entrySet()) { properties.put(pd.getName() + "." + entry.getKey(), entry.getValue()); } } @@ -389,8 +388,7 @@ public class PropertyUtil { BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); if (propertyDescriptors != null) { - for (int i = 0; i < propertyDescriptors.length; i++) { - PropertyDescriptor pd = propertyDescriptors[i]; + for (PropertyDescriptor pd : propertyDescriptors) { if (pd.getReadMethod() != null && pd.getName().equals(name)) { return pd.getReadMethod().invoke(object); } @@ -497,8 +495,7 @@ public class PropertyUtil { // Build the method name. name = "set" + name.substring(0, 1).toUpperCase() + name.substring(1); Method[] methods = clazz.getMethods(); - for (int i = 0; i < methods.length; i++) { - Method method = methods[i]; + for (Method method : methods) { Class[] params = method.getParameterTypes(); if (method.getName().equals(name) && params.length == 1) { return method; From 4ef9c5e238810f1f280d34edd34e957b69b6e483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 25 Aug 2016 16:00:20 +0300 Subject: [PATCH 7/7] Javadoc error fixes --- .../core/impl/wireformat/ReplicationSyncFileMessage.java | 2 +- .../apache/activemq/transport/amqp/client/AmqpSender.java | 2 +- .../transport/amqp/client/AmqpTransactionContext.java | 1 - .../activemq/transport/amqp/client/sasl/Mechanism.java | 6 +++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java index 69997418fc..208e86bca2 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java @@ -27,7 +27,7 @@ import org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournal import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; /** - * Message is used to sync {@link org.apache.activemq.artemis.core.journal.SequentialFile}s to a backup server. The {@link FileType} controls + * Message is used to sync {@link org.apache.activemq.artemis.core.io.SequentialFile}s to a backup server. The {@link FileType} controls * which extra information is sent. */ public final class ReplicationSyncFileMessage extends PacketImpl { diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpSender.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpSender.java index 404b943187..5ae2948547 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpSender.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpSender.java @@ -95,7 +95,7 @@ public class AmqpSender extends AmqpAbstractResource { * Create a new sender instance using the given Target when creating the link. * * @param session The parent session that created the session. - * @param address The address that this sender produces to. + * @param target The target that this sender produces to. * @param senderId The unique ID assigned to this sender. */ public AmqpSender(AmqpSession session, Target target, String senderId) { diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpTransactionContext.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpTransactionContext.java index 2f3e22a25e..939f0406e6 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpTransactionContext.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpTransactionContext.java @@ -47,7 +47,6 @@ public class AmqpTransactionContext { /** * Begins a new transaction scoped to the target session. * - * @param txId The transaction Id to use for this new transaction. * @throws Exception if an error occurs while starting the transaction. */ public void begin() throws Exception { diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/sasl/Mechanism.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/sasl/Mechanism.java index a79406f717..cc2687ff82 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/sasl/Mechanism.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/sasl/Mechanism.java @@ -78,7 +78,7 @@ public interface Mechanism extends Comparable { * * @param username The user name given. */ - void setUsername(String value); + void setUsername(String username); /** * Returns the configured user name value for this Mechanism. @@ -91,9 +91,9 @@ public interface Mechanism extends Comparable { * Sets the password value for this Mechanism. The Mechanism can ignore this * value if it does not utilize a password in it's authentication processing. * - * @param username The user name given. + * @param password The password given. */ - void setPassword(String value); + void setPassword(String password); /** * Returns the configured password value for this Mechanism.