Skip to content

Commit afd80fb

Browse files
committed
Index Out Of Bounds Patch, Printing Improved
1 parent 52ced12 commit afd80fb

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

DoubleEntry.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,16 @@ public void run() {
321321
}
322322

323323
private void runQualtricsDEVL() {
324-
try {
324+
// try {
325325
int saveOption = 0;
326326
if (saveFullExport.isSelected()) {
327327
saveOption = 1;
328328
}
329329
s = new QualtricsSurvey(file, new Delimiter("[\\t]", "\t", "\n"), indexColumn, doublePrefix);
330330
logic = new QualtricsDEVL(s, saveOption, relevantColumn);
331-
} catch (Exception e) {
332-
appendStatus("\nFailed to run QualtricsDEVL.\n");
333-
System.out.println("runQualtricsDEVL(): " + e);
334-
}
331+
// } catch (Exception e) {
332+
// appendStatus("\nFailed to run QualtricsDEVL.\n");
333+
// System.out.println("runQualtricsDEVL(): " + e);
334+
// }
335335
}
336336
}

QualtricsDEVL.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ private void printOffending(String originalEntry, String doubleEntry) {
8888
SurveyData second = this.s.getParticipantData(doubleEntry);
8989

9090
int maxReach = Math.max(first.internalLength(), second.internalLength());
91+
maxReach = Math.min(maxReach, this.s.getHeaderColumnLength()); // hotfix out of bounds, caused by relevantColumns
9192

9293
String origPrint = "ID- " + originalEntry + ": ";
9394
String doubPrint = "ID- " + doubleEntry + ": ";
@@ -120,15 +121,16 @@ private void printOffending(String originalEntry, String doubleEntry) {
120121
if (this.saveOption == 0) {
121122
this.results.append(originalEntry + this.delim.getSaveSeparator() + doubleEntry + this.delim.getSaveSeparator() + this.s.getHeaderColumn(i) + this.delim.getSaveSeparator() + i + this.delim.getSaveSeparator() + firstValue + this.delim.getSaveSeparator() + secondValue);
122123
} else if (this.saveOption == 1) {
123-
comparisonData.append("MISMATCH" + this.delim.getSaveSeparator());
124+
comparisonData.append("!= " + secondValue + this.delim.getSaveSeparator());
124125
}
125126
}
126127
}
127128
if (this.saveOption == 1) {
128129
if (!foundMismatch && i != this.idKey) {
129-
comparisonData.append("SAME" + this.delim.getSaveSeparator());
130+
String nothingFound = secondValue; // placeholder
131+
comparisonData.append(nothingFound + this.delim.getSaveSeparator());
130132
} else if (i == this.idKey) {
131-
comparisonData.append("COMPARISON_" + firstValue + this.delim.getSaveSeparator());
133+
comparisonData.append("X_" + firstValue + this.delim.getSaveSeparator());
132134
}
133135
this.results.append(firstValue + this.delim.getSaveSeparator());
134136
}

0 commit comments

Comments
 (0)