You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/09/16 09:33:41 UTC

[GitHub] [incubator-dolphinscheduler] zhuangchong commented on a change in pull request #3746: [fix-3745][server] server get tasktype NPE exception

zhuangchong commented on a change in pull request #3746:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/3746#discussion_r489300306



##########
File path: dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/TaskManagerTest.java
##########
@@ -95,9 +97,19 @@ public void testNewTask() {
         Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger));
         taskExecutionContext.setTaskType("SQOOP");
         Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger));
-        //taskExecutionContext.setTaskType(null);
-        //Assert.assertNull(TaskManager.newTask(taskExecutionContext,taskLogger));
-        //taskExecutionContext.setTaskType("XXX");
-        //Assert.assertNotNull(TaskManager.newTask(taskExecutionContext,taskLogger));
+        try {
+            taskExecutionContext.setTaskType(null);
+            TaskManager.newTask(taskExecutionContext,taskLogger);
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+        }
+
+        try {
+            taskExecutionContext.setTaskType("XXX");

Review comment:
       done

##########
File path: dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/TaskManager.java
##########
@@ -69,8 +74,9 @@ public static AbstractTask newTask(TaskExecutionContext taskExecutionContext, Lo
             case SQOOP:
                 return new SqoopTask(taskExecutionContext, logger);
             default:
-                logger.error("unsupport task type: {}", taskExecutionContext.getTaskType());
-                throw new IllegalArgumentException("not support task type");
+                String msg = String.format("not support task type: %s", taskExecutionContext.getTaskType());

Review comment:
       done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org