Skip to content

Commit 8de7833

Browse files
authored
Fix a couple of minor, internal-only coding issues found by async work
1 parent 3fc643d commit 8de7833

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

driver/src/main/java/oracle/nosql/driver/ops/Request.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -593,20 +593,22 @@ public String getOboToken() {
593593
/**
594594
* @hidden
595595
* Copy internal fields to another Request object.
596+
* Use direct member assignment to avoid value checks that only apply
597+
* to user-based assignments.
596598
* @param other the Request object to copy to.
597599
*/
598600
public void copyTo(Request other) {
599-
other.setTimeoutInternal(this.timeoutMs);
600-
other.setCheckRequestSize(this.checkRequestSize);
601-
other.setCompartmentInternal(this.compartment);
602-
other.setTableNameInternal(this.tableName);
603-
other.setNamespaceInternal(this.namespace);
604-
other.setStartNanos(this.startNanos);
605-
other.setRetryStats(this.retryStats);
606-
other.setReadRateLimiter(this.readRateLimiter);
607-
other.setWriteRateLimiter(this.writeRateLimiter);
608-
other.setRateLimitDelayedMs(this.rateLimitDelayedMs);
609-
other.setPreferThrottling(this.preferThrottling);
610-
other.setDRLOptIn(this.drlOptIn);
601+
other.timeoutMs = this.timeoutMs;
602+
other.checkRequestSize = this.checkRequestSize;
603+
other.compartment = this.compartment;
604+
other.tableName = this.tableName;
605+
other.namespace = this.namespace;
606+
other.startNanos = this.startNanos;
607+
other.retryStats = this.retryStats;
608+
other.readRateLimiter = this.readRateLimiter;
609+
other.writeRateLimiter = this.writeRateLimiter;
610+
other.rateLimitDelayedMs = this.rateLimitDelayedMs;
611+
other.preferThrottling = this.preferThrottling;
612+
other.drlOptIn = this.drlOptIn;
611613
}
612614
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -533,20 +533,18 @@ private boolean checkDuplicate(
533533

534534
private BinaryValue createBinaryPrimKey(MapValue result) {
535535

536-
final ByteOutputStream bos =
537-
NettyByteOutputStream.createNettyByteOutputStream();
538-
try {
536+
try (ByteOutputStream bos =
537+
NettyByteOutputStream.createNettyByteOutputStream()) {
539538
for (int i = 0; i < thePrimKeyFields.length; ++i) {
540539
FieldValue fval = result.get(thePrimKeyFields[i]);
541540
writeValue(bos, fval, i);
542541
}
542+
return new BinaryValue(bos.array());
543543
} catch (IOException e) {
544544
throw new QueryStateException(
545545
"Failed to create binary prim key due to IOException:\n" +
546546
e.getMessage());
547547
}
548-
549-
return new BinaryValue(bos.array());
550548
}
551549

552550
private void writeValue(ByteOutputStream out, FieldValue val, int i)
@@ -737,7 +735,7 @@ void fetch() {
737735
}
738736

739737
if (theRCB.getTraceLevel() >= 1) {
740-
theRCB.trace("RemoteScanner : executing remote batch " +
738+
theRCB.trace("RemoteScanner : executing remote batch " +
741739
origRequest.getBatchCounter() + ". spid = " +
742740
theShardOrPartId);
743741
if (theVirtualScan != null) {

0 commit comments

Comments
 (0)