Author: kamrul
Date: Tue Apr  3 01:59:14 2012
New Revision: 1308649

URL: http://svn.apache.org/viewvc?rev=1308649&view=rev
Log:
OOZIE-797 Action retry not reading default error code.(Mona via Mohammad)

Modified:
    
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/LiteWorkflowStoreService.java
    incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
    
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowStoreService.java
    incubator/oozie/trunk/release-log.txt

Modified: 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/LiteWorkflowStoreService.java
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/LiteWorkflowStoreService.java?rev=1308649&r1=1308648&r2=1308649&view=diff
==============================================================================
--- 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/LiteWorkflowStoreService.java
 (original)
+++ 
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/LiteWorkflowStoreService.java
 Tue Apr  3 01:59:14 2012
@@ -18,6 +18,7 @@
 package org.apache.oozie.service;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.StringUtils;
 import org.apache.oozie.command.wf.ReRunXCommand;
 
 import org.apache.oozie.client.WorkflowAction;
@@ -168,8 +169,11 @@ public abstract class LiteWorkflowStoreS
      */
     public static Set<String> getUserRetryErrorCode() {
         Configuration conf = 
Services.get().get(ConfigurationService.class).getConf();
-        Collection<String> strings = (Collection<String>) 
conf.getStringCollection(CONF_USER_RETRY_ERROR_CODE);
-        Collection<String> extra = (Collection<String>) 
conf.getStringCollection(CONF_USER_RETRY_ERROR_CODE_EXT);
+        // eliminating whitespaces in the error codes value specification
+        String errorCodeString = 
conf.get(CONF_USER_RETRY_ERROR_CODE).replaceAll("\\s+", "");
+        Collection<String> strings = 
StringUtils.getStringCollection(errorCodeString);
+        String errorCodeExtString = 
conf.get(CONF_USER_RETRY_ERROR_CODE_EXT).replaceAll("\\s+", "");
+        Collection<String> extra = 
StringUtils.getStringCollection(errorCodeExtString);
         Set<String> set = new HashSet<String>();
         set.addAll(strings);
         set.addAll(extra);

Modified: incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/resources/oozie-default.xml?rev=1308649&r1=1308648&r2=1308649&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/resources/oozie-default.xml (original)
+++ incubator/oozie/trunk/core/src/main/resources/oozie-default.xml Tue Apr  3 
01:59:14 2012
@@ -1456,18 +1456,10 @@
             Automatic retry interval for workflow action is in minutes and the 
default value is 10 minutes.
         </description>
     </property>
-    
+
     <property>
         
<name>oozie.service.LiteWorkflowStoreService.user.retry.error.code</name>
-        <value>
-            JA008,
-            JA009,
-            JA017,
-            JA018,
-            JA019,
-            FS009,
-            FS008
-        </value>
+        <value>JA008,JA009,JA017,JA018,JA019,FS009,FS008</value>
         <description>
             Automatic retry interval for workflow action is handled for these 
specified error code:
             FS009, FS008 is file exists error when using chmod in fs action.

Modified: 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowStoreService.java
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowStoreService.java?rev=1308649&r1=1308648&r2=1308649&view=diff
==============================================================================
--- 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowStoreService.java
 (original)
+++ 
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowStoreService.java
 Tue Apr  3 01:59:14 2012
@@ -17,6 +17,10 @@
  */
 package org.apache.oozie.service;
 
+import java.util.Set;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.oozie.ForTestingActionExecutor;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.service.WorkflowStoreService;
 import org.apache.oozie.test.XTestCase;
@@ -43,5 +47,17 @@ public class TestLiteWorkflowStoreServic
         assertNotNull(wls.create());
     }
 
+    public void testRetry() throws Exception {
+        //  Introducing whitespaces in the error codes string
+        String errorCodeWithWhitespaces = "\n\t\t" + 
ForTestingActionExecutor.TEST_ERROR + "\n  ";
+        Configuration testConf = 
Services.get().get(ConfigurationService.class).getConf();
+        // Setting configuration parameter for error codes
+        testConf.set(LiteWorkflowStoreService.CONF_USER_RETRY_ERROR_CODE, 
errorCodeWithWhitespaces);
+        testConf.set(LiteWorkflowStoreService.CONF_USER_RETRY_ERROR_CODE_EXT, 
" ");
+        // Retrieval to enlist the codes properly, otherwise whitespaces cause 
the key-value lookup to return false
+        Set<String> allowedRetryCodes = 
LiteWorkflowStoreService.getUserRetryErrorCode();
+        
assertTrue(allowedRetryCodes.contains(ForTestingActionExecutor.TEST_ERROR));   
+    }
+
 
 }

Modified: incubator/oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1308649&r1=1308648&r2=1308649&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Tue Apr  3 01:59:14 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.2.0 release
 
+OOZIE-797 Action retry not reading default error code.(Mona via Mohammad)
 OOZIE-780: XConfiguration parser can't parse XML file with <include> element 
(Virag via Mohammad)
 OOZIE-794: oozie job -info -filter should error out on bundle job and workflow 
job (virag via Mohammad)
 OOZIE-799: Testcases failing due to missing action-conf dir. (Virag via 
Mohammad)


Reply via email to