Skip to content
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

Catch NumberFormatException if context can't be parsed in groups #2488

Merged
merged 3 commits into from
Jan 26, 2017

Conversation

tobiasdiez
Copy link
Member

@tobiasdiez tobiasdiez commented Jan 24, 2017

Fixes #2477 in the sense that a more detailed error message is displayed.
The functional change is https://github.com/JabRef/jabref/pull/2488/files#diff-48e24aa13e9cd41a20bf4e79f4ad7d6bR129, while the rest is a bit of code cleanup (introduction of helper methods, removal of unused code, change public -> private if applicable).

  • Change in CHANGELOG.md described
  • Tests created for changes
  • Screenshots added (for bigger UI changes)
  • Manually tested changed features in running JabRef
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)
  • If you changed the localization: Did you run gradle localizationUpdate?

@tobiasdiez tobiasdiez added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jan 24, 2017
@tobiasdiez tobiasdiez requested a review from lenhard January 24, 2017 21:05
Copy link
Member

@lenhard lenhard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this locally and I get the warning when trying to open the bib file in question. So this should be fine. The code looks fine to me, except for one specific thing.

Since you have developer access, next time please create a branch in the official repo and not in your fork ;-)

Also, this is probably a good opportunity to force you to write tests for random stuff, but I am letting it go.

return errorMessage;
}

public static ParserResult getNullResult() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This smells a lot like singleton. There are potential problems in the current implementation, which do probably not manifest, but let us improve this anyway: If you always hand out the same NULL_RESULT, a caller of the method can modify this result (e.g. NULL_RESULT.getDatabase().add(...)), which could theoretically lead to interesting observations at other places.

Long story short: Please always create a new empty ParserResult here. Thus, you can also remove NullResult.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. I completely inlined the getNullResult method as I don't see any need to encapsulate a constructor call in a new method.

@tobiasdiez tobiasdiez merged commit e61279b into JabRef:master Jan 26, 2017
@tobiasdiez tobiasdiez deleted the explGroup branch January 26, 2017 12:02
Siedlerchr added a commit that referenced this pull request Jan 26, 2017
* upstream/master:
  Fix medline tests...again (#2492)
  Make sure that unregistered event sources do not stop JabRef from shu… (#2487)
  Fix #2481: ClassCastException because of wrong cast (#2490)
  Catch NumberFormatException if context can't be parsed in groups (#2488)
  Improve CHANGELOG formatting
  Update guava from 20.0 to 21.0 and mockito-core from 2.5.5 to 2.6.2
  Fix aux duplicates (#2480)
  add update from DOI to the entryeditor sidebar (#2476)
  Remove obsolete import
  Add CHANGELOG entry (and one more link)
  Resolves #2309 JabRef freezes when importing unlinked PDF files into Database
  Update CHANGELOG.md
  Fixed bug when assigning refs to groups.
  emove html code from ACM fetcher before calling parser to prevent junk in bib file (#2473)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants