From 429e1e84d4bde4b877246b5972f7f0a0c910e0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 28 Jul 2016 18:12:59 +0300 Subject: [PATCH] Remove unnecessary casts --- .../activemq/artemis/core/client/impl/ClientProducerImpl.java | 2 +- .../jdbc/store/file/JDBCSequentialFileFactoryDriver.java | 2 +- .../apache/activemq/artemis/core/io/mapped/MappedFile.java | 4 ++-- .../activemq/transport/fanout/FanoutTransportBrokerTest.java | 2 +- .../activemq/artemis/tests/extras/byteman/FailureXATest.java | 2 +- .../tests/integration/amqp/jms/SendingAndReceivingTest.java | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java index b0998b8a6c..9ee120fa26 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java @@ -374,7 +374,7 @@ public class ClientProducerImpl implements ClientProducerInternal { for (long pos = 0; pos < bodySize; ) { final boolean lastChunk; - final int chunkLength = (int) Math.min((bodySize - pos), (long) minLargeMessageSize); + final int chunkLength = (int) Math.min((bodySize - pos), minLargeMessageSize); final ActiveMQBuffer bodyBuffer = ActiveMQBuffers.fixedBuffer(chunkLength); 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 4a2c9914d2..0ce65db697 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 @@ -254,7 +254,7 @@ public class JDBCSequentialFileFactoryDriver extends AbstractJDBCDriver { if (rs.next()) { Blob blob = rs.getBlob(1); readLength = (int) calculateReadLength(blob.length(), bytes.remaining(), file.position()); - byte[] data = blob.getBytes(file.position() + 1, (int) readLength); + byte[] data = blob.getBytes(file.position() + 1, readLength); bytes.put(data); } connection.commit(); diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedFile.java index 72221f4706..6dca716cef 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedFile.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedFile.java @@ -146,7 +146,7 @@ final class MappedFile implements AutoCloseable { * then the position is updated with the number of bytes actually read. */ public int read(ByteBuf dst, int dstStart, int dstLength) throws IOException { - final int remaining = (int) Math.min(this.length - this.position, (long) Integer.MAX_VALUE); + final int remaining = (int) Math.min(this.length - this.position, Integer.MAX_VALUE); final int read = Math.min(remaining, dstLength); final int bufferPosition = checkOffset(position, read); final long srcAddress = PlatformDependent.directBufferAddress(lastMapped) + bufferPosition; @@ -172,7 +172,7 @@ final class MappedFile implements AutoCloseable { * then the position is updated with the number of bytes actually read. */ public int read(ByteBuffer dst, int dstStart, int dstLength) throws IOException { - final int remaining = (int) Math.min(this.length - this.position, (long) Integer.MAX_VALUE); + final int remaining = (int) Math.min(this.length - this.position, Integer.MAX_VALUE); final int read = Math.min(remaining, dstLength); final int bufferPosition = checkOffset(position, read); final long srcAddress = PlatformDependent.directBufferAddress(lastMapped) + bufferPosition; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java index 38ada79433..49a67c8e3c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/fanout/FanoutTransportBrokerTest.java @@ -217,7 +217,7 @@ public class FanoutTransportBrokerTest extends OpenwireArtemisBaseTest { // The MockTransport is on the remote connection. // Slip in a new transport filter after the MockTransport - MockTransport mt = (MockTransport) connection3.getTransport().narrow(MockTransport.class); + MockTransport mt = connection3.getTransport().narrow(MockTransport.class); mt.install(new TransportFilter(mt.getNext()) { @Override public void oneway(Object command) throws IOException { diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/FailureXATest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/FailureXATest.java index e279309454..63ca340af7 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/FailureXATest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/FailureXATest.java @@ -88,7 +88,7 @@ public class FailureXATest extends ActiveMQTestBase { private void doTestCrashServerAfterXACommit(boolean onePhase) throws Exception { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); - XAConnection connection = (XAConnection) connectionFactory.createXAConnection(); + XAConnection connection = connectionFactory.createXAConnection(); try { Session session = connection.createSession(true, Session.SESSION_TRANSACTED); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/jms/SendingAndReceivingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/jms/SendingAndReceivingTest.java index e0b18998db..d2982671be 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/jms/SendingAndReceivingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/jms/SendingAndReceivingTest.java @@ -89,7 +89,7 @@ public class SendingAndReceivingTest extends ActiveMQTestBase { private static String createMessage(int messageSize) { final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Random rnd = new Random(); - StringBuilder sb = new StringBuilder((int) messageSize); + StringBuilder sb = new StringBuilder(messageSize); for (int j = 0; j < messageSize; j++ ) { sb.append(AB.charAt(rnd.nextInt(AB.length()))); }