sundapeng opened a new pull request, #9885:
URL: https://github.com/apache/paimon/pull/9885

   ### Purpose
   
   `CreatePartitionsRequest` validates its `partitionOptions` with
   
   ```java
   checkArgument(
           partitionOptions == null || !partitionOptions.contains(null),
           "partitionOptions must not contain null maps.");
   ```
   
   `List.of(...)` rejects `null` queries, so `contains(null)` throws 
`NullPointerException` instead of returning `false`. A caller that passes a 
perfectly valid immutable list therefore gets an NPE out of the guard whose job 
is to explain what is wrong with the argument, and the stack points into 
`ImmutableCollections`, not at the request:
   
   ```java
   new CreatePartitionsRequest(
           List.of(Map.of("dt", "20260916")),
           true,
           null,
           null,
           List.of(Map.of("path", "oss://bucket/archive/dt=20260916")));
   ```
   
   ```
   java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:222)
        at 
java.base/java.util.ImmutableCollections$AbstractImmutableList.indexOf(ImmutableCollections.java:170)
        at 
java.base/java.util.ImmutableCollections$AbstractImmutableList.contains(ImmutableCollections.java:201)
        at 
org.apache.paimon.rest.requests.CreatePartitionsRequest.<init>(CreatePartitionsRequest.java:109)
        at org.apache.paimon.rest.RESTApi.createPartitions(RESTApi.java:1051)
   ```
   
   Found while writing a test that registers a Format Table partition at a 
custom location through `RESTApi.createPartitions`. The server side is 
unaffected — Jackson deserializes into an `ArrayList` — so this only bites Java 
clients and test fixtures that build the list with `List.of`.
   
   ### Tests
   
   
`RESTApiJsonTest#createPartitionsRequestAcceptsImmutablePartitionOptionsTest` 
covers both directions: an immutable list of options is accepted and 
round-trips, and a list that really does hold a `null` map still fails with the 
intended `IllegalArgumentException` and message. It fails with the NPE above on 
master and passes with this change.
   
   ### API and Format
   
   No. The accepted inputs and the rejection message are unchanged; only a 
valid input that used to throw the wrong exception now works.
   
   ### Documentation
   
   No.
   


-- 
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]

Reply via email to