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

Make BibTex parser more robust against missing newlines #677

Merged
merged 2 commits into from
Jan 18, 2016

Conversation

tobiasdiez
Copy link
Member

As described in #669 and #621 the parser has some problems when an entry (or preamble) follows directly the file encoding header (on the same line), i.e.
% Encoding: myEncoding @article{...}.
Actually, as the tests reveal it was not a problem with the actual parser but within the file opening logic.
I don't view this PR as a complete fix for #669 and #621 since not just the parser but also the serialization should be improved.

Also fix a bug that prevented the import of BibTex entries having only a key as its content.

and fix bug that prevented the import of BibTex entries having only a
key as content
@tobiasdiez tobiasdiez added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jan 16, 2016
if(atSymbolIndex > 0)
encoding = line.substring(Globals.encPrefix.length(), atSymbolIndex);
else
encoding = line.substring(Globals.encPrefix.length());
Copy link
Contributor

Choose a reason for hiding this comment

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

Please always use curly braces as this makes the semantics explicit.

@simonharrer
Copy link
Contributor

👍 (except my minor comment)

@tobiasdiez
Copy link
Member Author

Corrected... for some reason the code style was not imported correctly in Intellij.

@simonharrer
Copy link
Contributor

Hm, I just use the default Intellij code style. :)

simonharrer added a commit that referenced this pull request Jan 18, 2016
Make BibTex parser more robust against missing newlines
@simonharrer simonharrer merged commit 86f5016 into JabRef:master Jan 18, 2016
@tobiasdiez tobiasdiez deleted the fixParser branch January 18, 2016 09:07
@lenhard
Copy link
Member

lenhard commented Jan 18, 2016

@tobiasdiez: what do you think should be done to fix the above issues completely?

@tobiasdiez
Copy link
Member Author

@lenhard In my opinion JabRef should add new lines after the encoding and preamble. I'm working on a solution right now (including a 'bit' of refactoring to make testing easier).

@lenhard
Copy link
Member

lenhard commented Jan 25, 2016

@tobiasdiez Ok, good to hear! I'll concentrate on other issues then.

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.

3 participants