Hey PMD,
When doing DFA analysis on a code like this, the DAAPathFinder goes into an infinite loop in method phase2(). The code below has SIMPLIFIED for as much as possible in order to isolate the problem.
private List<holidaysheetfailure> createHolidaySheetForCsvFile(final List<employeeto> employees, final int year, final OutputStream out, final boolean isBatchMode) throws EhrApplicationException {
List<holidaysheetfailure> failures = new ArrayList<holidaysheetfailure>();
int noEmployeesToFlush;</holidaysheetfailure></holidaysheetfailure></employeeto></holidaysheetfailure>
// create a holiday sheet builder
MultipleHolidaySheetsCsvBuilder builder = new MultipleHolidaySheetsCsvBuilder();
for (EmployeeTO employee : employees) {
try {
} catch (Exception e) {
if (isBatchMode) {
// If running in batch mode, log error but don't fail
failures.add(new HolidaysheetFailure(employee.getBut().getId(), employee.getId(),
"Error while generating holidaysheet!"));
} else {
throw e;
}
}
//flush 'noEmployeesToFlush' employees to csv file
if (noEmployeesToFlush == 0) {
builder.generate(out);
}
}
return failures;
}
Gad that's nasty. I'll see if I can track it down over the weekend.
Assign it to Ryan for clarity purpose (help browsing to see what bug is left unattended)
I've tested a little (I don't know enough to fix it)
I've attached a very sample test case based on the original post (in this case is a full Java class).
Seems that it's same bug that https://sourceforge.net/p/pmd/bugs/1393/ and it's fixed on 5.3.4+ and 5.4.0+ (confirmed fix with my previous example)