cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eev...@apache.org
Subject svn commit: r1082712 - in /cassandra/trunk/src/java/org/apache/cassandra/db/marshal: IntegerType.java LexicalUUIDType.java LongType.java TimeUUIDType.java
Date Thu, 17 Mar 2011 21:37:51 GMT
Author: eevans
Date: Thu Mar 17 21:37:51 2011
New Revision: 1082712

URL: http://svn.apache.org/viewvc?rev=1082712&view=rev
Log:
AT.fromString() should return empty BB for empty String

Patch by eevans; reviewed by gdusbabek for CASSANDRA-2352

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java?rev=1082712&r1=1082711&r2=1082712&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java Thu Mar 17 21:37:51
2011
@@ -132,6 +132,10 @@ public final class IntegerType extends A
 
     public ByteBuffer fromString(String source) throws MarshalException
     {
+        // Return an empty ByteBuffer for an empty string.
+        if (source.isEmpty())
+            return ByteBuffer.allocate(0);
+        
         BigInteger integerType;
 
         try

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java?rev=1082712&r1=1082711&r2=1082712&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java Thu Mar
17 21:37:51 2011
@@ -66,6 +66,10 @@ public class LexicalUUIDType extends Abs
 
     public ByteBuffer fromString(String source) throws MarshalException
     {
+        // Return an empty ByteBuffer for an empty string.
+        if (source.isEmpty())
+            return ByteBuffer.allocate(0);
+        
         try
         {
             return ByteBuffer.wrap(UUIDGen.decompose(UUID.fromString(source)));

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java?rev=1082712&r1=1082711&r2=1082712&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java Thu Mar 17 21:37:51
2011
@@ -72,6 +72,10 @@ public class LongType extends AbstractTy
 
     public ByteBuffer fromString(String source) throws MarshalException
     {
+        // Return an empty ByteBuffer for an empty string.
+        if (source.isEmpty())
+            return ByteBuffer.allocate(0);
+        
         long longType;
 
         try

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java?rev=1082712&r1=1082711&r2=1082712&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java Thu Mar 17
21:37:51 2011
@@ -120,6 +120,10 @@ public class TimeUUIDType extends Abstra
 
     public ByteBuffer fromString(String source) throws MarshalException
     {
+        // Return an empty ByteBuffer for an empty string.
+        if (source.isEmpty())
+            return ByteBuffer.allocate(0);
+        
         ByteBuffer idBytes = null;
         
         // ffffffff-ffff-ffff-ffff-ffffffffff



Mime
View raw message