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

Import Format Reader Fix #531

Merged
merged 1 commit into from
Dec 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by
- Default order in entry table: # | all file based icons (file, URL/DOI, ...) | all bibtex field based icons (bibtexkey, entrytype, author, title, ...) | all activated special field icons (ranking, quality, ...)

### Fixed
- Fixed #479: Import works again
- Fixed #434: Revert to old 'JabRef' installation folder name instead of 'jabref'
- Fixed #435: Retrieve non open access ScienceDirect PDFs via HTTP DOM
- Fixed: Cleanup process aborts if linked file does not exists
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/net/sf/jabref/importer/ImportFormatReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,18 @@ public List<BibEntry> importFromFile(String format, String filename, OutputPrint
public List<BibEntry> importFromFile(ImportFormat importer, String filename, OutputPrinter status) throws IOException {
File file = new File(filename);

try (InputStream stream = new FileInputStream(file)) {
try (InputStream stream = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(stream)) {

if (!importer.isRecognizedFormat(stream)) {
bis.mark(Integer.MAX_VALUE);

if (!importer.isRecognizedFormat(bis)) {
throw new IOException("Wrong file format");
}

return importer.importEntries(stream, status);
bis.reset();

return importer.importEntries(bis, status);
}
}

Expand Down