cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eev...@apache.org
Subject svn commit: r1080025 - /cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java
Date Wed, 09 Mar 2011 22:00:36 GMT
Author: eevans
Date: Wed Mar  9 22:00:36 2011
New Revision: 1080025

URL: http://svn.apache.org/viewvc?rev=1080025&view=rev
Log:
handle NumberFormatExceptions from BytesType.fromString

Patch by eevans for CASSANDRA-2027

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java?rev=1080025&r1=1080024&r2=1080025&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java Wed Mar  9 22:00:36
2011
@@ -61,7 +61,14 @@ public class BytesType extends AbstractT
 
     public ByteBuffer fromString(String source)
     {
-        return ByteBuffer.wrap(FBUtilities.hexToBytes(source));
+        try
+        {
+            return ByteBuffer.wrap(FBUtilities.hexToBytes(source));
+        }
+        catch (NumberFormatException e)
+        {
+            throw new MarshalException(String.format("cannot parse '%s' as hex bytes", source),
e);
+        }
     }
 
     public void validate(ByteBuffer bytes) throws MarshalException



Mime
View raw message