spotbugs问题修复

spotbugs-0630
jason 3 weeks ago
parent ece6e4f88d
commit 0003a83af8

@ -131,14 +131,13 @@ public class PcnMqttClient {
MqttTopic mqttTopic = PcnMqttClient.getClient().getTopic(topic);
if (null == mqttTopic) {
log.error("== MyMqttClient ==> topic is not exist");
return;
}
MqttDeliveryToken token;//Delivery:配送
synchronized (this) {//注意这里一定要同步否则在多线程publish的情况下线程会发生死锁分析见文章最后补充
try {
token = mqttTopic.publish(message);//也是发送到执行队列中,等待执行线程执行,将消息发送到消息中间件
token.waitForCompletion(1000L);
} catch (MqttPersistenceException e) {
e.printStackTrace();
} catch (MqttException e) {
e.printStackTrace();
}

@ -357,7 +357,7 @@ public class MesProduceSnPrintService implements IMesProduceSnPrintService {
//模板信息丢失抛出异常
if (labelTemplate == null) {
workOrderCutDb.setRemark(String.format("请检查裁片方案,裁片方案[%s]模板代码[%s]无效!", cutScheme.getCutCode(), cutScheme.getTemplateCode()));
workOrderCutDb.setRemark(String.format("请检查裁片方案,裁片方案[%s]模板代码[%s]无效!", cutScheme != null ? cutScheme.getCutCode() : "", cutScheme != null ? cutScheme.getTemplateCode() : ""));
workOrderCutDb.setSystemSyncStatus(CommonEnumUtil.FALSE);
ConvertBean.serviceModelUpdate(workOrderCutDb, workOrderCut.getModifyUser());
continue;

@ -951,6 +951,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
d = df.parse(lotNo);
} catch (ParseException e) {
e.printStackTrace();
return "";
}
Calendar cal = Calendar.getInstance();
cal.setTime(d);
@ -1808,6 +1809,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
d = df.parse(lotNo);
} catch (ParseException e) {
e.printStackTrace();
return "";
}
Calendar cal = Calendar.getInstance();
cal.setTime(d);

@ -114,7 +114,7 @@ public class MesShippingCheckVolvoRackNoAndPartNoStrategyServiceImpl implements
}
MesCustSortInfo custSoftInfo = custSoftInfoRDao.getById(Long.parseLong(workOrder.getWorkOrderSource()));
if (custSoftInfo == null || !Objects.equals(detail.getCustInfoSeq(), custSoftInfo.getCustInfoSeq())) {
throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错序号【%s】前还有未扫描的发运单明细请检查数据", orderManagement.getShippingCode(), custSoftInfo.getCustInfoSeq()));
throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错序号【%s】前还有未扫描的发运单明细请检查数据", orderManagement.getShippingCode(), custSoftInfo != null ? custSoftInfo.getCustInfoSeq() : ""));
}
}

