Menu

#1024 DFA analysis

PMD-Backlog
open
DFA (8)
PMD
1-Blocker
Bug
2016-12-18
2012-08-29
Anonymous
No

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;
}

Discussion

  • Ryan Gustafson

    Ryan Gustafson - 2012-08-30

    Gad that's nasty. I'll see if I can track it down over the weekend.

     
  • Romain PELISSE

    Romain PELISSE - 2013-01-26
    • labels: pmd -->
    • assigned_to: Tom Copeland --> Ryan Gustafson
     
  • Romain PELISSE

    Romain PELISSE - 2013-01-26

    Assign it to Ryan for clarity purpose (help browsing to see what bug is left unattended)

     
  • Andreas Dangel

    Andreas Dangel - 2014-02-09
    • Module: --> PMD
    • Milestone: PMD-5.0.x --> PMD-Backlog
    • Priority: 5 --> 1-Blocker
    • Type: --> Bug
    • Affects version: -->
     
  • Alberto Fernández

    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).

     
  • Alberto Fernández

    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)

     
  • Andreas Dangel

    Andreas Dangel - 2016-12-18
    • labels: --> DFA
    • Ruleset / Rule: -->
     

Log in to post a comment.