Merge branch '#26-findbug_klockwork_fix' of emeroad/pinpoint

from pull-request 34

* refs/heads/#26-findbug_klockwork_fix:
  [#26] fix findbug issue
This commit is contained in:
Woonduk Kang
2014-09-30 13:44:56 +09:00
5 changed files with 23 additions and 8 deletions
@@ -146,7 +146,7 @@ public class DefaultModifierRegistry implements ModifierRegistry {
MemcachedClientModifier memcachedClientModifier = new MemcachedClientModifier(byteCodeInstrumentor, agent);
addModifier(memcachedClientModifier);
FrontCacheMemcachedClientModifier frontCacheMemcachedClientModifier = new FrontCacheMemcachedClientModifier(byteCodeInstrumentor, agent);
// FrontCacheMemcachedClientModifier frontCacheMemcachedClientModifier = new FrontCacheMemcachedClientModifier(byteCodeInstrumentor, agent);
// 관련 수정에 사이드 이펙트가 있이서 일단 disable함.
// addModifier(frontCacheMemcachedClientModifier);
@@ -169,7 +169,7 @@ public class DefaultModifierRegistry implements ModifierRegistry {
OperationFutureModifier operationFutureModifier = new OperationFutureModifier(byteCodeInstrumentor, agent);
addModifier(operationFutureModifier);
FrontCacheGetFutureModifier frontCacheGetFutureModifier = new FrontCacheGetFutureModifier(byteCodeInstrumentor, agent);
// FrontCacheGetFutureModifier frontCacheGetFutureModifier = new FrontCacheGetFutureModifier(byteCodeInstrumentor, agent);
// 관련 수정에 사이드 이펙트가 있이서 일단 disable함.
// addModifier(frontCacheGetFutureModifier);
@@ -17,6 +17,8 @@ import org.apache.thrift.transport.TIOStreamTransport;
*/
public class HeaderTBaseSerializer {
private static final String UTF8 = "UTF8";
private final ByteArrayOutputStream baos;
private final TProtocol protocol;
private final TBaseLocator locator;
@@ -61,14 +63,14 @@ public class HeaderTBaseSerializer {
}
/**
* Serialize the Thrift object into a Java string, using the default JVM
* Serialize the Thrift object into a Java string, using the UTF8
* charset encoding.
*
* @param base The object to serialize
* @return Serialized object as a String
*/
public String toString(TBase<?, ?> base) throws TException {
return new String(serialize(base));
return toString(base, UTF8);
}
/**
@@ -10,7 +10,7 @@ import org.apache.thrift.protocol.TProtocol;
*/
public class L4Packet implements org.apache.thrift.TBase<L4Packet, org.apache.thrift.TFieldIdEnum>, java.io.Serializable, Cloneable, Comparable<L4Packet> {
private final Header header;
private final transient Header header;
public L4Packet(Header header) {
this.header = header;
@@ -5,6 +5,8 @@ import org.apache.thrift.TException;
import org.apache.thrift.TFieldIdEnum;
import org.apache.thrift.protocol.TProtocol;
import java.io.UnsupportedEncodingException;
/**
* @author netspider
*/
@@ -12,8 +14,19 @@ public class NetworkAvailabilityCheckPacket implements org.apache.thrift.TBase<N
private static final long serialVersionUID = -1170704876834222604L;
public transient static final byte[] DATA_OK = "OK".getBytes();
public transient static final byte[] DATA_OK = getBytes("OK");
private static byte[] getBytes(String str) {
if (str == null) {
throw new NullPointerException("str must not be null");
}
try {
return str.getBytes("UTF8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("encoding error. Caused:" + e.getMessage(), e);
}
}
@Override
public void read(TProtocol tProtocol) throws TException {
}
@@ -9,7 +9,7 @@ import java.util.Arrays;
/**
* @author emeroad
*/
public class UnsafeByteArrayOutputStream extends ByteArrayOutputStream {
public class UnsafeByteArrayOutputStream extends OutputStream {
/**
* The buffer where data is stored.