-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bracket collisions #6469
Fix bracket collisions #6469
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM. I've one question, where I'm not sure that a certain edge case is currently covered correctly. Apart from this 👍 for merge.
Boolean foundClosingBracket = false; | ||
// make sure to read until the next ']' | ||
while (st.hasMoreTokens()) { | ||
String subtoken = st.nextToken(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: you fetch the next token above in line 131, and then here the subtoken. So this moves the stream forward twice, right? What happens if the user adds an empty brace, i.e []
. Is the closing bracket still found? Can you please add a test for this case as well. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! But what should "[]" expand to? Inside a quote, the parsing should work fine. but what does "[]" mean in terms of JabRef fields? Should it just do nothing and print an appropriate warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would say it should do nothing and log a warning. I don't really see a use case for the empty bracket, it should just not break the parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 230fef2
Thanks again for your valuable contributions! 🥇 |
Glad to help and happy to have my regular expressions supported :) |
Brackets in regular expressions were interpreted as brackets for fields. This change allows users to define regular expressions that contain brackets. This led to an exception before.