Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing squid:S1905 - Redundant casts should not be used #607

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public String apply(Host input) {

this.cluster = builder.build();
if (!(this.cpMonitor instanceof JavaDriverConnectionPoolMonitorImpl))
this.cluster.getMetrics().getRegistry().addListener((MetricRegistryListener) this.metricsRegListener);
this.cluster.getMetrics().getRegistry().addListener(this.metricsRegListener);
this.session = cluster.connect();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public String apply(Host input) {

cluster = builder.build();
if (!(this.cpMonitor instanceof JavaDriverConnectionPoolMonitorImpl))
this.cluster.getMetrics().getRegistry().addListener((MetricRegistryListener) this.metricsRegListener);
this.cluster.getMetrics().getRegistry().addListener(this.metricsRegListener);

Logger.info("Connecting to cluster");
session = cluster.connect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public Column<C> parseResultSet(ResultSet rs) throws NotFoundException {
return null;
}

CqlColumnImpl<C> cqlCol = new CqlColumnImpl<C>((C) columnName, row, 0);
CqlColumnImpl<C> cqlCol = new CqlColumnImpl<C>(columnName, row, 0);
return cqlCol;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public CqlColumnSlice(CqlColumnSlice<C> cqlColumnSlice) {
}

private void initFrom(CqlColumnSlice<C> cqlColumnSlice) {
this.cqlColumns = (Collection<C>) cqlColumnSlice.cqlColumns;
this.cqlColumns = cqlColumnSlice.cqlColumns;
this.cqlRange = cqlColumnSlice.cqlRange;
}

Expand All @@ -109,12 +109,12 @@ public Collection<C> getColumns() {

@Override
public C getStartColumn() {
return (cqlRange != null) ? (C) cqlRange.getCqlStart() : null;
return (cqlRange != null) ? cqlRange.getCqlStart() : null;
}

@Override
public C getEndColumn() {
return (cqlRange != null) ? (C) cqlRange.getCqlEnd() : null;
return (cqlRange != null) ? cqlRange.getCqlEnd() : null;
}

@Override
Expand All @@ -140,11 +140,11 @@ public boolean isRangeQuery() {
if (isColumnSelectQuery()) {
return false;
}

if (cqlRange != null) {
return true;
}

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ private static Map<String, Object> propertiesToMap(Properties props) {
}
node = (Map<String, Object>)node.get(parts[i]);
}
node.put(parts[parts.length-1], (String)prop.getValue());
node.put(parts[parts.length-1], prop.getValue());
}
return root;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private static Map<String, Object> propertiesToMap(Properties props) {
}
node = (Map<String, Object>)node.get(parts[i]);
}
node.put(parts[parts.length-1], (String)prop.getValue());
node.put(parts[parts.length-1], prop.getValue());
}
return root;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static MessageQueueEntry newMessageEntry(byte priority, UUID timestamp, M
}

public static MessageQueueEntry newBusyEntry(Message message) {
return new MessageQueueEntry(MessageQueueEntryType.Message, (byte)message.getPriority(), message.getToken(), message.getRandom(), MessageQueueEntryState.Busy);
return new MessageQueueEntry(MessageQueueEntryType.Message, message.getPriority(), message.getToken(), message.getRandom(), MessageQueueEntryState.Busy);
}

public static MessageQueueEntry fromMetadata(MessageMetadataEntry meta) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <T> String serializeToString(T trigger) throws JsonGenerationException, JsonMapp
}

