'Codefresh build: Either log or rethrow this exception in Sonarqube
Either log or rethrow this exception in Sonar through codefresh build where as the same piece code not throwing any exception through Jenkins build but failing through Codefresh build. please find below code snippet which is marked with ** in both catch blocks..
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;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
