[강운덕] [LUCYSUS-1744] null 체크 강화

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@2804 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2013-11-06 05:56:19 +00:00
parent 6687a9c38a
commit c95c8affdb
7 changed files with 96 additions and 23 deletions
@@ -25,7 +25,7 @@ import com.nhn.pinpoint.web.dao.ApplicationIndexDao;
@Service
public class AgentInfoServiceImpl implements AgentInfoService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ApplicationIndexDao applicationIndexDao;
@@ -39,9 +39,14 @@ public class AgentInfoServiceImpl implements AgentInfoService {
*/
@Override
public SortedMap<String, List<AgentInfoBo>> getApplicationAgentList(String applicationName, long from, long to) {
String[] agentIdList = applicationIndexDao.selectAgentIds(applicationName);
if (applicationName == null) {
throw new NullPointerException("applicationName must not be null");
}
String[] agentIdList = applicationIndexDao.selectAgentIds(applicationName);
logger.debug("agentIdList={}", Arrays.toString(agentIdList));
if (logger.isDebugEnabled()) {
logger.debug("agentIdList={}", Arrays.toString(agentIdList));
}
if (agentIdList == null || agentIdList.length == 0) {
logger.debug("agentIdList is empty. applicationName={}, from={}", applicationName, from);
@@ -18,7 +18,10 @@ public class AgentStatServiceImpl implements AgentStatService {
private AgentStatDao agentStatDao;
public List<TAgentStat> selectAgentStatList(String agentId, long start, long end) {
return agentStatDao.scanAgentStatList(agentId, start, end);
if (agentId == null) {
throw new NullPointerException("agentId must not be null");
}
return agentStatDao.scanAgentStatList(agentId, start, end);
}
}
@@ -31,7 +31,7 @@ import com.nhn.pinpoint.web.vo.LinkStatistics;
@Service
public class ApplicationMapServiceImpl implements ApplicationMapService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ApplicationIndexDao applicationIndexDao;
@@ -49,7 +49,11 @@ public class ApplicationMapServiceImpl implements ApplicationMapService {
private HostApplicationMapDao hostApplicationMapDao;
private Set<AgentInfoBo> selectAgents(String applicationId) {
String[] agentIds = applicationIndexDao.selectAgentIds(applicationId);
if (applicationId == null) {
throw new NullPointerException("applicationId must not be null");
}
String[] agentIds = applicationIndexDao.selectAgentIds(applicationId);
Set<AgentInfoBo> agentSet = new HashSet<AgentInfoBo>();
for (String agentId : agentIds) {
// TODO 조회 시간대에 따라서 agent info row timestamp를 변경하여 조회해야하는지는 모르겠음.
@@ -208,7 +212,10 @@ public class ApplicationMapServiceImpl implements ApplicationMapService {
*/
@Override
public ApplicationMap selectApplicationMap(String applicationName, short serviceType, long from, long to) {
logger.debug("SelectApplicationMap");
if (applicationName == null) {
throw new NullPointerException("applicationName must not be null");
}
logger.debug("SelectApplicationMap");
StopWatch watch = new StopWatch("applicationMapWatch");
watch.start();
@@ -234,7 +241,14 @@ public class ApplicationMapServiceImpl implements ApplicationMapService {
@Override
public LinkStatistics linkStatistics(long from, long to, String srcApplicationName, short srcServiceType, String destApplicationName, short destServiceType) {
List<Map<Long, Map<Short, Long>>> list;
if (srcApplicationName == null) {
throw new NullPointerException("srcApplicationName must not be null");
}
if (destApplicationName == null) {
throw new NullPointerException("destApplicationName must not be null");
}
List<Map<Long, Map<Short, Long>>> list;
if (ServiceType.findServiceType(srcServiceType) == ServiceType.CLIENT) {
logger.debug("Find 'client -> any' link statistics");
@@ -59,11 +59,11 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
@Override
public LimitedScanResult<List<TransactionId>> selectTraceIdsFromApplicationTraceIndex(String applicationName, long from, long to, int limit) {
if (applicationName == null) {
throw new NullPointerException("applicationName");
}
if (applicationName == null) {
throw new NullPointerException("applicationName must not be null");
}
if (logger.isTraceEnabled()) {
if (logger.isTraceEnabled()) {
logger.trace("scan(selectTraceIdsFromApplicationTraceIndex) {}, {}, {}", applicationName, from, to);
}
@@ -72,7 +72,17 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
@Override
public LinkStatistics linkStatistics(long from, long to, List<TransactionId> traceIdSet, String srcApplicationName, short srcServiceType, String destApplicationName, short destServiceType, Filter filter) {
StopWatch watch = new StopWatch();
if (srcApplicationName == null) {
throw new NullPointerException("srcApplicationName must not be null");
}
if (destApplicationName == null) {
throw new NullPointerException("destApplicationName must not be null");
}
if (filter == null) {
throw new NullPointerException("filter must not be null");
}
StopWatch watch = new StopWatch();
watch.start();
List<List<SpanBo>> transactionList = this.traceDao.selectAllSpans(traceIdSet);
@@ -119,7 +129,10 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
@Override
public ApplicationMap selectApplicationMap(TransactionId transactionId) {
List<TransactionId> transactionIdList = new ArrayList<TransactionId>();
if (transactionId == null) {
throw new NullPointerException("transactionId must not be null");
}
List<TransactionId> transactionIdList = new ArrayList<TransactionId>();
transactionIdList.add(transactionId);
// FIXME from,to -1 땜방임.
return selectApplicationMap(transactionIdList, -1L, -1L, Filter.NONE);
@@ -130,7 +143,14 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
*/
@Override
public ApplicationMap selectApplicationMap(List<TransactionId> transactionIdList, long from, long to, Filter filter) {
StopWatch watch = new StopWatch();
if (transactionIdList == null) {
throw new NullPointerException("transactionIdList must not be null");
}
if (filter == null) {
throw new NullPointerException("filter must not be null");
}
StopWatch watch = new StopWatch();
watch.start();
// 개별 객체를 각각 보고 재귀 내용을 삭제함.
@@ -270,7 +290,11 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
}
private Collection<TransactionId> recursiveCallFilter(List<TransactionId> transactionIdList) {
List<TransactionId> crashKey = new ArrayList<TransactionId>();
if (transactionIdList == null) {
throw new NullPointerException("transactionIdList must not be null");
}
List<TransactionId> crashKey = new ArrayList<TransactionId>();
Map<TransactionId, Object> filterMap = new LinkedHashMap<TransactionId, Object>(transactionIdList.size());
for (TransactionId transactionId : transactionIdList) {
Object old = filterMap.put(transactionId, V);
@@ -32,12 +32,22 @@ public class ScatterChartServiceImpl implements ScatterChartService {
@Override
public List<Dot> selectScatterData(String applicationName, long from, long to, int limit) {
return applicationTraceIndexDao.scanTraceScatter2(applicationName, from, to, limit);
if (applicationName == null) {
throw new NullPointerException("applicationName must not be null");
}
return applicationTraceIndexDao.scanTraceScatter2(applicationName, from, to, limit);
}
@Override
public List<Dot> selectScatterData(Collection<TransactionId> traceIds, String applicationName, Filter filter) {
List<List<SpanBo>> traceList = traceDao.selectAllSpans(traceIds);
if (traceIds == null) {
throw new NullPointerException("traceIds must not be null");
}
if (applicationName == null) {
throw new NullPointerException("applicationName must not be null");
}
List<List<SpanBo>> traceList = traceDao.selectAllSpans(traceIds);
List<Dot> list = new ArrayList<Dot>();
@@ -62,7 +72,11 @@ public class ScatterChartServiceImpl implements ScatterChartService {
*/
@Override
public List<SpanBo> selectTransactionMetadata(TransactionMetadataQuery query) {
List<List<SpanBo>> selectedSpans = traceDao.selectSpans(query.getTraceIds());
if (query == null) {
throw new NullPointerException("query must not be null");
}
List<List<SpanBo>> selectedSpans = traceDao.selectSpans(query.getTraceIds());
List<SpanBo> result = new ArrayList<SpanBo>(query.size());
@@ -47,8 +47,11 @@ public class SpanServiceImpl implements SpanService {
@Override
public SpanResult selectSpan(TransactionId transactionId, long selectedSpanHint) {
if (transactionId == null) {
throw new NullPointerException("transactionId must not be null");
}
List<SpanBo> spans = traceDao.selectSpanAndAnnotation(transactionId);
List<SpanBo> spans = traceDao.selectSpanAndAnnotation(transactionId);
if (spans == null || spans.isEmpty()) {
return new SpanResult(SpanAligner2.FAIL_MATCH, Collections.<SpanAlign>emptyList());
}
@@ -67,7 +70,7 @@ public class SpanServiceImpl implements SpanService {
private void transitionAnnotation(List<SpanAlign> spans, AnnotationReplacementCallback annotationReplacementCallback) {
for (SpanAlign spanAlign : spans) {
for (SpanAlign spanAlign : spans) {
List<AnnotationBo> annotationBoList;
if (spanAlign.isSpan()) {
annotationBoList = spanAlign.getSpanBo().getAnnotationBoList();
@@ -377,7 +380,7 @@ public class SpanServiceImpl implements SpanService {
}
private static class AgentKey {
private static final class AgentKey {
private final String agentId;
private final long agentStartTime;
@@ -39,7 +39,14 @@ public class TransactionInfoServiceImpl implements TransactionInfoService {
@Override
public BusinessTransactions selectBusinessTransactions(List<TransactionId> traceIds, String applicationName, long from, long to, Filter filter) {
List<List<SpanBo>> traceList;
if (traceIds == null) {
throw new NullPointerException("traceIds must not be null");
}
if (filter == null) {
throw new NullPointerException("filter must not be null");
}
List<List<SpanBo>> traceList;
if (filter == Filter.NONE) {
traceList = this.traceDao.selectSpans(traceIds);
@@ -66,6 +73,9 @@ public class TransactionInfoServiceImpl implements TransactionInfoService {
@Override
public RecordSet createRecordSet(List<SpanAlign> spanAlignList, long focusTimestamp) {
if (spanAlignList == null) {
throw new NullPointerException("spanAlignList must not be null");
}
RecordSet recordSet = new RecordSet();