You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by an...@apache.org on 2018/07/10 12:49:29 UTC

oozie git commit: OOZIE-3208 "It should never happen" error messages should be more specific to root cause (kmarton via andras.piros)

Repository: oozie
Updated Branches:
  refs/heads/master 6b89aba42 -> 03b1a9f1e


OOZIE-3208 "It should never happen" error messages should be more specific to root cause (kmarton via andras.piros)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/03b1a9f1
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/03b1a9f1
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/03b1a9f1

Branch: refs/heads/master
Commit: 03b1a9f1e8d9443b337770bb3ecf7b43aeec49e8
Parents: 6b89aba
Author: Andras Piros <an...@cloudera.com>
Authored: Tue Jul 10 14:48:34 2018 +0200
Committer: Andras Piros <an...@cloudera.com>
Committed: Tue Jul 10 14:48:34 2018 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/oozie/DagELFunctions.java  |  2 +-
 core/src/main/java/org/apache/oozie/ErrorCode.java  |  1 -
 .../oozie/action/hadoop/JavaActionExecutor.java     | 10 +++++-----
 .../command/coord/CoordActionReadyXCommand.java     |  6 ++----
 .../org/apache/oozie/command/wf/ActionXCommand.java |  2 +-
 .../apache/oozie/service/CallableQueueService.java  |  2 +-
 .../apache/oozie/service/ConfigurationService.java  | 16 +++++-----------
 .../org/apache/oozie/util/ELConstantsFunctions.java |  5 +++--
 .../java/org/apache/oozie/util/XConfiguration.java  |  2 +-
 .../main/java/org/apache/oozie/util/XmlUtils.java   |  4 ++--
 release-log.txt                                     |  1 +
 11 files changed, 22 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/DagELFunctions.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/DagELFunctions.java b/core/src/main/java/org/apache/oozie/DagELFunctions.java
index 1795852..8593d99 100644
--- a/core/src/main/java/org/apache/oozie/DagELFunctions.java
+++ b/core/src/main/java/org/apache/oozie/DagELFunctions.java
@@ -78,7 +78,7 @@ public class DagELFunctions {
                                   new XConfiguration(new StringReader(workflow.getProtoActionConf())));
         }
         catch (IOException ex) {
-            throw new RuntimeException("It should not happen", ex);
+            throw new RuntimeException("Failed to read the configuration", ex);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/ErrorCode.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/ErrorCode.java b/core/src/main/java/org/apache/oozie/ErrorCode.java
index 168c4fa..9cc153b 100644
--- a/core/src/main/java/org/apache/oozie/ErrorCode.java
+++ b/core/src/main/java/org/apache/oozie/ErrorCode.java
@@ -36,7 +36,6 @@ public enum ErrorCode {
     E0022(XLog.OPS, "Configuration file must be a file name [{0}]"),
     E0023(XLog.OPS, "Default configuration file [{0}] not found in classpath"),
     E0024(XLog.OPS, "Oozie configuration directory does not exist [{0}]"),
-    E0025(XLog.OPS, "Configuration service internal error, it should never happen, {0}"),
     E0026(XLog.OPS, "Missing required configuration property [{0}]"),
 
     E0100(XLog.OPS, "Could not initialize service [{0}], {1}"),

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
index ed809ef..a1a9671 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
@@ -626,7 +626,7 @@ public class JavaActionExecutor extends ActionExecutor {
                         ex.getMessage());
             }
             catch (IOException ex) {
-                throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "It should never happen",
+                throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "Failed to add libpaths to cache",
                         ex.getMessage());
             }
         }
@@ -646,8 +646,8 @@ public class JavaActionExecutor extends ActionExecutor {
                 addLibPathsToClassPath(conf, shareLibService.getSystemLibJars(getType()));
             }
             catch (IOException ex) {
-                throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "It should never happen",
-                        ex.getMessage());
+                throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED,
+                        "Failed to add action specific sharelib", ex.getMessage());
             }
         }
     }
@@ -710,7 +710,7 @@ public class JavaActionExecutor extends ActionExecutor {
             }
             catch (IOException ex){
                 throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED,
-                        "It should never happen", ex.getMessage());
+                        "Failed to add action specific lib", ex.getMessage());
             }
         }
     }
@@ -771,7 +771,7 @@ public class JavaActionExecutor extends ActionExecutor {
             wfJobConf = getWorkflowConf(context);
         }
         catch (IOException ioe) {
-            throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "It should never happen",
+            throw new ActionExecutorException(ActionExecutorException.ErrorType.FAILED, "Failed to add action specific sharelib",
                     ioe.getMessage());
         }
         // Action sharelibs are only added if user has specified to use system libpath

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
index 40bd931..a63784d 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
@@ -136,10 +136,8 @@ public class CoordActionReadyXCommand extends CoordinatorXCommand<Void> {
                                     DateUtils.formatDateOozieTZ(now), DateUtils.formatDateOozieTZ(nextNominalTime));
                         }
                     }
