Merge branch 'cassandra-2.1' into trunk

This commit is contained in:
Sylvain Lebresne 2014-05-08 18:05:28 +02:00
commit 28497fd11b
7 changed files with 9 additions and 9 deletions

View File

@ -23,6 +23,7 @@ Merged from 2.0:
* reduce garbage creation in calculatePendingRanges (CASSANDRA-7191)
* fix c* launch issues on Russian os's due to output of linux 'free' cmd (CASSANDRA-6162)
* Fix disabling autocompaction (CASSANDRA-7187)
* Fix potential NumberFormatException when deserializing IntegerType (CASSANDRA-7088)
Merged from 1.2:
* Add Cloudstack snitch (CASSANDRA-7147)
* Update system.peers correctly when relocating tokens (CASSANDRA-7126)

View File

@ -77,8 +77,7 @@ public abstract class AbstractType<T> implements Comparator<ByteBuffer>
TypeSerializer<T> serializer = getSerializer();
serializer.validate(bytes);
T value = serializer.deserialize(bytes);
return value == null ? "null" : serializer.toString(value);
return serializer.toString(serializer.deserialize(bytes));
}
/** get a byte representation of the given string. */

View File

@ -65,7 +65,7 @@ public class InetAddressSerializer implements TypeSerializer<InetAddress>
public String toString(InetAddress value)
{
return value.getHostAddress();
return value == null ? "" : value.getHostAddress();
}
public Class<InetAddress> getType()

View File

@ -29,12 +29,12 @@ public class IntegerSerializer implements TypeSerializer<BigInteger>
public BigInteger deserialize(ByteBuffer bytes)
{
return new BigInteger(ByteBufferUtil.getArray(bytes));
return bytes.hasRemaining() ? new BigInteger(ByteBufferUtil.getArray(bytes)) : null;
}
public ByteBuffer serialize(BigInteger value)
{
return ByteBuffer.wrap(value.toByteArray());
return value == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBuffer.wrap(value.toByteArray());
}
public void validate(ByteBuffer bytes) throws MarshalException
@ -44,7 +44,7 @@ public class IntegerSerializer implements TypeSerializer<BigInteger>
public String toString(BigInteger value)
{
return value.toString(10);
return value == null ? "" : value.toString(10);
}
public Class<BigInteger> getType()

View File

@ -44,7 +44,7 @@ public class LongSerializer implements TypeSerializer<Long>
public String toString(Long value)
{
return String.valueOf(value);
return value == null ? "" : String.valueOf(value);
}
public Class<Long> getType()

View File

@ -72,7 +72,7 @@ public class TimestampSerializer implements TypeSerializer<Date>
public String toString(Date value)
{
return FORMATTER.get().format(value);
return value == null ? "" : FORMATTER.get().format(value);
}
public Class<Date> getType()

View File

@ -46,7 +46,7 @@ public class UUIDSerializer implements TypeSerializer<UUID>
public String toString(UUID value)
{
return value.toString();
return value == null ? "" : value.toString();
}
public Class<UUID> getType()