This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git
The following commit(s) were added to refs/heads/master by this push:
new 55e6829 Checking array size before access to avoid
ArrayIndexOutOfBoundsException
new 61ec816 Merge pull request #62 from ilgrosso/ARRAY_INDEX_OUT_OF_BOUNDS
55e6829 is described below
commit 55e6829b1d6c534feeb6a3ab6bcb0a4f36f8dfac
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Tue Jun 9 12:28:21 2020 +0200
Checking array size before access to avoid ArrayIndexOutOfBoundsException
---
.../src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git
a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java
b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java
index 0766994..d8001d0 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PrimaryRow.java
@@ -147,7 +147,7 @@ public class PrimaryRow
* Return the I/O information for the given set foreign key.
*/
public ColumnIO getForeignKeyIO(ForeignKey fk) {
- return (_fkIO == null) ? null : _fkIO[fk.getIndex()];
+ return _fkIO == null ? null : _fkIO.length <= fk.getIndex() ? null :
_fkIO[fk.getIndex()];
}
/**
@@ -155,7 +155,7 @@ public class PrimaryRow
* constraint analyses are not recorded.
*/
public OpenJPAStateManager getForeignKeySet(ForeignKey fk) {
- return (_fkSet == null) ? null : _fkSet[fk.getIndex()];
+ return _fkSet == null ? null : _fkSet.length <= fk.getIndex() ? null :
_fkSet[fk.getIndex()];
}
/**
@@ -163,7 +163,7 @@ public class PrimaryRow
* constraint analyses are not recorded.
*/
public OpenJPAStateManager getForeignKeyWhere(ForeignKey fk) {
- return (_fkWhere == null) ? null : _fkWhere[fk.getIndex()];
+ return _fkWhere == null ? null : _fkWhere.length <= fk.getIndex() ?
null : _fkWhere[fk.getIndex()];
}
@Override
@@ -195,9 +195,9 @@ public class PrimaryRow
public void clearForeignKey(ForeignKey fk)
throws SQLException {
super.clearForeignKey(fk);
- if (_fkSet != null)
+ if (_fkSet != null && _fkSet.length > fk.getIndex())
_fkSet[fk.getIndex()] = null;
- if (_fkIO != null)
+ if (_fkIO != null && _fkIO.length > fk.getIndex())
_fkIO[fk.getIndex()] = null;
}