Skip to content

Commit

Permalink
Merge pull request #531 from boceckts/IsRecognizedFormatFix
Browse files Browse the repository at this point in the history
Import Format Reader Fix
  • Loading branch information
simonharrer committed Dec 21, 2015
2 parents 85904c7 + c0ec6d1 commit a54e565
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit a54e565

Please sign in to comment.