vlsi commented on code in PR #6694:
URL: https://github.com/apache/jmeter/pull/6694#discussion_r3111357885
##########
src/functions/src/main/java/org/apache/jmeter/functions/FileRowColContainer.java:
##########
@@ -119,13 +120,18 @@ public String getColumn(int row, int col) throws
IndexOutOfBoundsException {
*
*/
public int nextRow() {
- int row = nextRow;
- nextRow++;
- if (nextRow >= fileData.size()) {// 0-based
- nextRow = 0;
+ int size = fileData.size();
+ if (size <= 0) {
+ throw new IllegalStateException("CSV file has no data rows");
+ }
+ while (true) {
+ int current = nextRow.get();
+ int next = (current + 1) % size;
Review Comment:
`Math.floorMod` resolves overflow, so I don't understand what you mean by
"wrong values"
##########
src/functions/src/main/java/org/apache/jmeter/functions/FileRowColContainer.java:
##########
@@ -119,13 +120,18 @@ public String getColumn(int row, int col) throws
IndexOutOfBoundsException {
*
*/
public int nextRow() {
- int row = nextRow;
- nextRow++;
- if (nextRow >= fileData.size()) {// 0-based
- nextRow = 0;
+ int size = fileData.size();
+ if (size <= 0) {
+ throw new IllegalStateException("CSV file has no data rows");
+ }
+ while (true) {
+ int current = nextRow.get();
+ int next = (current + 1) % size;
Review Comment:
`Math.floorMod` resolves the overflow, so I don't understand what you mean
by "wrong values"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]