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

DOI Fetcher using the new fetcher infrastructure #1885

Merged
merged 18 commits into from
Sep 15, 2016

Conversation

zesaro
Copy link
Contributor

@zesaro zesaro commented Aug 29, 2016

(Please do not squash at merge to keep author ships - @koppor)

Implement a new DOI Fetcher using the new fetcher infrastructure #1594
In this case, the two classes DOItoBibTeX & DOItoBibTeXFetcher has been merged into the new Fetcher.

  • Tests created for changes
  • Manually tested changed features in running JabRef

@Siedlerchr
Copy link
Member

It would be really nice if you could address #1799 here as well. (I think the fetcher just has to be called in background thread somehow)

@oscargus
Copy link
Contributor

oscargus commented Sep 1, 2016

The SwingWorker commit looks really interesting (and not so hard to use...)! 👍

return Optional.empty();
}
} catch (IOException e) {
throw new FetcherException("Bad URL when fetching ISBN info", e);
Copy link
Member

Choose a reason for hiding this comment

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

Seem like a copy & paste error ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed

this.prefs = preferences;
}

public static Optional<BibEntry> getEntryFromDOI(String doiStr, ParserResult parserResult, ImportFormatPreferences importFormatPreferences){
Copy link
Contributor

@tschechlovdev tschechlovdev Sep 5, 2016

Choose a reason for hiding this comment

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

Why not just doi instead of doiStr ?
And would be nice if you would stay consistent and write everywhere preferences for example instead of importFormatPreferences or prefs.

@chriba
Copy link
Contributor

chriba commented Sep 5, 2016

Fixed a Bug when editing the Doi field and using the get BibTex button right beside it.
When saving the changed doi field to the BibEntry it rewrote it to the textfield which disabled the fetcher and enabled it again which aborted the useres click.

}

Copy link
Contributor

Choose a reason for hiding this comment

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

delete empty line

@tschechlovdev tschechlovdev added status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers and removed stupro-ready-for-internal-review labels Sep 12, 2016
IdBasedFetcher fetcher;
if (FieldName.DOI.equals(field)) {
fetcher = new DoiFetcher(Globals.prefs.getImportFormatPreferences());
} else if (FieldName.ISBN.equals(field)) {
Copy link
Member

Choose a reason for hiding this comment

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

Use switch here

// BibTeX entry
return BibtexParser.singleFromString(cleanupEncoding(bibtexString), preferences);
} else {
LOGGER.warn(Localization.lang("Invalid DOI: '%0'.", identifier));
Copy link
Member

Choose a reason for hiding this comment

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

throw FetcherException instead (so that the caller gets an better error description instead of just an empty result)

# Conflicts:
#	src/main/java/net/sf/jabref/logic/importer/fileformat/PdfContentImporter.java
@tobiasdiez
Copy link
Member

Could please add an additional test for an article (instead of book), for example doi: 10.1109/ICWS.2007.59. I think afterwards we can merge it.

Optional<BibEntry> result = BibtexParser.singleFromString(cleanupEncoding(bibtexString), preferences);
return result;
} else {
throw new FetcherException(String.format("Invalid DOI: %s", identifier));
Copy link
Member

Choose a reason for hiding this comment

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

Is the text of the fetcher exception presented in the UI at another place in the UI?

Then, please do not remove the translation and add Localization.lang here.

I think, at least b85c379 has to be reverted.

Copy link
Member

Choose a reason for hiding this comment

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

Still not fixed. Maybe exception.getLocalizedMessage() is a hint how to code that.

# Conflicts:
#	src/main/java/net/sf/jabref/gui/importer/fetcher/EntryFetchers.java
@stefan-kolb stefan-kolb changed the title [WIP] DOI Fetcher using the new fetcher infrastructure DOI Fetcher using the new fetcher infrastructure Sep 13, 2016
@koppor koppor removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Sep 13, 2016
@koppor
Copy link
Member

koppor commented Sep 13, 2016

Before this is ready to go:

  • Fix localization issue.


@Before
public void setUp() {
fetcher = new DoiFetcher(Globals.prefs.getImportFormatPreferences());
Copy link
Member

Choose a reason for hiding this comment

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

Could you pls fix the failing test by using mock(ImportFormatPreferences.class) here (if possible, if not JabRefPreferences.getInstance or so does the trick)

@tobiasdiez tobiasdiez closed this Sep 15, 2016
@tobiasdiez tobiasdiez reopened this Sep 15, 2016
@tobiasdiez
Copy link
Member

tobiasdiez commented Sep 15, 2016

No idea why the integration tests don't work here. @JabRef/developers should we merge nonetheless?

@koppor
Copy link
Member

koppor commented Sep 15, 2016

Sure. Maybe, we should disable the integration tests (refs #1524).

@koppor koppor merged commit e298257 into JabRef:master Sep 15, 2016
@zesaro zesaro deleted the doifetcher branch September 15, 2016 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants