Skip to content

Commit

Permalink
Merge pull request alibaba#83 from likaer/master
Browse files Browse the repository at this point in the history
修复基于MySQL场景下根据ID查询流程节点信息的场景下,如果找不到对应的节点信息直接抛空指针异常
  • Loading branch information
vavi authored Sep 6, 2022
2 parents bc76f71 + b92dc20 commit 6ef8bd2
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ public interface TaskCommandService {
*/
void addTaskAssigneeCandidate(String taskId, TaskAssigneeCandidateInstance taskAssigneeCandidateInstance);


}
1 change: 0 additions & 1 deletion extension/storage/storage-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<artifactId>smart-engine</artifactId>
<version>2.6.5-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>

</parent>

<artifactId>smart-engine-extension-storage-mysql</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public ActivityInstance find(String instanceId,
ProcessEngineConfiguration processEngineConfiguration) {
ActivityInstanceDAO activityInstanceDAO= (ActivityInstanceDAO)processEngineConfiguration.getInstanceAccessor().access("activityInstanceDAO");
ActivityInstanceEntity activityInstanceEntity = activityInstanceDAO.findOne(Long.valueOf(instanceId));

ActivityInstance activityInstance = buildActivityInstanceFromEntity(activityInstanceEntity);

return activityInstance;
if (activityInstanceEntity == null){
return null;
}
return buildActivityInstanceFromEntity(activityInstanceEntity);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ public DeploymentInstance findById(String id,
DeploymentInstanceDAO deploymentnstanceDAO = (DeploymentInstanceDAO)processEngineConfiguration.getInstanceAccessor().access("deploymentInstanceDAO");

DeploymentInstanceEntity entity = deploymentnstanceDAO.findOne(Long.valueOf(id));
DeploymentInstance deploymentInstance = convertByEntity(entity);

return deploymentInstance;
if (entity == null) {
return null;
}
return convertByEntity(entity);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public ExecutionInstance find(String instanceId,

ExecutionInstanceDAO executionInstanceDAO = (ExecutionInstanceDAO) processEngineConfiguration.getInstanceAccessor().access("executionInstanceDAO");
ExecutionInstanceEntity executionInstanceEntity = executionInstanceDAO.findOne(Long.valueOf(instanceId));
if (executionInstanceEntity == null) {
return null;
}
ExecutionInstance executionInstance = new DefaultExecutionInstance();
buildExecutionInstance(executionInstance, executionInstanceEntity);
return executionInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ public ProcessInstance findOne(String instanceId,
ProcessInstanceDAO processInstanceDAO= (ProcessInstanceDAO)processEngineConfiguration.getInstanceAccessor().access("processInstanceDAO");

ProcessInstanceEntity processInstanceEntity = processInstanceDAO.findOne(Long.valueOf(instanceId));

ProcessInstance processInstance = buildProcessInstanceFromEntity(processInstanceEntity);

return processInstance;
if (processInstanceEntity == null) {
return null;
}
return buildProcessInstanceFromEntity(processInstanceEntity);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Map<String, List<TaskAssigneeInstance>> findAssigneeOfInstanceList(List<S
TaskAssigneeDAO taskAssigneeDAO= (TaskAssigneeDAO) processEngineConfiguration.getInstanceAccessor().access("taskAssigneeDAO");

Map<String, List<TaskAssigneeInstance>> assigneeMap = null;
if (taskInstanceIdList != null) {
if (taskInstanceIdList != null && taskInstanceIdList.size() > 0) {

assigneeMap = new HashMap<String, List<TaskAssigneeInstance>>();

Expand Down Expand Up @@ -132,7 +132,9 @@ public TaskAssigneeInstance findOne(String taskAssigneeInstanceId,

TaskAssigneeDAO taskAssigneeDAO= (TaskAssigneeDAO) processEngineConfiguration.getInstanceAccessor().access("taskAssigneeDAO");
TaskAssigneeEntity taskAssigneeEntity = taskAssigneeDAO.findOne(Long.valueOf(taskAssigneeInstanceId));

if (taskAssigneeEntity == null){
return null;
}
return buildTaskAssigneeInstance(taskAssigneeEntity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ public TaskInstance find(String instanceId,
ProcessEngineConfiguration processEngineConfiguration) {
TaskInstanceDAO taskInstanceDAO= (TaskInstanceDAO) processEngineConfiguration.getInstanceAccessor().access("taskInstanceDAO");
TaskInstanceEntity taskInstanceEntity = taskInstanceDAO.findOne(Long.valueOf(instanceId));

TaskInstance taskInstance= buildTaskInstanceFromEntity(taskInstanceEntity);
return taskInstance;
if (taskInstanceEntity == null){
return null;
}
return buildTaskInstanceFromEntity(taskInstanceEntity);
}

private TaskInstance buildTaskInstanceFromEntity(TaskInstanceEntity taskInstanceEntity) {
Expand Down

0 comments on commit 6ef8bd2

Please sign in to comment.