You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2009/11/11 21:48:00 UTC

svn commit: r835061 - /incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java

Author: cwiklik
Date: Wed Nov 11 20:48:00 2009
New Revision: 835061

URL: http://svn.apache.org/viewvc?rev=835061&view=rev
Log:
UIMA-1459 modified reject() to prevent dereferencing null variable

Modified:
    incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java

Modified: incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java?rev=835061&r1=835060&r2=835061&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java Wed Nov 11 20:48:00 2009
@@ -171,22 +171,24 @@
           //  fetch the cache entry for this CAS
           ClientRequest cacheEntry = (ClientRequest) engine.getCache().get(
                   pm.get(AsynchAEMessage.CasReference));
-          //  We are rejecting any Process requests until connection to broker
-          //  is recovered
-          cacheEntry.setProcessException();
-          //  if the request was via synchronous API dont notify listeners
-          //  instead the code will throw exception to the client
-          boolean notifyListener = (cacheEntry.isSynchronousInvocation() == false);
-          //  handle rejected request
-          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
-            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(),
-                    "reject", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
-                    "UIMAJMS_client_rejected_process_request_broker_down__INFO", new Object[] { messageKind });
+          if ( cacheEntry != null ) {
+            //  We are rejecting any Process requests until connection to broker
+            //  is recovered
+            cacheEntry.setProcessException();
+            //  if the request was via synchronous API dont notify listeners
+            //  instead the code will throw exception to the client
+            boolean notifyListener = (cacheEntry.isSynchronousInvocation() == false);
+            //  handle rejected request
+            if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+              UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(),
+                      "reject", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+                      "UIMAJMS_client_rejected_process_request_broker_down__INFO", new Object[] { messageKind });
+            }
+            //  Sets the state of a remote delegate to handle subsequent requests
+            engine.serviceDelegate.setState(Delegate.TIMEOUT_STATE);
+            //  handle exception but dont rethrow the exception
+            engine.handleException(e, cacheEntry.getCasReferenceId(), null, cacheEntry, notifyListener, false);
           }
-          //  Sets the state of a remote delegate to handle subsequent requests
-          engine.serviceDelegate.setState(Delegate.TIMEOUT_STATE);
-          //  handle exception but dont rethrow the exception
-          engine.handleException(e, cacheEntry.getCasReferenceId(), null, cacheEntry, notifyListener, false);
         } else {
           //  Dont handle GetMeta Ping. Let it flow through. The Ping will be done once the connection is recovered
           if ( !engine.serviceDelegate.isAwaitingPingReply()) {