Quellcode durchsuchen

fix sonar bug: change condition & not enough arguments (#1692)

* modify FileUtils.readFile2Str

* #1300 Add right alignment function in sql email content

* cancel formatted for alert_mail_template.ftl

* #747 sql task password Log desensitization

* cancel mail_temple

* edit ExcelUtils

* modify test method name

* #747 sql task password Log desensitization

* #1544 workflow import

* Constants add DATASOURCE_PASSWORD_REGEX

* #747 sql task password Log desensitization

* deal with import project have sub process

* modify export process addTaskNodeParam method name

* add testAddTaskNodeSpecialParam UT

* add ProcessDefinitionServiceTest-ut to pom

* add testImportSubProcess in ProcessDefinitionServiceTest

* add testImportSubProcess in ProcessDefinitionServiceTest

* add testImportProcessDefinition

* fix sonar bug: not enough arguments

* fix sonar bug: change condition & not enough arguments
Yelli vor 5 Jahren
Ursprung
Commit
7ecd38f7d6

+ 4 - 3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java

@@ -489,13 +489,14 @@ public class ProcessInstanceService extends BaseDAGService {
         }
         ProcessInstance processInstance = processDao.findProcessInstanceDetailById(processInstanceId);
         List<TaskInstance> taskInstanceList = processDao.findValidTaskListByProcessId(processInstanceId);
-        //process instance priority
-        int processInstancePriority = processInstance.getProcessInstancePriority().ordinal();
-        if (processInstance == null) {
+
+        if (null == processInstance) {
             putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
             return result;
         }
 
+        //process instance priority
+        int processInstancePriority = processInstance.getProcessInstancePriority().ordinal();
         // delete zk queue
         if (CollectionUtils.isNotEmpty(taskInstanceList)){
             for (TaskInstance taskInstance : taskInstanceList){

+ 1 - 2
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java

@@ -118,7 +118,7 @@ public class HadoopUtils implements Closeable {
                                     configuration.set(Constants.FS_DEFAULTFS,defaultFSProp);
                                     fsRelatedProps.forEach((key, value) -> configuration.set(key, value));
                                 }else{
-                                    logger.error("property:{} can not to be empty, please set!");
+                                    logger.error("property:{} can not to be empty, please set!", Constants.FS_DEFAULTFS );
                                     throw new RuntimeException("property:{} can not to be empty, please set!");
                                 }
                             }else{
@@ -337,7 +337,6 @@ public class HadoopUtils implements Closeable {
      * @throws Exception errors
      */
     public FileStatus[] listFileStatus(String filePath)throws Exception{
-        Path path = new Path(filePath);
         try {
             return fs.listStatus(new Path(filePath));
         } catch (IOException e) {

+ 8 - 7
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java

@@ -119,6 +119,13 @@ public class SqlTask extends AbstractTask {
         }
 
         dataSource= processDao.findDataSourceById(sqlParameters.getDatasource());
+
+        if (null == dataSource){
+            logger.error("datasource not exists");
+            exitStatusCode = -1;
+            return;
+        }
+
         logger.info("datasource name : {} , type : {} , desc : {}  , user_id : {} , parameter : {}",
                 dataSource.getName(),
                 dataSource.getType(),
@@ -126,12 +133,6 @@ public class SqlTask extends AbstractTask {
                 dataSource.getUserId(),
                 dataSource.getConnectionParams());
 
-        if (dataSource == null){
-            logger.error("datasource not exists");
-            exitStatusCode = -1;
-            return;
-        }
-
         Connection con = null;
         List<String> createFuncs = null;
         try {
@@ -177,7 +178,7 @@ public class SqlTask extends AbstractTask {
                 try {
                     con.close();
                 } catch (SQLException e) {
-                    throw e;
+                    logger.error(e.getMessage(),e);
                 }
             }
         }