Fix NPE when importing old JabRef preferences#14597
Conversation
|
Hey @pulkitbajaj! 👋 Thank you for contributing to JabRef! We have automated checks in place, based on which you will soon get feedback if any of them are failing. After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. Please re-check our AI Usage Policy to ensure that your pull request is in line with it. It also contains links to our contribution guide in case of any other doubts related to our contribution workflow. |
f3ea7aa to
8125a1d
Compare
| defaults.put(VERSION_IGNORED_UPDATE, ""); | ||
| defaults.put(VERSION_CHECK_ENABLED, Boolean.TRUE); | ||
|
|
||
| Localization.setLanguage(getLanguage()); |
There was a problem hiding this comment.
Why this was moved? Why not the comments?
I think, this should be kept as is?!?!?!
There was a problem hiding this comment.
I moved this to the end of the constructor to ensure that the defaults map is fully populated before getLanguage() is called. In original version, calling it so early (before initialization was complete) contributed to the NullPointerException/initialization issues we saw.
You are right about the comments-I should have moved them down along with the code. I can move the comments to line 717 to match the code location. Would that resolve the concern?
There was a problem hiding this comment.
defaults map is to be removed anyways as soon as #14400 is finished, so that issue with a non populated defaults map is probably something that might be a deeper issue - or a non-issue. However, move fast.
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
… fix/import-preferences-npe
Removed duplicate entry for fixing drag and drop reordering of linked files.
… fix/import-preferences-npe
Closes #14497
Steps to test
JabRef.xmlfile provided in issue Import old jabref preferences fails with npe odel.metadata.UserHostInfo.getUserHostString #14497.new JabRefCliPreferences().getInternalPreferences().NullPointerExceptionbefore the fix.Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)AI Disclosure: I used an AI assistant to help analyze the stack trace, understand the root cause (NullPointerException), and draft the reproduction test case. I manually verified the fix and the test results.