protocol exceptions in java
Reviewed By: aditya
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665012 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/src/protocol/TProtocolException.java b/lib/java/src/protocol/TProtocolException.java
new file mode 100644
index 0000000..fa172de
--- /dev/null
+++ b/lib/java/src/protocol/TProtocolException.java
@@ -0,0 +1,59 @@
+package com.facebook.thrift.protocol;
+
+import com.facebook.thrift.TException;
+
+/**
+ * Protocol exceptions.
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+public class TProtocolException extends TException {
+
+ public static final int UNKNOWN = 0;
+ public static final int INVALID_DATA = 1;
+ public static final int NEGATIVE_SIZE = 2;
+ public static final int SIZE_LIMIT = 3;
+
+ protected int type_ = UNKNOWN;
+
+ public TProtocolException() {
+ super();
+ }
+
+ public TProtocolException(int type) {
+ super();
+ type_ = type;
+ }
+
+ public TProtocolException(int type, String message) {
+ super(message);
+ type_ = type;
+ }
+
+ public TProtocolException(String message) {
+ super(message);
+ }
+
+ public TProtocolException(int type, Throwable cause) {
+ super(cause);
+ type_ = type;
+ }
+
+ public TProtocolException(Throwable cause) {
+ super(cause);
+ }
+
+ public TProtocolException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TProtocolException(int type, String message, Throwable cause) {
+ super(message, cause);
+ type_ = type;
+ }
+
+ public int getType() {
+ return type_;
+ }
+
+}