Browse Source

통계 NPE 방지 코드 추가

pull/11/head
lkd9125(이경도) 10 months ago
parent
commit
5ced3a65dd
  1. 26
      pav-server/src/main/java/com/palnet/biz/api/main/statistics/service/MainStatisticsService.java

26
pav-server/src/main/java/com/palnet/biz/api/main/statistics/service/MainStatisticsService.java

@ -120,7 +120,7 @@ public class MainStatisticsService {
*/ */
public List<FlightStcsValueModel> fltStatics(String cate, String date, String[] formatParam){ public List<FlightStcsValueModel> fltStatics(String cate, String date, String[] formatParam){
List<FlightStcsValueModel> resultList = null; List<FlightStcsValueModel> resultList = new ArrayList<>();
switch (cate) { switch (cate) {
case "TIME": case "TIME":
@ -135,6 +135,13 @@ public class MainStatisticsService {
resultList = cntrlQueryRepository.fltCountStcs(date, formatParam); resultList = cntrlQueryRepository.fltCountStcs(date, formatParam);
break; break;
default :
throw new CustomException(ErrorCode.NON_VALID_PARAMETER, cate, date);
}
for(FlightStcsValueModel node : resultList){
if(node.getName() == null || node.getName().equals("")) node.setName(" ");
} }
return resultList; return resultList;
@ -148,7 +155,7 @@ public class MainStatisticsService {
* @return * @return
*/ */
public List<FlightStcsValueModel> fltTopStatics(String cate, String date, String[] formatParam){ public List<FlightStcsValueModel> fltTopStatics(String cate, String date, String[] formatParam){
List<FlightStcsValueModel> resultList = null; List<FlightStcsValueModel> resultList = new ArrayList<>();
switch (cate) { switch (cate) {
case "TIME": case "TIME":
@ -163,10 +170,13 @@ public class MainStatisticsService {
resultList = cntrlQueryRepository.fltTopCountStcs(date, formatParam); resultList = cntrlQueryRepository.fltTopCountStcs(date, formatParam);
break; break;
default :
throw new CustomException(ErrorCode.NON_VALID_PARAMETER, cate, date);
} }
for(FlightStcsValueModel node : resultList){ for(FlightStcsValueModel node : resultList){
if(node.getName().equals("")) node.setName(" "); if(node.getName() == null || node.getName().equals("")) node.setName(" ");
} }
return resultList; return resultList;
@ -189,6 +199,10 @@ public class MainStatisticsService {
result.add(node); result.add(node);
} }
for(FlightStcsValueModel node : result){
if(node.getName() == null || node.getName().equals("")) node.setName(" ");
}
return result; return result;
} }
@ -204,7 +218,7 @@ public class MainStatisticsService {
List<FlightStcsValueModel> resultList = ctrCntrlWarnLogQueryRepository.warnStcs(cate, date, formatParam); List<FlightStcsValueModel> resultList = ctrCntrlWarnLogQueryRepository.warnStcs(cate, date, formatParam);
for(FlightStcsValueModel node : resultList){ for(FlightStcsValueModel node : resultList){
if(node.getName().equals("")) node.setName(" "); if(node.getName() == null || node.getName().equals("")) node.setName(" ");
} }
return resultList; return resultList;
@ -262,7 +276,7 @@ public class MainStatisticsService {
} }
for(FlightStcsValueModel node : resultList){ for(FlightStcsValueModel node : resultList){
if(node.getName().equals("")) node.setName(" "); if(node.getName() == null || node.getName().equals("")) node.setName(" ");
} }
return resultList; return resultList;
@ -291,7 +305,7 @@ public class MainStatisticsService {
} }
for(FlightStcsValueModel node : resultList){ for(FlightStcsValueModel node : resultList){
if(node.getName().equals("")) node.setName(" "); if(node.getName() == null || node.getName().equals("")) node.setName(" ");
} }
return resultList; return resultList;

Loading…
Cancel
Save