Skip to content

Check integrity edition check implemented#1914

Merged
tobiasdiez merged 28 commits into
JabRef:masterfrom
grimes2:edition
Sep 5, 2016
Merged

Check integrity edition check implemented#1914
tobiasdiez merged 28 commits into
JabRef:masterfrom
grimes2:edition

Conversation

@grimes2

@grimes2 grimes2 commented Sep 3, 2016

Copy link
Copy Markdown
Contributor

#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

grimes2 commented Sep 3, 2016

Copy link
Copy Markdown
Contributor Author

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())) {

@Siedlerchr Siedlerchr Sep 3, 2016

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

public class IntegrityCheck {

private final BibDatabaseContext bibDatabaseContext;
private static BibDatabaseContext bibDatabaseContext;

Copy link
Copy Markdown
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?

@grimes2 grimes2 Sep 3, 2016

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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?).

@Siedlerchr Siedlerchr Sep 3, 2016

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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

@oscargus

oscargus commented Sep 5, 2016

Copy link
Copy Markdown
Contributor

And please extract the checker to its own file.

@Siedlerchr

Siedlerchr commented Sep 5, 2016

Copy link
Copy Markdown
Member

LGTM from my side now. 👍

@lenhard

lenhard commented Sep 5, 2016

Copy link
Copy Markdown
Member

@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
Copy Markdown
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

oscargus commented Sep 5, 2016

Copy link
Copy Markdown
Contributor

👍

@tobiasdiez

Copy link
Copy Markdown
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