JunjianS commented on issue #10037:
URL: 
https://github.com/apache/dolphinscheduler/issues/10037#issuecomment-1168576942

   how to fix the dependent task by manual? @s
   
   > > ```java
   > > for (int i = 0; i < dependTaskList.size(); i++) {
   > >                     ObjectNode dependTask = (ObjectNode) 
dependTaskList.path(i);
   > >                     ArrayNode dependItemList = 
JSONUtils.parseArray(JSONUtils.toJsonString(dependTask.get("dependItemList")));
   > >                     for (int j = 0; j < dependItemList.size(); j++) {
   > >                         ObjectNode dependItem = (ObjectNode) 
dependItemList.path(j);
   > >                         dependItem.put("projectCode", 
projectIdCodeMap.get(dependItem.get("projectId").asInt()));
   > >                         int definitionId = 
dependItem.get("definitionId").asInt();
   > >                         Map<Long, Map<String, Long>> 
processCodeTaskNameCodeMap = processTaskMap.get(definitionId);
   > >                         if (processCodeTaskNameCodeMap == null) {
   > >                             logger.warn("We can't find processDefinition 
[{}], please check it is not exist, remove this dependence", definitionId);
   > >                             dependItemList.remove(j);
   > >                             continue;
   > >                         }
   > >                         Optional<Map.Entry<Long, Map<String, Long>>> 
mapEntry = processCodeTaskNameCodeMap.entrySet().stream().findFirst();
   > >                         if (mapEntry.isPresent()) {
   > >                             Map.Entry<Long, Map<String, Long>> 
processCodeTaskNameCodeEntry = mapEntry.get();
   > >                             dependItem.put("definitionCode", 
processCodeTaskNameCodeEntry.getKey());
   > >                             String depTasks = 
dependItem.get("depTasks").asText();
   > >                             long taskCode = "ALL".equals(depTasks) || 
processCodeTaskNameCodeEntry.getValue() == null ? 0L : 
processCodeTaskNameCodeEntry.getValue().get(depTasks); // exception code
   > >                             dependItem.put("depTaskCode", taskCode);
   > >                         }
   > >                         dependItem.remove("projectId");
   > >                         dependItem.remove("definitionId");
   > >                         dependItem.remove("depTasks");
   > >                         dependItemList.set(j, dependItem);
   > >                     }
   > >                     dependTask.put("dependItemList", dependItemList);
   > >                     dependTaskList.set(i, dependTask);
   > >                 }
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > look at the exception code. `processCodeTaskNameCodeEntry` shouldn't be 
null. And when `processCodeTaskNameCodeEntry.getValue()` is null ,it should be 
return `0L`. I can't figure how to happened. My branch‘s version is 
2.0.5-release and I have checked the code is same with above from the compiled 
jar . Could you have a look at here, please. @JinyLeeChina
   > 
   > I found the reason! Firstly, the NPE cause by `long` can't be null. Maybe 
it should replaced by `Long`. When the task A was depended by a sub process 's 
task B, task A rename to A1, or be deleted. And the task B 's depend item list 
wouldn't update, then cause the result that can't find the `depTasks`. It would 
be ok with fix the dependent task by manual.
   
   how to fix the dependent task by manual? 


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to