通过 codefresh 构建在 Sonar 中记录或重新抛出此异常,其中相同的代码不会通过 Jenkins 构建抛出任何异常,但通过 Codefresh 构建失败。请在下面的代码片段中找到两个 catch 块中标有 ** 的代码片段。
if (searchUtil.getEjarFlag(businessDate)) {
ejarRepo.getData(storeNumber, registerNumber, referenceNumber,
businessDate, null).ifPresent(m -> {
view.setSequenceNumber(m.getSequenceNumber());
try {
view.setTape(EncryptorManager.getInstance().getDecodedTokenizeEJournalValue(
new String(searchUtil.convertZippedBytes(m.getTape()))));
} **catch (Exception e) {
throw ExportService.rethrow(e);
}**
view.setStoreID(m.getStoreId());
view.setWorkstationID(m.getWorkstationId());
view.setTransactionDate(m.getDate());
});
} else {
ejournalRepoImpl.getData(storeNumber, registerNumber,
referenceNumber, businessDate, null).ifPresent(m -> {
view.setSequenceNumber(m.getSequenceNumber());
try {
view.setTape(EncryptorManager.getInstance().getDecodedTokenizeEJournalValue(
new String(searchUtil.convertZippedBytes(m.getTape()))));
} **catch (Exception exception) {
throw ExportService.rethrow(exception);
}**
view.setStoreID(m.getStoreId());
view.setWorkstationID(m.getWorkstationId());
view.setTransactionDate(m.getDate());
});
}
return view;
}
@SuppressWarnings("unchecked")
public static <T extends Throwable> RuntimeException rethrow(Throwable throwable) throws T {
throw (T) throwable;
}