Skip to content

Commit

Permalink
net-sf-ucanaccess-fork: Add check to prevent ArrayIndexOutOfBoundsExc…
Browse files Browse the repository at this point in the history
…eption
  • Loading branch information
spannm committed Nov 13, 2023
1 parent 5b4d685 commit 82167d8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/main/java/net/ucanaccess/commands/UpdateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,17 @@ private void updateComplex(Cursor cur) throws IOException {
} else if (modifiedRow[j] instanceof Version[]) {

Version[] vs = (Version[]) modifiedRow[j];
Version v = vs[0];
List<com.healthmarketscience.jackcess.complex.Version> oldV = rowFk.getVersions();
String vn = v.getValue();
String vo = !oldV.isEmpty() ? oldV.get(0).getValue() : null;
LocalDateTime upTime = isRollbacking ? LocalDateTime.now() : v.getModifiedDate();

if (vn != null && vo == null || vo != null && vn == null
|| vo != null && vn != null && !vo.equals(vn)) {
rowFk.addVersion(vn, upTime);
if (vs.length > 0) {
Version v = vs[0];
List<com.healthmarketscience.jackcess.complex.Version> oldV = rowFk.getVersions();
String vn = v.getValue();
String vo = !oldV.isEmpty() ? oldV.get(0).getValue() : null;
LocalDateTime upTime = isRollbacking ? LocalDateTime.now() : v.getModifiedDate();

if (vn != null && vo == null || vo != null && vn == null
|| vo != null && vn != null && !vo.equals(vn)) {
rowFk.addVersion(vn, upTime);
}
}

}
Expand Down

0 comments on commit 82167d8

Please sign in to comment.