提交 216154dc 编写于 作者: Y Yelli 提交者: qiaozhanwei

fix sonar bug: null check & clean throw exception (#1690)

* fix sonar bug: null check & clean throw exception

* fix sonar bug: null check & clean throw exception
上级 a80e9027
......@@ -195,12 +195,11 @@ public class ProcessInstanceService extends BaseDAGService {
processInstance.setDuration(DateUtils.differSec(processInstance.getStartTime(),processInstance.getEndTime()));
}
Set<String> exclusionSet = new HashSet<String>(){{
add(Constants.CLASS);
add("locations");
add("connects");
add("processInstanceJson");
}};
Set<String> exclusionSet = new HashSet<String>();
exclusionSet.add(Constants.CLASS);
exclusionSet.add("locations");
exclusionSet.add("connects");
exclusionSet.add("processInstanceJson");
PageInfo pageInfo = new PageInfo<ProcessInstance>(pageNo, pageSize);
pageInfo.setTotalCount((int) processInstanceList.getTotal());
......
......@@ -116,10 +116,9 @@ public class TaskInstanceService extends BaseService {
page, project.getId(), processInstanceId, searchVal, taskName, statusArray, host, start, end
);
PageInfo pageInfo = new PageInfo<ProcessInstance>(pageNo, pageSize);
Set<String> exclusionSet = new HashSet<String>(){{
add(Constants.CLASS);
add("taskJson");
}};
Set<String> exclusionSet = new HashSet<>();
exclusionSet.add(Constants.CLASS);
exclusionSet.add("taskJson");
List<TaskInstance> taskInstanceList = taskInstanceIPage.getRecords();
for(TaskInstance taskInstance : taskInstanceList){
taskInstance.setDuration(DateUtils.differSec(taskInstance.getStartTime(),
......
......@@ -66,7 +66,6 @@ public class ClickHouseDataSource extends BaseDataSource {
con.close();
} catch (SQLException e) {
logger.error("ClickHouse datasource try conn close conn error", e);
throw e;
}
}
}
......
......@@ -66,7 +66,6 @@ public class DB2ServerDataSource extends BaseDataSource {
con.close();
} catch (SQLException e) {
logger.error("DB2 Server datasource try conn close conn error", e);
throw e;
}
}
}
......
......@@ -69,7 +69,6 @@ public class HiveDataSource extends BaseDataSource {
con.close();
} catch (SQLException e) {
logger.error("hive datasource try conn close conn error", e);
throw e;
}
}
}
......
......@@ -64,7 +64,6 @@ public class MySQLDataSource extends BaseDataSource {
con.close();
} catch (SQLException e) {
logger.error("Mysql datasource try conn close conn error", e);
throw e;
}
}
}
......
......@@ -66,7 +66,6 @@ public class OracleDataSource extends BaseDataSource {
con.close();
} catch (SQLException e) {
logger.error("Oracle datasource try conn close conn error", e);
throw e;
}
}
}
......
......@@ -68,7 +68,6 @@ public class PostgreDataSource extends BaseDataSource {
con.close();
} catch (SQLException e) {
logger.error("Postgre datasource try conn close conn error", e);
throw e;
}
}
}
......
......@@ -62,7 +62,6 @@ public class SQLServerDataSource extends BaseDataSource {
con.close();
} catch (SQLException e) {
logger.error("SQL Server datasource try conn close conn error", e);
throw e;
}
}
}
......
......@@ -71,7 +71,6 @@ public class SparkDataSource extends BaseDataSource {
con.close();
} catch (SQLException e) {
logger.error("Spark datasource try conn close conn error", e);
throw e;
}
}
}
......
......@@ -59,4 +59,5 @@ public class DateInterval {
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
}
......@@ -53,6 +53,7 @@ public class TaskNodeRelation {
}
@Override
public boolean equals(Object o){
if (!(o instanceof TaskNodeRelation)) {
return false;
......
......@@ -51,7 +51,6 @@ public class ConnectionUtils {
}
} catch (SQLException e) {
logger.error(e.getMessage(),e);
throw new RuntimeException(e);
} finally {
try {
if (stmt != null) {
......@@ -60,7 +59,6 @@ public class ConnectionUtils {
}
} catch (SQLException e) {
logger.error(e.getMessage(),e);
throw new RuntimeException(e);
} finally {
try {
if (conn != null) {
......@@ -69,7 +67,6 @@ public class ConnectionUtils {
}
} catch (SQLException e) {
logger.error(e.getMessage(),e);
throw new RuntimeException(e);
}
}
}
......
......@@ -155,7 +155,9 @@ public abstract class UpgradeDao extends AbstractBaseDao {
throw new RuntimeException(e.getMessage(),e);
} catch (Exception e) {
try {
conn.rollback();
if (null != conn) {
conn.rollback();
}
} catch (SQLException e1) {
logger.error(e1.getMessage(),e1);
}
......@@ -312,7 +314,9 @@ public abstract class UpgradeDao extends AbstractBaseDao {
throw new RuntimeException(e.getMessage(),e);
} catch (SQLException e) {
try {
conn.rollback();
if (null != conn) {
conn.rollback();
}
} catch (SQLException e1) {
logger.error(e1.getMessage(),e1);
}
......@@ -320,7 +324,9 @@ public abstract class UpgradeDao extends AbstractBaseDao {
throw new RuntimeException(e.getMessage(),e);
} catch (Exception e) {
try {
conn.rollback();
if (null != conn) {
conn.rollback();
}
} catch (SQLException e1) {
logger.error(e1.getMessage(),e1);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册