Skip to content

Commit

Permalink
Fix for Bug#22931632, GETPARAMETERBINDINGS() ON A PS RETURNS NPE WHEN…
Browse files Browse the repository at this point in the history
… NOT ALL PARAMETERS ARE BOUND.

Change-Id: I3e4907277ccb83ad98dcc7125f3dc39c2365f57f
  • Loading branch information
Axyoan Marcelo committed Jan 31, 2024
1 parent e030ed6 commit b226e34
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

Version 8.4.0

- Fix for Bug#22931632, GETPARAMETERBINDINGS() ON A PS RETURNS NPE WHEN NOT ALL PARAMETERS ARE BOUND.

- WL#16147, Remove support for FIDO authentication.

- Fix for Bug#110286 (Bug#35152855), Only call Messages.getString(...) when it's needed (when the SQLException is thrown).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023, Oracle and/or its affiliates.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 2.0, as published by the
Expand Down Expand Up @@ -117,7 +117,8 @@ public class ParameterBindingsImpl implements ParameterBindings {

Field parameterMetadata = new Field(null, "parameter_" + (i + 1), charsetIndex,
this.propertySet.getStringProperty(PropertyKey.characterEncoding).getValue(), this.queryBindings.getBindValues()[i].getMysqlType(),
rowData[i].length);
rowData[i] != null ? rowData[i].length : 0);

typeMetadata[i] = parameterMetadata;
}

Expand Down
11 changes: 11 additions & 0 deletions src/test/java/testsuite/regression/StatementRegressionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13674,4 +13674,15 @@ public <T extends Resultset> T preProcess(java.util.function.Supplier<String> sq

}

/**
* Test fix for Bug#22931632, GETPARAMETERBINDINGS() ON A PS RETURNS NPE WHEN NOT ALL PARAMETERS ARE BOUND.
*
* @throws Exception
*/
@Test
public void testBug22931632() throws Exception {
this.pstmt = this.conn.prepareStatement("SELECT ?");
assertDoesNotThrow(((JdbcPreparedStatement) this.pstmt)::getParameterBindings);
}

}

0 comments on commit b226e34

Please sign in to comment.