Remove unnecessary casts

This commit is contained in:
Ville Skyttä 2016-07-28 18:12:59 +03:00
parent b0815c6a4e
commit 429e1e84d4
6 changed files with 7 additions and 7 deletions

View File

@ -374,7 +374,7 @@ public class ClientProducerImpl implements ClientProducerInternal {
for (long pos = 0; pos < bodySize; ) { for (long pos = 0; pos < bodySize; ) {
final boolean lastChunk; 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); final ActiveMQBuffer bodyBuffer = ActiveMQBuffers.fixedBuffer(chunkLength);

View File

@ -254,7 +254,7 @@ public class JDBCSequentialFileFactoryDriver extends AbstractJDBCDriver {
if (rs.next()) { if (rs.next()) {
Blob blob = rs.getBlob(1); Blob blob = rs.getBlob(1);
readLength = (int) calculateReadLength(blob.length(), bytes.remaining(), file.position()); 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); bytes.put(data);
} }
connection.commit(); connection.commit();

View File

@ -146,7 +146,7 @@ final class MappedFile implements AutoCloseable {
* then the position is updated with the number of bytes actually read. * then the position is updated with the number of bytes actually read.
*/ */
public int read(ByteBuf dst, int dstStart, int dstLength) throws IOException { 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 read = Math.min(remaining, dstLength);
final int bufferPosition = checkOffset(position, read); final int bufferPosition = checkOffset(position, read);
final long srcAddress = PlatformDependent.directBufferAddress(lastMapped) + bufferPosition; 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. * then the position is updated with the number of bytes actually read.
*/ */
public int read(ByteBuffer dst, int dstStart, int dstLength) throws IOException { 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 read = Math.min(remaining, dstLength);
final int bufferPosition = checkOffset(position, read); final int bufferPosition = checkOffset(position, read);
final long srcAddress = PlatformDependent.directBufferAddress(lastMapped) + bufferPosition; final long srcAddress = PlatformDependent.directBufferAddress(lastMapped) + bufferPosition;

View File

@ -217,7 +217,7 @@ public class FanoutTransportBrokerTest extends OpenwireArtemisBaseTest {
// The MockTransport is on the remote connection. // The MockTransport is on the remote connection.
// Slip in a new transport filter after the MockTransport // 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()) { mt.install(new TransportFilter(mt.getNext()) {
@Override @Override
public void oneway(Object command) throws IOException { public void oneway(Object command) throws IOException {

View File

@ -88,7 +88,7 @@ public class FailureXATest extends ActiveMQTestBase {
private void doTestCrashServerAfterXACommit(boolean onePhase) throws Exception { private void doTestCrashServerAfterXACommit(boolean onePhase) throws Exception {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
XAConnection connection = (XAConnection) connectionFactory.createXAConnection(); XAConnection connection = connectionFactory.createXAConnection();
try { try {
Session session = connection.createSession(true, Session.SESSION_TRANSACTED); Session session = connection.createSession(true, Session.SESSION_TRANSACTED);

View File

@ -89,7 +89,7 @@ public class SendingAndReceivingTest extends ActiveMQTestBase {
private static String createMessage(int messageSize) { private static String createMessage(int messageSize) {
final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Random rnd = new Random(); Random rnd = new Random();
StringBuilder sb = new StringBuilder((int) messageSize); StringBuilder sb = new StringBuilder(messageSize);
for (int j = 0; j < messageSize; j++ ) { for (int j = 0; j < messageSize; j++ ) {
sb.append(AB.charAt(rnd.nextInt(AB.length()))); sb.append(AB.charAt(rnd.nextInt(AB.length())));
} }