simplify/avoid possible npes

This commit is contained in:
Dave Brosius 2014-09-06 14:22:08 -04:00
parent 995904c2dd
commit 182051c453
15 changed files with 16 additions and 16 deletions

View File

@ -58,7 +58,7 @@ public final class Resources
if (component instanceof byte[])
buff.append(Hex.bytesToHex((byte[])component));
else
buff.append(component.toString());
buff.append(component);
}
return buff.toString();
}

View File

@ -2102,7 +2102,7 @@ public class CliClient
UUID sessionId = TimeUUIDType.instance.compose(thriftClient.trace_next_query());
sessionState.out.println("Will trace next query. Session ID: " + sessionId.toString());
sessionState.out.println("Will trace next query. Session ID: " + sessionId);
}
private void describeKeySpace(String keySpaceName, KsDef metadata) throws TException

View File

@ -333,7 +333,7 @@ public class ResultSet
{
for (ColumnSpecification name : names)
{
sb.append("[").append(name.name.toString());
sb.append("[").append(name.name);
sb.append("(").append(name.ksName).append(", ").append(name.cfName).append(")");
sb.append(", ").append(name.type).append("]");
}

View File

@ -509,7 +509,7 @@ public class CounterContext
if (state.getElementIndex() > 0)
sb.append(",");
sb.append("{");
sb.append(state.getCounterId().toString()).append(", ");
sb.append(state.getCounterId()).append(", ");
sb.append(state.getClock()).append(", ");
sb.append(state.getCount());
sb.append("}");

View File

@ -271,7 +271,7 @@ public class TypeParser
{
AbstractType<?> type = parse();
if (!(type instanceof CollectionType))
throw new SyntaxException(type.toString() + " is not a collection type");
throw new SyntaxException(type + " is not a collection type");
map.put(bb, (CollectionType)type);
}
catch (SyntaxException e)
@ -572,7 +572,7 @@ public class TypeParser
{
sb.append(',');
sb.append(ByteBufferUtil.bytesToHex(columnNames.get(i))).append(":");
sb.append(columnTypes.get(i).toString());
sb.append(columnTypes.get(i));
}
sb.append(')');
return sb.toString();

View File

@ -41,6 +41,6 @@ public class RepairException extends Exception
@Override
public String getMessage()
{
return desc.toString() + " " + super.getMessage();
return desc + " " + super.getMessage();
}
}

View File

@ -277,7 +277,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
{
ArrivalWindow hWnd = arrivalSamples.get(ep);
sb.append(ep + " : ");
sb.append(hWnd.toString());
sb.append(hWnd);
sb.append(System.getProperty("line.separator"));
}
sb.append("-----------------------------------------------------------------------");

View File

@ -186,7 +186,7 @@ public abstract class AbstractColumnFamilyRecordWriter<K, Y> extends RecordWrite
@Override
public String toString()
{
return "#<Client for " + endpoints.toString() + ">";
return "#<Client for " + endpoints + ">";
}
}
}

View File

@ -175,7 +175,7 @@ public class StreamCoordinator
{
HostStreamingData data = peerSessions.get(peer);
if (data == null)
throw new IllegalArgumentException("Unknown peer requested: " + peer.toString());
throw new IllegalArgumentException("Unknown peer requested: " + peer);
return data;
}

View File

@ -66,7 +66,7 @@ public abstract class StreamEvent
@Override
public String toString()
{
return "<ProgressEvent " + progress.toString() + ">";
return "<ProgressEvent " + progress + ">";
}
}

View File

@ -57,7 +57,7 @@ public class StreamLockfile
public StreamLockfile(File directory, UUID uuid)
{
lockfile = new File(directory, uuid.toString() + FILE_EXT);
lockfile = new File(directory, uuid + FILE_EXT);
}
public StreamLockfile(File lockfile)

View File

@ -72,7 +72,7 @@ public class TCustomServerSocket extends TServerTransport
catch (IOException ioe)
{
serverSocket = null;
throw new TTransportException("Could not create ServerSocket on address " + bindAddr.toString() + ".");
throw new TTransportException("Could not create ServerSocket on address " + bindAddr + ".");
}
this.keepAlive = keepAlive;

View File

@ -181,7 +181,7 @@ public class BulkLoader
// recalculate progress across all sessions in all hosts and display
for (InetAddress peer : sessionsByHost.keySet())
{
sb.append("[").append(peer.toString()).append("]");
sb.append("[").append(peer).append("]");
for (SessionInfo session : sessionsByHost.get(peer))
{

View File

@ -828,7 +828,7 @@ public class NodeTool
{
for (String ks : filter.keySet())
if (verifier.get(ks).size() > 0)
throw new IllegalArgumentException("Unknown tables: " + verifier.get(ks).toString() + " in keyspace: " + ks);
throw new IllegalArgumentException("Unknown tables: " + verifier.get(ks) + " in keyspace: " + ks);
}
}
}

View File

@ -638,7 +638,7 @@ public abstract class CqlOperation<V> extends PredefinedOperation
if (parm instanceof ByteBuffer)
result.append(getUnQuotedCqlBlob((ByteBuffer) parm));
else if (parm instanceof Long)
result.append(parm.toString());
result.append(parm);
else throw new AssertionError();
position = marker + 1;