You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2010/03/17 17:47:41 UTC

svn commit: r924364 - /incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java

Author: bryanduxbury
Date: Wed Mar 17 16:47:41 2010
New Revision: 924364

URL: http://svn.apache.org/viewvc?rev=924364&view=rev
Log:
THRIFT-738. java: TCompactProtocol throws RuntimeException when it can't identify a type identifier

This patch causes it to throw TProtocolException instead.

Modified:
    incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java

Modified: incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java?rev=924364&r1=924363&r2=924364&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java (original)
+++ incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java Wed Mar 17 16:47:41 2010
@@ -20,11 +20,11 @@
 
 package org.apache.thrift.protocol;
 
-import java.util.Stack;
 import java.io.UnsupportedEncodingException;
+import java.util.Stack;
 
-import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.TException;
+import org.apache.thrift.transport.TTransport;
 
 /**
  * TCompactProtocol2 is the Java implementation of the compact protocol specified
@@ -729,7 +729,7 @@ public final class TCompactProtocol exte
    * Given a TCompactProtocol.Types constant, convert it to its corresponding 
    * TType value.
    */
-  private byte getTType(byte type) {
+  private byte getTType(byte type) throws TProtocolException {
     switch ((byte)(type & 0x0f)) {
       case TType.STOP:
         return TType.STOP;
@@ -757,7 +757,7 @@ public final class TCompactProtocol exte
       case Types.STRUCT:
         return TType.STRUCT;
       default:
-        throw new RuntimeException("don't know what type: " + (byte)(type & 0x0f));
+        throw new TProtocolException("don't know what type: " + (byte)(type & 0x0f));
     }
   }