You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2010/12/15 23:31:29 UTC

svn commit: r1049732 - /avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java

Author: cutting
Date: Wed Dec 15 22:31:29 2010
New Revision: 1049732

URL: http://svn.apache.org/viewvc?rev=1049732&view=rev
Log:
AVRO-687.  Fix a NullPointerException.

Modified:
    avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java

Modified: avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java?rev=1049732&r1=1049731&r2=1049732&view=diff
==============================================================================
--- avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java (original)
+++ avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java Wed Dec 15 22:31:29 2010
@@ -237,10 +237,10 @@ public abstract class Requestor {
 
   /** Return the remote protocol.  Force a handshake if required. */
   public synchronized Protocol getRemote() throws IOException {
+    if (remote != null) return remote;            // already have it
     MD5 remoteHash = REMOTE_HASHES.get(transceiver.getRemoteName());
     remote = REMOTE_PROTOCOLS.get(remoteHash);
-    if (remote != null)
-      return remote;
+    if (remote != null) return remote;            // already cached
     // force handshake
     ByteBufferOutputStream bbo = new ByteBufferOutputStream();
     Encoder out = new BinaryEncoder(bbo);