@@ -362,6 +362,18 @@ public UnknownFormatImport importUnknownFormat(String filename) {
362
362
int bestResultCount = 0 ;
363
363
String bestFormatName = null ;
364
364
365
+ // First, see if it is a BibTeX file:
366
+ try {
367
+ ParserResult pr = OpenDatabaseAction .loadDatabase (new File (filename ),
368
+ Globals .prefs .getDefaultEncoding ());
369
+ if ((pr .getDatabase ().getEntryCount () > 0 )
370
+ || (pr .getDatabase ().getStringCount () > 0 )) {
371
+ pr .setFile (new File (filename ));
372
+ return new UnknownFormatImport (ImportFormatReader .BIBTEX_FORMAT , pr );
373
+ }
374
+ } catch (Throwable ignore ) {
375
+ }
376
+
365
377
// Cycle through all importers:
366
378
for (ImportFormat imFo : getImportFormats ()) {
367
379
@@ -393,19 +405,6 @@ public UnknownFormatImport importUnknownFormat(String filename) {
393
405
return new UnknownFormatImport (bestFormatName , parserResult );
394
406
}
395
407
396
- // Finally, if all else fails, see if it is a BibTeX file:
397
- try {
398
- ParserResult pr = OpenDatabaseAction .loadDatabase (new File (filename ),
399
- Globals .prefs .getDefaultEncoding ());
400
- if ((pr .getDatabase ().getEntryCount () > 0 )
401
- || (pr .getDatabase ().getStringCount () > 0 )) {
402
- pr .setFile (new File (filename ));
403
- return new UnknownFormatImport (ImportFormatReader .BIBTEX_FORMAT , pr );
404
- }
405
- } catch (Throwable ex ) {
406
- return null ;
407
- }
408
-
409
408
return null ;
410
409
}
411
410
}
0 commit comments