-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fixes: #13673: Uncaught Exception in ThreeWayMerge dialog when looking up Bibliographic information from DOI #13705
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
Conversation
There was an error when the year was empty in the comparison, if a value was empty. I've added a check to make sure that the values are not empty before the comparison.
update working branch
Edited the comments for the checking of empty year values
I think that should be everything. |
String emptyString = ""; | ||
String validYearString = "1999"; | ||
|
||
ComparisonResult leftRight = ComparisonResult.LEFT_BETTER; |
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.
Please remove, the enum names are descriptive enough.
You are right, the comparaison logic is unnecessarily complicated. We need to do some refactoring. That's out of scope for the issue in hand, Edit: It seems you have misunderstood the root cause of the issue. The problem arises from calling the get() method on an empty Optional; It has nothing to do with empty or blank String values. The Optional will be empty when the validator i.e. YearChecker decides it is invalid. |
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.
This is not the correct fix, please read the stacktrace again and maybe run the debugger to get a better understanding of what's happening.
Co-authored-by: Houssem Nasri <[email protected]>
@trag-bot didn't find any issues in the code! ✅✨ |
YearChecker.checkValue only checks the formatting of the value and returns an empty value, if its correct or empty. |
Please stop calling it an empty value and call it an Optional so I know we are on the same page. An empty Optional does not have anything to do with strings or "". The testcase you added checks for empty strings only. |
My mistake, i will use the correct name from now on. I guess i was a bit confused, since the YearChecker returns null on the string and later on i checked an optional integer and not a string. Since this is not the intended solution i will try to find a better one. |
I'll close this PR and open a new one, since i need to redo all my changes. |
Closes #13673
I added a function to check for empty year values in the YearFieldValuePlausibilityComparator, because there were only checks for the formatting of the year.
In there I added a function to check if one of the values that are being compared is empty. That should prevent the empty value exception for either of the values.
The value from the database should never be empty (the right one), but i added a failsafe just in case the value is empty in the database.
I was not sure if i needed to add something to the
CHANGELOG.md
, but i did just in case.Steps to test
(on the main branch and this branch)
The button in the General Tab:

The error message before the changes:

The article with the changes:

Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)