-                } catch (ParseException e) {
-                    LOG.error("Should not happen", e);
-                } catch (JDOMException e) {
-                    LOG.error("Should not happen", e);
+                } catch (ParseException | JDOMException e) {
+                    LOG.error("Failed to calculate next nominal time", e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java
index 290a07b..2207546 100644
--- a/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/wf/ActionXCommand.java
@@ -313,7 +313,7 @@ public abstract class ActionXCommand<T> extends WorkflowXCommand<T> {
                     protoConf = new XConfiguration(new StringReader(workflow.getProtoActionConf()));
                 }
                 catch (IOException ex) {
-                    throw new RuntimeException("It should not happen", ex);
+                    throw new RuntimeException("Failed to construct the proto configuration", ex);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/service/CallableQueueService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/CallableQueueService.java b/core/src/main/java/org/apache/oozie/service/CallableQueueService.java
index dace26c..ef8d58d 100644
--- a/core/src/main/java/org/apache/oozie/service/CallableQueueService.java
+++ b/core/src/main/java/org/apache/oozie/service/CallableQueueService.java
@@ -125,7 +125,7 @@ public class CallableQueueService implements Service, Instrumentable {
         synchronized (activeCallables) {
             AtomicInteger counter = activeCallables.get(callable.getType());
             if (counter == null) {
-                throw new IllegalStateException("It should not happen");
+                throw new IllegalStateException("Counter value should not be null");
             }
             else {
                 counter.decrementAndGet();

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/service/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/ConfigurationService.java b/core/src/main/java/org/apache/oozie/service/ConfigurationService.java
index 618d5e6..702a8f1 100644
--- a/core/src/main/java/org/apache/oozie/service/ConfigurationService.java
+++ b/core/src/main/java/org/apache/oozie/service/ConfigurationService.java
@@ -256,18 +256,12 @@ public class ConfigurationService implements Service, Instrumentable {
         }
 
         if (log.isTraceEnabled()) {
-            try {
-                StringWriter writer = new StringWriter();
-                for (Map.Entry<String, String> entry : configuration) {
-                    String value = getValue(configuration, entry.getKey());
-                    writer.write(" " + entry.getKey() + " = " + value + "\n");
-                }
-                writer.close();
-                log.trace("Configuration:\n{0}---", writer.toString());
-            }
-            catch (IOException ex) {
-                throw new ServiceException(ErrorCode.E0025, ex.getMessage(), ex);
+            StringWriter writer = new StringWriter();
+            for (Map.Entry<String, String> entry : configuration) {
+                String value = getValue(configuration, entry.getKey());
+                writer.write(" " + entry.getKey() + " = " + value + "\n");
             }
+            log.trace("Configuration:\n{0}---", writer.toString());
         }
 
         String[] ignoreSysProps = configuration.getStrings(CONF_IGNORE_SYS_PROPS);

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java b/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java
index 7039c48..731b489 100644
--- a/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java
+++ b/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java
@@ -179,11 +179,12 @@ public class ELConstantsFunctions {
      * @return the encoded <code>String</code>
      */
     public static String urlEncode(String input) {
+        final String encoding = "UTF-8";
         try {
-            return (input == null) ? "" : URLEncoder.encode(input, "UTF-8");
+            return (input == null) ? "" : URLEncoder.encode(input, encoding);
         }
         catch (UnsupportedEncodingException uee) {
-            throw new RuntimeException("It should never happen");
+            throw new RuntimeException(encoding + " encoding is not supported", uee);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/util/XConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/XConfiguration.java b/core/src/main/java/org/apache/oozie/util/XConfiguration.java
index d9e16e9..d6e59a6 100644
--- a/core/src/main/java/org/apache/oozie/util/XConfiguration.java
+++ b/core/src/main/java/org/apache/oozie/util/XConfiguration.java
@@ -370,7 +370,7 @@ public class XConfiguration extends Configuration {
             xml = new String(baos.toByteArray(), Charsets.UTF_8);
         }
         catch (IOException ex) {
-            throw new RuntimeException("It should not happen, " + ex.getMessage(), ex);
+            throw new RuntimeException("Xml writing failed, " + ex.getMessage(), ex);
         }
         if (!prolog) {
             xml = xml.substring(xml.indexOf("<configuration>"));

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/core/src/main/java/org/apache/oozie/util/XmlUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/XmlUtils.java b/core/src/main/java/org/apache/oozie/util/XmlUtils.java
index 054d5d9..177fb62 100644
--- a/core/src/main/java/org/apache/oozie/util/XmlUtils.java
+++ b/core/src/main/java/org/apache/oozie/util/XmlUtils.java
@@ -93,7 +93,7 @@ public class XmlUtils {
             return prettyPrint(document.getRootElement()).toString();
         }
         catch (IOException ex) {
-            throw new RuntimeException("It should not happen, " + ex.getMessage(), ex);
+            throw new RuntimeException("Xml parsing failed " + ex.getMessage(), ex);
         }
     }
 
@@ -130,7 +130,7 @@ public class XmlUtils {
             return document.getRootElement();
         }
         catch (IOException ex) {
-            throw new RuntimeException("It should not happen, " + ex.getMessage(), ex);
+            throw new RuntimeException("Xml parsing failed, " + ex.getMessage(), ex);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/03b1a9f1/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 65628c0..ba90253 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.1.0 release (trunk - unreleased)
 
+OOZIE-3208 "It should never happen" error messages should be more specific to root cause (kmarton via andras.piros)
 OOZIE-2791 ShareLib installation may fail on busy Hadoop clusters (asasvari, kmarton via pbacsko, andras.piros)
 OOZIE-3297 Retry logic does not handle the exception from BulkJPAExecutor properly (andras.piros)
 OOZIE-2955 [oozie-client] Fix Findbugs warnings (Jan Hentschel, kmarton via andras.piros)