[ 
https://issues.apache.org/jira/browse/LUCENE-5952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137286#comment-14137286
 ] 

Uwe Schindler commented on LUCENE-5952:
---------------------------------------

Hi,
one thing about the new Code using StringTokenizer. Beware of this issue: 
[http://stackoverflow.com/questions/11409320/java-stringtokenizer-nexttoken-skips-over-empty-fiels].
 The reason for this is "A token is a maximal sequence of consecutive 
characters that are not delimiters."

In fact, StringTokenizer removes empty tokens. Wth the new code this "4..9.0" 
would be parsed as "4.9.0".

If you think there might be a bug in Java 8's String.split, I would use a regex 
and capturing groups. Like the Parser for LUCENE_xxx constants. Or 
alternatively, loop over the string and do {{if (ch == '.') ...}} like stuff. I 
have a custom StringTokenizer using a StringBuilder internally, which does not 
remove empty tokens.

> Give Version parsing exceptions more descriptive error messages
> ---------------------------------------------------------------
>
>                 Key: LUCENE-5952
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5952
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 4.10
>            Reporter: Michael McCandless
>            Priority: Blocker
>             Fix For: 4.10.1, 4.11, 5.0
>
>         Attachments: LUCENE-5952.patch, LUCENE-5952.patch, LUCENE-5952.patch, 
> LUCENE-5952.patch
>
>
> As discussed on the dev list, it's spooky how Version.java tries to fully 
> parse the incoming version string ... and then throw exceptions that lack 
> details about what invalid value it received, which file contained the 
> invalid value, etc.
> It also seems too low level to be checking versions (e.g. is not future proof 
> for when 4.10 is passed a 5.x index by accident), and seems redundant with 
> the codec headers we already have for checking versions?
> Should we just go back to lenient parsing?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to