@ -174,8 +174,7 @@ public class MesWorkOrderOfflineRestoreDispatchService implements IMesWorkOrderO
}
//工单装配件离线数据根据工位进行分组
Map<String, List<MesWorkOrderAssemblyOffline>> cellMap = CollectionUtils.isEmpty(workOrderAssemblyOfflineList) ? null :
workOrderAssemblyOfflineList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesWorkOrderAssemblyOffline::getWorkCellCode));
Map<String, List<MesWorkOrderAssemblyOffline>> cellMap = workOrderAssemblyOfflineList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesWorkOrderAssemblyOffline::getWorkCellCode));
//解析加工记录工位字段信息 拼接新增过的工位加工记录 [{"id":"1","workCellCode":"100-10"},{"id":"2","workCellCode":"100-20"}....]
List<MesProductionRecordOfflineModel> productionRecordOfflineModelList = StringUtils.isEmpty(workOrderOffline.getProductionRecord()) ? new ArrayList<>() : JSONObject.parseArray(workOrderOffline.getProductionRecord(), MesProductionRecordOfflineModel.class);
@ -284,9 +283,7 @@ public class MesWorkOrderOfflineRestoreDispatchService implements IMesWorkOrderO
productionRecordOfflineModelList.add(new MesProductionRecordOfflineModel(entry.getKey(), productionRecord.getId().toString()));
workOrderOffline.setProductionRecord(JSONObject.toJSONString(productionRecordOfflineModelList));
}
}
}
private void saveProductionRecordReportStatus(String organizeCode, MesWorkOrderOffline workOrderOffline) {

@ -98,7 +98,7 @@ public class ChengDuVolvoPartPrintStrategy implements IPrintTemplateStrategyServ
private Map<String, Object> getPrintContextMap(MesProduceSn produceSn, MesWorkOrder workOrder) {
if (workOrder == null || StringUtils.isEmpty(workOrder.getWorkOrderSource())) {
MesPcnException.throwBusiException("客户条码[%s]对应的工单信息缺少来源!", workOrder.getCustSn());
MesPcnException.throwBusiException("客户条码[%s]对应的工单信息缺少来源!", workOrder != null ? workOrder.getCustSn() : "");
}
MesCustSortInfo custSoftInfo = custSoftInfoRDao.getById(Long.parseLong(workOrder.getWorkOrderSource()));

@ -34,7 +34,7 @@
<impp.framework.version>1.0.1-YZ</impp.framework.version>
<i3plus.pojo.version>1.0.0-yfai</i3plus.pojo.version>
<i3plus.platform.version>1.0.0.1-patch</i3plus.platform.version>
<i3plus.mes.pcn.version>1.0.3-yfai</i3plus.mes.pcn.version>
<i3plus.mes.pcn.version>1.0.4-yfai</i3plus.mes.pcn.version>
<log4j2.version>2.17.1</log4j2.version>
</properties>
@ -210,6 +210,40 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.3.1</version>
<executions>
<!--package时执行spotbugs检测-->
<execution>
<id>spotbugs-check</id>
<phase>package</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- <includeFilterFile>spotbugs-include.xml</includeFilterFile>-->
<!-- 指定过滤文件路径 -->
<excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
<!--校验开关-->
<failOnError>false</failOnError>
<!--校验级别-->
<xmlOutput>true</xmlOutput>
<htmlOutput>true</htmlOutput>
</configuration>
<dependencies>
<!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>4.8.4</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}</finalName>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<!-- &lt;!&ndash; 忽略特定类型的Bug &ndash;&gt;-->
<Match>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2,MS_MUTABLE_ARRAY,BX_UNBOXING_IMMEDIATELY_REBOXED,RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE,NM_CLASS_NOT_EXCEPTION,DM_DEFAULT_ENCODING,ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD,REC_CATCH_EXCEPTION,EI_EXPOSE_STATIC_REP2,MS_EXPOSE_REP,BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR,RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE,RV_RETURN_VALUE_IGNORED_BAD_PRACTICE,RV_RETURN_VALUE_IGNORED,DMI_HARDCODED_ABSOLUTE_FILENAME,AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION,DMI_RANDOM_USED_ONLY_ONCE,DM_NEXTINT_VIA_NEXTDOUBLE,SE_BAD_FIELDk,SE_TRANSIENT_FIELD_NOT_RESTORED"/>
</Match>
<!-- &lt;!&ndash; 按类名忽略 &ndash;&gt;-->
<!-- <Match>-->
<!-- <Class name="com.example.MyClass"/>-->
<!-- </Match>-->
<!-- &lt;!&ndash; 按包名忽略 &ndash;&gt;-->
<Package name="cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step" />
<Package name="cn.estsh.i3plus.mes.pcn.serviceimpl.fsm" />
</FindBugsFilter>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<!-- &lt;!&ndash; 忽略特定类型的Bug &ndash;&gt;-->
<Match>
<Bug pattern="NP_NULL_ON_SOME_PATH,GC_UNRELATED_TYPES,NP_NULL_ON_SOME_PATH_EXCEPTION,SIC_INNER_SHOULD_BE_STATIC,OBL_UNSATISFIED_OBLIGATION,NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE,NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE,DM_GC,NP_GUARANTEED_DEREF,NP_NULL_PARAM_DEREF"/>
</Match>
</FindBugsFilter>
Loading…
Cancel
Save