Skip to content

Commit 28b8179

Browse files
committed
add epilogPattern to constructor
1 parent 96101a2 commit 28b8179

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

jablib/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class BibtexParser implements Parser {
9696
private static final String BIB_DESK_ROOT_GROUP_NAME = "BibDeskGroups";
9797
private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
9898
private static final int INDEX_RELATIVE_PATH_IN_PLIST = 4;
99-
private static final Pattern EPILOG_PATTERN = Pattern.compile("\\w+\\s*=.*,");
99+
private final Pattern epilogPattern;
100100
private final Deque<Character> pureTextFromFile = new LinkedList<>();
101101
private final ImportFormatPreferences importFormatPreferences;
102102
private PushbackReader pushbackReader;
@@ -121,6 +121,7 @@ public BibtexParser(ImportFormatPreferences importFormatPreferences, FileUpdateM
121121
this.importFormatPreferences = Objects.requireNonNull(importFormatPreferences);
122122
this.metaDataParser = new MetaDataParser(fileMonitor);
123123
this.parsedBibDeskGroups = new HashMap<>();
124+
this.epilogPattern = Pattern.compile("\\w+\\s*=.*,");
124125
}
125126

126127
public BibtexParser(ImportFormatPreferences importFormatPreferences) {
@@ -312,7 +313,7 @@ private ParserResult parseFileContent() throws IOException {
312313
private void checkEpilog() {
313314
// This is an incomplete and inaccurate try to verify if something went wrong with previous parsing activity even though there were no warnings so far
314315
// regex looks for something like 'identifier = blabla ,'
315-
if (!parserResult.hasWarnings() && EPILOG_PATTERN.matcher(database.getEpilog()).find()) {
316+
if (!parserResult.hasWarnings() && epilogPattern.matcher(database.getEpilog()).find()) {
316317
parserResult.addWarning(new ParserResult.Range(line, column, line, column), "following BibTeX fragment has not been parsed:\n" + database.getEpilog());
317318
}
318319
}

0 commit comments

Comments
 (0)