diff options
author | Carl Yeksigian <carl@apache.org> | 2013-08-14 19:37:54 -0400 |
---|---|---|
committer | Carl Yeksigian <carl@apache.org> | 2013-08-14 19:38:42 -0400 |
commit | 2ca9c2028593782621c8876817d8772aa5f46ac7 (patch) | |
tree | 75d9cbde1f9994b5b8b7cb0b637504d66787a39f /lib/javame | |
parent | d051ca0b23eab53ede689ba319256e5f30feebf8 (diff) | |
download | thrift-2ca9c2028593782621c8876817d8772aa5f46ac7.tar.gz |
THRIFT-820 Remove readLength attribute from BinaryProtocol
Patch: Carl Yeksigian
Diffstat (limited to 'lib/javame')
-rw-r--r-- | lib/javame/src/org/apache/thrift/protocol/TBinaryProtocol.java | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/lib/javame/src/org/apache/thrift/protocol/TBinaryProtocol.java b/lib/javame/src/org/apache/thrift/protocol/TBinaryProtocol.java index 1d16889e7..f6fe76543 100644 --- a/lib/javame/src/org/apache/thrift/protocol/TBinaryProtocol.java +++ b/lib/javame/src/org/apache/thrift/protocol/TBinaryProtocol.java @@ -1,4 +1,4 @@ -/* + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -36,9 +36,6 @@ public class TBinaryProtocol extends TProtocol { protected boolean strictRead_ = false; protected boolean strictWrite_ = true; - protected int readLength_; - protected boolean checkReadLength_ = false; - /** * Factory */ @@ -311,7 +308,6 @@ public class TBinaryProtocol extends TProtocol { public String readStringBody(int size) throws TException { try { - checkReadLength(size); byte[] buf = new byte[size]; trans_.readAll(buf, 0, size); return new String(buf, "UTF-8"); @@ -322,29 +318,12 @@ public class TBinaryProtocol extends TProtocol { public byte[] readBinary() throws TException { int size = readI32(); - checkReadLength(size); byte[] buf = new byte[size]; trans_.readAll(buf, 0, size); return buf; } private int readAll(byte[] buf, int off, int len) throws TException { - checkReadLength(len); return trans_.readAll(buf, off, len); } - - public void setReadLength(int readLength) { - readLength_ = readLength; - checkReadLength_ = true; - } - - protected void checkReadLength(int length) throws TException { - if (checkReadLength_) { - readLength_ -= length; - if (readLength_ < 0) { - throw new TException("Message length exceeded: " + length); - } - } - } - } |