Skip to content

Commit 6681865

Browse files
authored
Overlap error code changes with changes of this branch
1 parent 0ef1159 commit 6681865

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

jabkit/src/main/java/org/jabref/cli/CheckConsistency.java

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,7 @@ public Integer call() {
7373
});
7474

7575
Writer writer = new OutputStreamWriter(System.out);
76-
BibliographyConsistencyCheckResultWriter checkResultWriter;
77-
if ("txt".equalsIgnoreCase(outputFormat)) {
78-
checkResultWriter = new BibliographyConsistencyCheckResultTxtWriter(
79-
result,
80-
writer,
81-
sharedOptions.porcelain,
82-
argumentProcessor.entryTypesManager,
83-
databaseContext.getMode());
84-
} else {
85-
checkResultWriter = new BibliographyConsistencyCheckResultCsvWriter(
86-
result,
87-
writer,
88-
sharedOptions.porcelain,
89-
argumentProcessor.entryTypesManager,
90-
databaseContext.getMode());
91-
}
76+
BibliographyConsistencyCheckResultWriter checkResultWriter = getBibliographyConsistencyCheckResultWriter(result, writer, databaseContext);
9277

9378
// System.out should not be closed, therefore no try-with-resources
9479
try {
@@ -108,4 +93,29 @@ public Integer call() {
10893
}
10994
return 0;
11095
}
96+
97+
private BibliographyConsistencyCheckResultWriter getBibliographyConsistencyCheckResultWriter(
98+
BibliographyConsistencyCheck.Result result,
99+
Writer writer,
100+
BibDatabaseContext databaseContext) {
101+
BibliographyConsistencyCheckResultWriter checkResultWriter;
102+
103+
if ("txt".equalsIgnoreCase(outputFormat)) {
104+
checkResultWriter = new BibliographyConsistencyCheckResultTxtWriter(
105+
result,
106+
writer,
107+
sharedOptions.porcelain,
108+
argumentProcessor.entryTypesManager,
109+
databaseContext.getMode());
110+
} else {
111+
checkResultWriter = new BibliographyConsistencyCheckResultCsvWriter(
112+
result,
113+
writer,
114+
sharedOptions.porcelain,
115+
argumentProcessor.entryTypesManager,
116+
databaseContext.getMode());
117+
}
118+
119+
return checkResultWriter;
120+
}
111121
}

0 commit comments

Comments
 (0)