davisusanibar commented on code in PR #37723:
URL: https://github.com/apache/arrow/pull/37723#discussion_r1445107183
##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/Accountant.java:
##########
@@ -73,12 +74,15 @@ public Accountant(Accountant parent, String name, long
reservation, long maxAllo
this.allocationLimit.set(maxAllocation);
if (reservation != 0) {
+ if (parent == null) {
+ throw new IllegalArgumentException(String.valueOf("Accountant(parent)
must not be null"));
+ }
Review Comment:
As I mention at
https://github.com/apache/arrow/pull/37723#discussion_r1444982298 (1st option)
if I added Preconditions.xxx then that finished also with errors, then, is
needed to add inline throw validation.
Finished OK:
````
final BufferLedger oldLedger = map.remove(allocator);
if (oldLedger == null) {
throw new IllegalArgumentException(String.valueOf("BufferLedger(oldLedger)
must not be null"));
}
BufferAllocator oldAllocator = oldLedger.getAllocator();
````
Finished with errors:
````
final BufferLedger oldLedger = map.remove(allocator);
Preconditions.checkArgument(oldLedger != null, "BufferLedger(oldLedger) must
not be null");
BufferAllocator oldAllocator = oldLedger.getAllocator();
Error message:
error: [dereference.of.nullable] dereference of possibly-null reference
oldLedger
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]