You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "nick-boss-tech (via GitHub)" <gi...@apache.org> on 2026/10/09 20:32:24 UTC

[PR] SOLR-16673: Strange error when using Schema Designer [solr]

nick-boss-tech opened a new pull request, #5094:
URL: https://github.com/apache/solr/pull/5094

   🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)*
   
   https://issues.apache.org/jira/browse/SOLR-16673
   
   Title: The Parse{Int,Long,Float,Double}FieldUpdateProcessorFactory classes no longer fail with a NullPointerException on an empty string value
   
   ## What happens today
   
   **An empty string in a Parse{Int,Long,Float,Double}FieldUpdateProcessorFactory field throws a NullPointerException.**
   
   `NumberFormat.parse` returns null for an empty string. The bounds check still passes, because the parse position and the string length are both 0. The code then calls a method on the null result, for example `number.intValue()` in [ParseIntFieldUpdateProcessorFactory.java](https://github.com/nick-boss-tech/solr/blob/d7170b12f312b364cb280b943a042707e553ea64/solr/core/src/java/org/apache/solr/update/processor/ParseIntFieldUpdateProcessorFactory.java#L101).
   
   ## What this change does
   
   **An empty string that does not parse is skipped, so the value stays as it was.**
   
   Each of the four factories treats a null parse result as unparseable. The check is now `number == null || pos.getIndex() != stringVal.length()` in [Int](https://github.com/nick-boss-tech/solr/blob/d7170b12f312b364cb280b943a042707e553ea64/solr/core/src/java/org/apache/solr/update/processor/ParseIntFieldUpdateProcessorFactory.java#L93), [Long](https://github.com/nick-boss-tech/solr/blob/d7170b12f312b364cb280b943a042707e553ea64/solr/core/src/java/org/apache/solr/update/processor/ParseLongFieldUpdateProcessorFactory.java#L104), [Float](https://github.com/nick-boss-tech/solr/blob/d7170b12f312b364cb280b943a042707e553ea64/solr/core/src/java/org/apache/solr/update/processor/ParseFloatFieldUpdateProcessorFactory.java#L96), and [Double](https://github.com/nick-boss-tech/solr/blob/d7170b12f312b364cb280b943a042707e553ea64/solr/core/src/java/org/apache/solr/update/processor/ParseDoubleFieldUpdateProcessorFactory.java#L107). The value is then kept.
   
   ## Proof
   
   **The gate at the parent head passed, and the new test fails without the fix.**
   
   - Gate at `d5c19e64ba1b`: the changelog parses. Tidy returns 0. The Error Prone compile returns 0. The fail-before check reports PASS, so the new test fails on the code without the fix. `ParsingFieldUpdateProcessorsTest` passes 43 of 43. `:solr:core:check -x test` returns 0.
   - The head is now `d7170b12f312`. The only change since that gate is the changelog title line. No code or test changed.
   - The new test [testEmptyStringIsNotParsedAsNumber](https://github.com/nick-boss-tech/solr/blob/d7170b12f312b364cb280b943a042707e553ea64/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java#L499-L514) sends an empty string through the four chains. It checks that the value is kept.
   
   ## Limits
   
   **The Schema Designer path and the other errors in the ticket sample are not covered.**
   
   - The test calls the four processor chains. It does not run the Schema Designer path, where [DefaultSchemaSuggester.isIntOrLong](https://github.com/nick-boss-tech/solr/blob/d7170b12f312b364cb280b943a042707e553ea64/solr/core/src/java/org/apache/solr/handler/designer/DefaultSchemaSuggester.java#L338) feeds the Long parser. The ticket reports Schema Designer failures on empty values. The link between the two is not tested here.
   - The same ticket sample also hits a non-string unique key and child-document `_root_` type errors. This change does not touch them. A follow-up ticket and PR can cover them on request.
   
   Changelog: `changelog/unreleased/SOLR-16673.yml` (type: fixed).
   
   ### AI assistance
   
   AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.
   


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-16673: The Parse{Int,Long,Float,Double}FieldUpdateProcessorFactory classes no longer fail with a NullPointerException on an empty string value [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #5094:
URL: https://github.com/apache/solr/pull/5094#issuecomment-6126586007

   Posted an independent vetting pass on this PR (reproduced the bug on `main`, confirmed the fix on this branch, traced the fix through to the originally-reported Schema Designer crash path): https://claude.ai/code/artifact/e5aa97fa-a8e5-476b-9897-b969602f3af4
   
   Verdict: approve, with one note — worth explicitly calling out in the description why this takes a different approach than the `return null` suggested earlier in the JIRA thread.


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-16673: The Parse{Int,Long,Float,Double}FieldUpdateProcessorFactory classes no longer fail with a NullPointerException on an empty string value [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #5094:
URL: https://github.com/apache/solr/pull/5094#issuecomment-6156127453

   I've tagged @HoustonPutman since he opened up the orgininal ticket.   This all seems more or less reasonable!


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-16673: The Parse{Int,Long,Float,Double}FieldUpdateProcessorFactory classes no longer fail with a NullPointerException on an empty string value [solr]

Posted by "nick-boss-tech (via GitHub)" <gi...@apache.org>.
nick-boss-tech commented on PR #5094:
URL: https://github.com/apache/solr/pull/5094#issuecomment-6136855637

   > worth explicitly calling out in the description why this takes a different approach than the `return null` suggested earlier in the JIRA thread.
   
   Thanks for the review, I made the changes to the PR description and added the text to the reference guide.


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org