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 2018/12/13 16:56:54 UTC

svn commit: r1848867 - /uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/transport/http/HttpServiceTransport.java

Author: cwiklik
Date: Thu Dec 13 16:56:54 2018
New Revision: 1848867

URL: http://svn.apache.org/viewvc?rev=1848867&view=rev
Log:
UIMA-5933 when throwing simulated errors optimized for..loop processing ERROR enums

Modified:
    uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/transport/http/HttpServiceTransport.java

Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/transport/http/HttpServiceTransport.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/transport/http/HttpServiceTransport.java?rev=1848867&r1=1848866&r2=1848867&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/transport/http/HttpServiceTransport.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/transport/http/HttpServiceTransport.java Thu Dec 13 16:56:54 2018
@@ -289,6 +289,7 @@ public class HttpServiceTransport implem
 			// NoHttpResponseException, 
 			// HttpHostConnectException, 
 			// URISyntaxException
+			// Use JUnit test JunitTransoirtTestCase to test the above errors
 			
 			if ( ( simulatedException = System.getProperty("MockHttpPostError")) != null ) {
 				HttpClientExceptionGenerator mockExceptionGenerator = 
@@ -307,7 +308,6 @@ public class HttpServiceTransport implem
 					log = false;
 					stats.incrementErrorCount();
 					logger.log(Level.WARNING, this.getClass().getName()+".dispatch() >>>>>>>>>> Handling Exception \n"+ex);
-//					System.out.println( this.getClass().getName()+".dispatch() >>>>>>>>>> Unable to communicate with target:"+currentTargetUrl.asString()+" - retrying until successfull - with "+threadSleepTime/1000+" seconds wait between retries  ");
 					logger.log(Level.INFO, ">>>>>>>>>> Unable to communicate with target:"+currentTargetUrl.asString()+" - retrying until successfull - with "+threadSleepTime/1000+" seconds wait between retries  ");
 				}
 				serializedResponse = retryUntilSuccessfull(serializedRequest, postMethod);
@@ -359,9 +359,10 @@ public class HttpServiceTransport implem
 	public static class HttpClientExceptionGenerator {
 		public enum ERROR{ IOException, SocketException, UnknownHostException, NoRouteToHostException,NoHttpResponseException, HttpHostConnectException, URISyntaxException};
 		
-		Exception exceptionClass;
+		Exception exceptionClass=null;
 		
 		public HttpClientExceptionGenerator(String exc) {
+			
 			for( ERROR e : ERROR.values()) {
 				if ( exc != null && e.name().equals(exc)) {
 					switch(e) {
@@ -388,6 +389,9 @@ public class HttpServiceTransport implem
 						
 							
 					}
+					if ( exceptionClass != null ) {
+						break;
+					}
 				}
 			}
 		}