You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ns...@apache.org on 2016/03/18 15:48:28 UTC

[4/6] thrift git commit: THRIFT-3479 Avoid returning a message to a client on TException.

THRIFT-3479 Avoid returning a message to a client on TException.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/b3a42dd0
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/b3a42dd0
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/b3a42dd0

Branch: refs/heads/master
Commit: b3a42dd050db2657a589b7b73e3d121211649fe5
Parents: a876527
Author: Josh Elser <jo...@gmail.com>
Authored: Tue Dec 8 13:32:55 2015 -0500
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Fri Mar 18 22:37:02 2016 +0900

----------------------------------------------------------------------
 lib/java/src/org/apache/thrift/ProcessFunction.java | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/b3a42dd0/lib/java/src/org/apache/thrift/ProcessFunction.java
----------------------------------------------------------------------
diff --git a/lib/java/src/org/apache/thrift/ProcessFunction.java b/lib/java/src/org/apache/thrift/ProcessFunction.java
index 19c8f14..992e859 100644
--- a/lib/java/src/org/apache/thrift/ProcessFunction.java
+++ b/lib/java/src/org/apache/thrift/ProcessFunction.java
@@ -39,12 +39,14 @@ public abstract class ProcessFunction<I, T extends TBase> {
       result = getResult(iface, args);
     } catch(TException tex) {
       LOGGER.error("Internal error processing " + getMethodName(), tex);
-      TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, 
-        "Internal error processing " + getMethodName());
-      oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.EXCEPTION, seqid));
-      x.write(oprot);
-      oprot.writeMessageEnd();
-      oprot.getTransport().flush();
+      if (!isOneway()) {
+        TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, 
+          "Internal error processing " + getMethodName());
+        oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.EXCEPTION, seqid));
+        x.write(oprot);
+        oprot.writeMessageEnd();
+        oprot.getTransport().flush();
+      }
       return;
     }