Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-11795

Reading WorkFlowNodeStateDetail from MDS may throw NPE

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.0, 4.1.1
    • Fix Version/s: 4.2.0, 4.1.2
    • Component/s: Metadata, Workflow
    • Labels:
    • Release Notes:
      Fixes an issue with retrieving workflow state if it contains an exception without a message.
    • Rank:
      1|i0035b:

      Description

      The WorkflowNodeStateDetail contains an optional Throwable in case the node failed. When reading this back from the store, we use BasicThrowableCodec, which fails with NPE if the throwable does not have a message. For example, an NPE does not have a message.

        @Override
        public BasicThrowable deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
          throws JsonParseException {
          JsonObject jsonObj = json.getAsJsonObject();
          String className = jsonObj.get("className").getAsString();
          String message = jsonObj.get("message").getAsString();
          JsonArray stackTraces = jsonObj.get("stackTraces").getAsJsonArray();
          StackTraceElement[] stackTraceElements = context.deserialize(stackTraces, StackTraceElement[].class);
          JsonElement cause = jsonObj.get("cause");
          BasicThrowable basicThrowable = null;
          if (cause != null) {
            basicThrowable = context.deserialize(cause, BasicThrowable.class);
          }
          return new BasicThrowable(className, message, stackTraceElements, basicThrowable);
        }
      

      The issue is that jsonObj.get("message") may be null if the original Throwable did not have a message.

        Attachments

          Activity

            People

            • Assignee:
              andreas Andreas Neumann
              Reporter:
              andreas Andreas Neumann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: