Skip to content

Commit

Permalink
[#noissue] Cleanup PMD warning
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Jul 11, 2024
1 parent f86114b commit 58c70b9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.navercorp.pinpoint.common.server.dao.hbase.mapper;

import com.google.common.collect.Iterables;
import com.navercorp.pinpoint.common.hbase.ResultsExtractor;
import com.navercorp.pinpoint.common.hbase.RowMapper;
import com.navercorp.pinpoint.common.server.bo.AgentInfoBo;
Expand All @@ -39,9 +40,11 @@ public AgentInfoBoResultsExtractor(RowMapper<AgentInfoBo> agentInfoMapper) {

@Override
public AgentInfoBo extractData(ResultScanner results) throws Exception {
for (Result result : results) {
return agentInfoMapper.mapRow(result, 0);
final Result first = Iterables.getFirst(results, null);
if (first == null) {
return null;
}
return null;
return agentInfoMapper.mapRow(first, 0);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

package com.navercorp.pinpoint.flink.mapper.thrift.stat;

import com.google.common.collect.Iterables;
import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo;
import com.navercorp.pinpoint.flink.mapper.thrift.ThriftBoMapper;
import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat;
import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
* @author minwoo.jung
*/
Expand Down Expand Up @@ -70,11 +69,11 @@ public JoinAgentStatBo map(TFAgentStatBatch tFAgentStatBatch) {


private long getTimeStamp(TFAgentStatBatch joinAgentStatBo) {
List<TFAgentStat> agentStats = joinAgentStatBo.getAgentStats();
for (TFAgentStat agentStat : agentStats) {
return agentStat.getTimestamp();
final TFAgentStat first = Iterables.getFirst(joinAgentStatBo.getAgentStats(), null);
if (first == null) {
return Long.MIN_VALUE;
}
return Long.MIN_VALUE;
return first.getTimestamp();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.navercorp.pinpoint.web.mapper;

import com.google.common.collect.Iterables;
import com.navercorp.pinpoint.common.hbase.ResultsExtractor;
import com.navercorp.pinpoint.common.hbase.RowMapper;
import com.navercorp.pinpoint.common.server.bo.AgentInfoBo;
Expand Down Expand Up @@ -46,10 +47,11 @@ public AgentInfoResultsExtractor(ServiceTypeRegistryService registryService,

@Override
public AgentInfo extractData(ResultScanner results) throws Exception {
for (Result result : results) {
AgentInfoBo agentInfoBo = agentInfoMapper.mapRow(result, 0);
return factory.build(agentInfoBo);
final Result first = Iterables.getFirst(results, null);
if (first == null) {
return null;
}
return null;
AgentInfoBo agentInfoBo = agentInfoMapper.mapRow(first, 0);
return factory.build(agentInfoBo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.navercorp.pinpoint.web.mapper;

import com.google.common.collect.Iterables;
import com.navercorp.pinpoint.common.hbase.ResultsExtractor;
import com.navercorp.pinpoint.common.hbase.RowMapper;
import com.navercorp.pinpoint.common.server.bo.AgentInfoBo;
Expand Down Expand Up @@ -47,11 +48,12 @@ public DetailedAgentInfoResultsExtractor(ServiceTypeRegistryService registryServ

@Override
public DetailedAgentInfo extractData(ResultScanner results) throws Exception {
for (Result result : results) {
AgentInfoBo agentInfoBo = agentInfoMapper.mapRow(result, 0);
AgentInfo agentInfo = factory.build(agentInfoBo);
return new DetailedAgentInfo(agentInfo, agentInfoBo.getServerMetaData(), agentInfoBo.getJvmInfo());
final Result first = Iterables.getFirst(results, null);
if (first == null) {
return null;
}
return null;
AgentInfoBo agentInfoBo = agentInfoMapper.mapRow(first, 0);
AgentInfo agentInfo = factory.build(agentInfoBo);
return new DetailedAgentInfo(agentInfo, agentInfoBo.getServerMetaData(), agentInfoBo.getJvmInfo());
}
}

0 comments on commit 58c70b9

Please sign in to comment.