Bug 59106 - [PATCH] WorkdayFunction does not read correctly the area with holidays to calculate work days
Summary: [PATCH] WorkdayFunction does not read correctly the area with holidays to cal...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.13-FINAL
Hardware: PC All
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2016-03-03 10:33 UTC by Artem Bondar
Modified: 2016-07-17 21:20 UTC (History)
1 user (show)



Attachments
Excel file with data for testing and Unit test (7.93 KB, application/x-zip-compressed)
2016-03-03 10:33 UTC, Artem Bondar
Details
Patch file (994 bytes, patch)
2016-03-12 20:38 UTC, Artem Bondar
Details | Diff
Unit test (1.08 KB, text/plain)
2016-03-12 20:38 UTC, Artem Bondar
Details
Excel document with tests data (10.40 KB, application/zip)
2016-03-12 20:40 UTC, Artem Bondar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Artem Bondar 2016-03-03 10:33:11 UTC
Created attachment 33618 [details]
Excel file with data for testing and Unit test

Package: org.apache.poi.ss.formula.atp
Class: ArgumentsEvaluator
Method: evaluateDatesArg(ValueEval arg, int srcCellRow, int srcCellCol);

Here is the code:

for (int i = area.getFirstRow(); i <= area.getLastRow(); i++) {
    for (int j = area.getFirstColumn(); j <= area.getLastColumn(); j++) {
        valuesList.add(evaluateDateArg(area.getValue(i, j), i, j));
    }
}
i and j stored absolute path.

Method getValue() used relative path. Here is code:

public final ValueEval getValue(int row, int col) {
    return getRelativeValue(row, col);
}

WorkdayFunction does not read correctly the area with holidays to calculate work days. We have debugged it and found that you are using a relating path (area.getValue()), but you need to use an absolute path (area.getAbsoluteValue()).

An excel file with data for testing and Unit test is attached.
Please fix it.
Comment 1 Artem Bondar 2016-03-12 20:38:22 UTC
Created attachment 33660 [details]
Patch file
Comment 2 Artem Bondar 2016-03-12 20:38:44 UTC
Created attachment 33661 [details]
Unit test
Comment 3 Artem Bondar 2016-03-12 20:40:39 UTC
Created attachment 33662 [details]
Excel document with tests data
Comment 4 Dominik Stadler 2016-07-17 21:20:18 UTC
Applied in r1753125, thanks for the patch!