From: Bryan Duxbury Date: Wed, 17 Mar 2010 16:47:41 +0000 (+0000) Subject: THRIFT-738. java: TCompactProtocol throws RuntimeException when it can't identify... X-Git-Tag: 0.3.0~65 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=f35a9b9152b66fc47c36ff25240e7704172d18ae;p=common%2Fthrift.git THRIFT-738. java: TCompactProtocol throws RuntimeException when it can't identify a type identifier This patch causes it to throw TProtocolException instead. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@924364 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java b/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java index ea333b68..8c29b3c6 100755 --- a/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java +++ b/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java @@ -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 extends TProtocol { * 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 extends TProtocol { 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)); } }