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

Check integrity edition check implemented #1914

Merged
merged 28 commits into from
Sep 5, 2016
Merged

Check integrity edition check implemented #1914

merged 28 commits into from
Sep 5, 2016

Conversation

grimes2
Copy link
Contributor

@grimes2 grimes2 commented Sep 3, 2016

#1912 Implemented a check for the field edition. The check differentiates between BibTeX and BibLaTeX mode of the database.

  • Change in CHANGELOG.md described
  • Tests created for changes
  • Manually tested changed features in running JabRef

@grimes2
Copy link
Contributor Author

grimes2 commented Sep 3, 2016

Please set label "ready-for-review". Thank you.

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Sep 3, 2016
return Collections.emptyList();
}
//BibTeX
if (!FIRST_LETTER_CAPITALIZED.test(value.get().trim()) && (!bibDatabaseContext.isBiblatexMode())) {
Copy link
Member

@Siedlerchr Siedlerchr Sep 3, 2016

Choose a reason for hiding this comment

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

I would have changed the order of the statements in the conditions, checking for biblatex mode first:
Because the && is a short circuit operator, so the regex would only get evaluated if the mode condition is true
Edit// But as the regex is compiled I think the order doesn't really matter.

@Siedlerchr
Copy link
Member

LGTM +1, Just let someone other look at it, too.

Another thing I just got in mind is that the whole checker code could be refactored to use lamdbas, because we have a nice Functional Interface. Will create a new issue for discussing that.

@@ -28,7 +28,7 @@

public class IntegrityCheck {

private final BibDatabaseContext bibDatabaseContext;
private static BibDatabaseContext bibDatabaseContext;
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you want this to be static?

Copy link
Contributor Author

@grimes2 grimes2 Sep 3, 2016

Choose a reason for hiding this comment

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

Because I want to use a method of this class in class EditionChecker. An alternative is, to define a objectprivate final BibDatabaseContext bibDatabaseContext; in class EditionChecker, but this is redundant.

Copy link
Member

Choose a reason for hiding this comment

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

. An alternative is, to define a private final BibDatabaseContext
bibDatabaseContext; in class EditionChecker,

Seems to be the better solution as static variables sound like global
variables...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Many FieldChecker need access to the isBiblatexMode() method. It is bad to create for every FieldChecker class a new bibDatabaseContext object and inizialize it (in the FieldChecker constructor?).

Copy link
Member

@Siedlerchr Siedlerchr Sep 3, 2016

Choose a reason for hiding this comment

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

What about passing the bibDatabaseContext in the constructor of the Field Checker?
Edit// Even better, just pass a boolean in the constructor holding the value of isBiblatexMode..

@tobiasdiez
Copy link
Member

LGTM 👍, too. Just change the order in the if statement as @Siedlerchr suggest and then this could be merged.

@oscargus
Copy link
Contributor

oscargus commented Sep 5, 2016

And please extract the checker to its own file.

@Siedlerchr
Copy link
Member

Siedlerchr commented Sep 5, 2016

LGTM from my side now. 👍

@lenhard
Copy link
Member

lenhard commented Sep 5, 2016

@grimes2 Please rebase this on master and we will merge it in.

mlep and others added 10 commits September 5, 2016 18:01
* Mark some methods as deprecated in BibEntry and BibDatabase

* Rename getResolvedFieldOrAlias

* Use flatmap
* Fix location field not exported to office 2007 xml
* Add some test for exporting location and address field
Address in xml field is now imported as location
add some javadoc
* Add possibility to remember password.
- Add checkbox to the open shared database dialog
- Add SharedDatabasePreferences
- Add password encrypting and decrypting methods
- Update localization entries
- Reorganize clearing methods for Preferences

* Change prefs node and add class comment.

* Relativate node path for password storage.

* Fix LOGGER factory.

* Improve password encryption using XOR.

- Use username as one operand
- Add new parameter to the constructor

* Extract method.

* Improve exception handling.

* Improve password encryption and decryption.

- Use CBC and padding
- Hash the key before using
- Simplify conversion

* Fix modifier. Fix conflicts.
}

//BibLaTeX
if (!ONLY_NUMERALS_OR_LITERALS.test(value.get().trim()) && (bibDatabaseContextEdition.isBiblatexMode())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a minor thing: if you change the order of the test and mode it will be slightly faster (since checking mode is faster and the test will not happen is the mode is wrong).

Not required for merge though.

@oscargus
Copy link
Contributor

oscargus commented Sep 5, 2016

👍

@tobiasdiez
Copy link
Member

Thanks for your contribution!

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.

10 participants