Copilot commented on code in PR #4168:
URL: https://github.com/apache/solr/pull/4168#discussion_r2908640306


##########
solr/modules/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java:
##########
@@ -82,7 +81,7 @@ public String getField() {
 
   public void setField(String field) {
     this.field = field;
-    fieldAsSet = Collections.singleton(field);
+    fieldAsSet = Set.of(field);
   }

Review Comment:
   `setField` now calls `Set.of(field)` which will throw a 
`NullPointerException` if a plugin config (or reflective setter invocation) 
passes a null value. Previously `Collections.singleton(field)` would tolerate 
null and the later `validate()` would raise a clear `FeatureException`. 
Consider guarding against null here (e.g., set `fieldAsSet` to an empty set or 
throw an `IllegalArgumentException` with a clear message) so configuration 
errors produce actionable exceptions instead of an NPE.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to