Skip to content

Commit cbd22fb

Browse files
authored
Fix NPE that could occur when closing a complex query that hasn't been fully initialized
1 parent f61bac3 commit cbd22fb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
2222
- Authentication calls for on premises login will now honor the request timeout
2323
rather than using a hard-coded 30s timeout
2424

25+
### Fixed
26+
- Fixed a problem where if QueryRequest were created with a complex query and
27+
closed before results were handled a null pointer exception could occur.
28+
2529
## [5.4.17] 2025-03-03
2630

2731
### Added

driver/src/main/java/oracle/nosql/driver/query/QueryDriver.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,17 @@ private void setQueryResult(QueryResult result) {
234234
}
235235

236236
public void close() {
237-
theRequest.getPreparedStatement().driverPlan().close(theRCB);
237+
/* if there is no RCB there is no state to clean up */
238+
if (theRCB != null) {
239+
theRequest.getPreparedStatement().driverPlan().close(theRCB);
240+
}
238241
if (theResults != null) {
239242
theResults.clear();
240243
theResults = null;
241244
}
242245
}
243246

244247
public String getQueryTrace() {
245-
return theRCB.getQueryTrace();
248+
return theRCB != null ? theRCB.getQueryTrace() : null;
246249
}
247250
}

0 commit comments

Comments
 (0)