Author: degenaro
Date: Mon Mar 31 10:11:23 2014
New Revision: 1583284

URL: http://svn.apache.org/r1583284
Log:
UIMA-3710 DUCC Job Driver (JD) does not check top level during analysis of 
Exception stack

Added:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/test/java/org/apache/uima/ducc/common/test/JdProcessExceptionAnalysisTest.java
   (with props)
Modified:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java?rev=1583284&r1=1583283&r2=1583284&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/jd/plugin/AbstractJdProcessExceptionHandler.java
 Mon Mar 31 10:11:23 2014
@@ -91,17 +91,17 @@ public abstract class AbstractJdProcessE
                return s1.contains(s2);
        }
        
-       protected enum AnalysisOfCause {
+       public enum AnalysisOfCause {
                WireFormatTimeout,
                RemoteTimeout,
                LocalTimeout,
                Other
        }
        
-       protected AnalysisOfCause getAnalysisOfCause(Throwable t) {
+       public AnalysisOfCause getAnalysisOfCause(Throwable t) {
                AnalysisOfCause retVal = AnalysisOfCause.Other;
                if(t != null) {
-                       Throwable nextCause = t.getCause();
+                       Throwable nextCause = t;
                        int level = 0;
                        while( nextCause != null ) {
                                String sCause = nextCause.toString();

Added: 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/test/java/org/apache/uima/ducc/common/test/JdProcessExceptionAnalysisTest.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/test/java/org/apache/uima/ducc/common/test/JdProcessExceptionAnalysisTest.java?rev=1583284&view=auto
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/test/java/org/apache/uima/ducc/common/test/JdProcessExceptionAnalysisTest.java
 (added)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/test/java/org/apache/uima/ducc/common/test/JdProcessExceptionAnalysisTest.java
 Mon Mar 31 10:11:23 2014
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.common.test;
+
+import static org.junit.Assert.fail;
+
+import 
org.apache.uima.ducc.common.jd.plugin.AbstractJdProcessExceptionHandler.AnalysisOfCause;
+import org.apache.uima.ducc.common.jd.plugin.JdProcessExceptionHandler;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JdProcessExceptionAnalysisTest {
+
+       @BeforeClass
+       public static void setUpBeforeClass() throws Exception {
+       }
+
+       @AfterClass
+       public static void tearDownAfterClass() throws Exception {
+       }
+
+       @Before
+       public void setUp() throws Exception {
+       }
+
+       @After
+       public void tearDown() throws Exception {
+       }
+       
+       @Test
+       public void test() {
+               try {
+                       JdProcessExceptionHandler jdx = new 
JdProcessExceptionHandler();
+                       String message = "Wire format negotiation timeout: peer 
did not send his wire format.";
+                       try {
+                               throw new 
org.apache.uima.aae.error.UimaEEServiceException(message);
+                       }
+                       catch(Exception e) {
+                               AnalysisOfCause aoc = jdx.getAnalysisOfCause(e);
+                               switch(aoc) {
+                               case WireFormatTimeout:
+                                       break;
+                               default:
+                                       fail("Incorrect analysis");
+                               }
+                       }
+               }
+               catch(Exception e) {
+                       e.printStackTrace();
+                       fail("Exception");
+               }
+               
+       }
+
+}

Propchange: 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/test/java/org/apache/uima/ducc/common/test/JdProcessExceptionAnalysisTest.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to