Skip to content

Commit

Permalink
fixes #2136 - NPE in ExpressionOperator.printCollection (#2137)
Browse files Browse the repository at this point in the history
* fixes #2136 NPE in NullPointerException in ExpressionOperator.printCollection since 2.7.11
The bug is described in detail in #2136
We are looping over an array which is located in the instance field which can be set to `null` while lopping which is causing NPE.
To fix it we are caching the value of `argumentIndices` by looping over an iterator of the array.
  • Loading branch information
igormukhin authored May 10, 2024
1 parent ce6a459 commit af60e4e
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -2388,8 +2388,7 @@ public void printCollection(List<Expression> items, ExpressionSQLPrinter printer
}

String[] dbStrings = getDatabaseStrings(items.size());
for (int i = 0; i < this.argumentIndices.length; i++) {
final int index = this.argumentIndices[i];
for (final int index : this.argumentIndices) {
Expression item = items.get(index);
if ((this.selector == Ref) || ((this.selector == Deref) && (item.isObjectExpression()))) {
DatabaseTable alias = ((ObjectExpression)item).aliasForTable(((ObjectExpression)item).getDescriptor().getTables().firstElement());
Expand Down

0 comments on commit af60e4e

Please sign in to comment.