private <T> T deserializeString(String data, Class<T> clazz) throws JsonParseException, JsonMappingException, IOException {
return (T) mapper.readValue(
return mapper.readValue(
new ByteArrayInputStream(data.getBytes()),
clazz);
}
Expand Down Expand Up @@ -842,7 +842,7 @@ public SendMessageResponse sendMessages(Collection<Message> messages) throws Mes
String groupKey = getCompositeKey(getName(), message.getKey());
uniqueKeys.put(groupKey, message);
mb.withRow(keyIndexColumnFamily, groupKey)
.putEmptyColumn(lockColumn, (Integer)lockTtl);
.putEmptyColumn(lockColumn, lockTtl);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void init() throws Exception {
String rowKey = Character.toString(keyName);
ColumnListMutation<String> cfmStandard = m.withRow(CF_ALL_ROWS, rowKey);
for (char cName = 'a'; cName <= 'z'; cName++) {
cfmStandard.putColumn(Character.toString(cName), (int) (cName - 'a') + 1, null);
cfmStandard.putColumn(Character.toString(cName), cName - 'a' + 1, null);
}
m.withCaching(true);
m.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void testFunctionalQuery() throws Exception {
ColumnListMutation<String> cfmStandard = m.withRow(CF_STANDARD1, rowKey);
for (char cName = 'a'; cName <= 'z'; cName++) {
cfmStandard.putColumn(Character.toString(cName),
(int) (cName - 'a') + 1, null);
cName - 'a' + 1, null);
}
m.withCaching(true);
m.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ private void populateRowsForColumnRange() throws Exception {
String rowKey = Character.toString(keyName);
ColumnListMutation<String> colMutation = m.withRow(CF_COLUMN_RANGE_TEST, rowKey);
for (char cName = 'a'; cName <= 'z'; cName++) {
colMutation.putColumn(Character.toString(cName), (int) (cName - 'a') + 1, null);
colMutation.putColumn(Character.toString(cName), cName - 'a' + 1, null);
}
m.withCaching(true);
m.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private static void populateRowsForColumnRange() throws Exception {
String rowKey = Character.toString(keyName);
ColumnListMutation<String> colMutation = m.withRow(CF_ROW_RANGE, rowKey);
for (char cName = 'a'; cName <= 'z'; cName++) {
colMutation.putColumn(Character.toString(cName), (int) (cName - 'a') + 1, null);
colMutation.putColumn(Character.toString(cName), cName - 'a' + 1, null);
}
m.withCaching(true);
m.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static void init() throws Exception {
String rowKey = Character.toString(keyName);
ColumnListMutation<String> cfmStandard = m.withRow(CF_ALL_ROWS_READER, rowKey);
for (char cName = 'a'; cName <= 'z'; cName++) {
cfmStandard.putColumn(Character.toString(cName), (int) (cName - 'a') + 1, null);
cfmStandard.putColumn(Character.toString(cName), cName - 'a' + 1, null);
}
m.execute();
m.discardMutations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void populateRowsForColumnRange(Keyspace keyspace) throws Exceptio
String rowKey = Character.toString(keyName);
ColumnListMutation<String> colMutation = m.withRow(CF_COLUMN_RANGE_TEST, rowKey);
for (char cName = 'a'; cName <= 'z'; cName++) {
colMutation.putColumn(Character.toString(cName), (int) (cName - 'a') + 1, null);
colMutation.putColumn(Character.toString(cName), cName - 'a' + 1, null);
}
m.withCaching(true);
m.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public Keyspace createKeyspace(String ksName, ConnectionPool<Cassandra.Client> c
@Override
public Cluster createCluster(ConnectionPool<Cassandra.Client> cp, AstyanaxConfiguration asConfig,
KeyspaceTracerFactory tracerFactory) {
return new ThriftClusterImpl(asConfig, (ConnectionPool<Cassandra.Client>) cp, tracerFactory);
return new ThriftClusterImpl(asConfig, cp, tracerFactory);
}

@Override
public ConnectionFactory<Cassandra.Client> createConnectionFactory(AstyanaxConfiguration asConfig, ConnectionPoolConfiguration cfConfig,
KeyspaceTracerFactory tracerFactory, ConnectionPoolMonitor monitor) {
return (ConnectionFactory<Cassandra.Client>) new ThriftSyncConnectionFactoryImpl(asConfig, cfConfig, tracerFactory,
return new ThriftSyncConnectionFactoryImpl(asConfig, cfConfig, tracerFactory,
monitor);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public static Map<String, Object> propertiesToMap(Properties props) {
}
node = (Map<String, Object>)node.get(parts[i]);
}
node.put(parts[parts.length-1], (String)prop.getValue());
node.put(parts[parts.length-1], prop.getValue());
}
return root;
}
Expand Down