Author: cwiklik
Date: Thu Aug 10 00:15:21 2017
New Revision: 1804619

URL: http://svn.apache.org/viewvc?rev=1804619&view=rev
Log:
UIMA-5529 more changes to getLastSerializedError() to streamline it

Modified:
    
uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jp/DuccAbstractProcessContainer.java

Modified: 
uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jp/DuccAbstractProcessContainer.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jp/DuccAbstractProcessContainer.java?rev=1804619&r1=1804618&r2=1804619&view=diff
==============================================================================
--- 
uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jp/DuccAbstractProcessContainer.java
 (original)
+++ 
uima/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jp/DuccAbstractProcessContainer.java
 Thu Aug 10 00:15:21 2017
@@ -206,28 +206,25 @@ public abstract class DuccAbstractProces
                if (errorMap.containsKey(Thread.currentThread().getId())) {
                        Throwable lastError = 
                                        
errorMap.get(Thread.currentThread().getId());
-                       if ( lastError != null ) {
-                               if ( 
System.getProperty("SendExceptionAsString")!= null ) {
-                                       // the client of this JP/Service does 
not have user classpath
-                                       // to be able to deserialize this 
exception. Instead of serializing
-                                       // the exception as a java object, 
stringify it first and wrap it.
-                                       // The client process might want to log 
this error.
+                       if ( System.getProperty("SendExceptionAsString")!= null 
) {
+                               // the client of this JP/Service does not have 
user classpath
+                               // to be able to deserialize this exception. 
Instead of serializing
+                               // the exception as a java object, stringify it 
first and wrap it.
+                               // The client process might want to log this 
error.
+                               result = serialize(new 
RuntimeException(serializeAsString(lastError)));
+                       } else {
+                               try {
+                                       // try to serialize Throwable as a java 
Object
+                                       result = serialize(lastError);
+                               } catch( Exception e) {
+                                       // Fallback is to stringify the 
exception and wrap it
                                        result = serialize(new 
RuntimeException(serializeAsString(lastError)));
-                               } else {
-                                       try {
-                                               // try to serialize as java 
Object
-                                               result = serialize(lastError);
-                                       } catch( Exception e) {
-                                               // Fallback is to stringify the 
exception and wrap it
-                                               result = serialize(new 
RuntimeException(serializeAsString(lastError)));
-                                       }
                                }
-                       } 
-               } 
-               if ( result == null ) {
-                       // this is not be normal that we are here. This method 
was 
+                       }
+               } else {  // Throwable not found for this thread id in errorMap
+                       // this is not normal that we are here. This method was 
                        // called since the process() failed. An exception 
should have
-                       // been added to the errorMap in such case with 
key=thread id
+                       // been added to the errorMap with a key=thread id
                        result = serialize(new RuntimeException("AE.process( 
)failed - check service log"));
                }
                return result;


Reply via email to