Skip to content

Commit

Permalink
Some cleanups to initialize empty MetaData at fewer positions
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Aug 8, 2016
1 parent 086aa37 commit f808a73
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 16 deletions.
4 changes: 1 addition & 3 deletions src/main/java/net/sf/jabref/importer/ImportMenuItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

import javax.swing.JMenuItem;
import javax.swing.JOptionPane;

import net.sf.jabref.Globals;
import net.sf.jabref.MetaData;
import net.sf.jabref.gui.BasePanel;
import net.sf.jabref.gui.EntryMarker;
import net.sf.jabref.gui.FileDialogs;
Expand Down Expand Up @@ -278,7 +276,7 @@ private ParserResult mergeImportResults(List<ImportFormatReader.UnknownFormatImp
return directParserResult;
} else {

return new ParserResult(database, new MetaData(), new HashMap<>());
return new ParserResult(database);

}
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/net/sf/jabref/importer/ParserResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ public ParserResult() {
}

public ParserResult(Collection<BibEntry> entries) {
this(BibDatabases.createDatabase(BibDatabases.purgeEmptyEntries(entries)), new MetaData(), new HashMap<>());
this(BibDatabases.createDatabase(BibDatabases.purgeEmptyEntries(entries)));
}

public ParserResult(BibDatabase database) {
this(database, new MetaData(), new HashMap<>());
}

public ParserResult(BibDatabase base, MetaData metaData, Map<String, EntryType> entryTypes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

import net.sf.jabref.BibDatabaseContext;
import net.sf.jabref.Globals;
import net.sf.jabref.MetaData;
import net.sf.jabref.logic.journals.JournalAbbreviationLoader;
import net.sf.jabref.model.database.BibDatabase;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.preferences.JabRefPreferences;

Expand Down Expand Up @@ -47,7 +45,7 @@ public ExportFormatTest(IExportFormat format, String name) {
@Before
public void setUp() {
Globals.journalAbbreviationLoader = new JournalAbbreviationLoader();
databaseContext = new BibDatabaseContext(new BibDatabase(), new MetaData());
databaseContext = new BibDatabaseContext();
charset = Charsets.UTF_8;
entries = Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

import net.sf.jabref.BibDatabaseContext;
import net.sf.jabref.Globals;
import net.sf.jabref.MetaData;
import net.sf.jabref.logic.journals.JournalAbbreviationLoader;
import net.sf.jabref.model.database.BibDatabase;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.preferences.JabRefPreferences;

Expand Down Expand Up @@ -39,7 +37,7 @@ public void setUp() {
exportFormat = ExportFormats.getExportFormat("html");

Globals.journalAbbreviationLoader = new JournalAbbreviationLoader();
databaseContext = new BibDatabaseContext(new BibDatabase(), new MetaData());
databaseContext = new BibDatabaseContext();
charset = Charsets.UTF_8;
BibEntry entry = new BibEntry();
entry.setField("title", "my paper title");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

import net.sf.jabref.BibDatabaseContext;
import net.sf.jabref.Globals;
import net.sf.jabref.MetaData;
import net.sf.jabref.importer.fileformat.BibtexImporter;
import net.sf.jabref.model.database.BibDatabase;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.preferences.JabRefPreferences;

Expand Down Expand Up @@ -62,7 +60,7 @@ public static Collection<String> fileNames() throws IOException {
@Before
public void setUp() throws Exception {
Globals.prefs = JabRefPreferences.getInstance();
databaseContext = new BibDatabaseContext(new BibDatabase(), new MetaData());
databaseContext = new BibDatabaseContext();
charset = Charsets.UTF_8;
msBibExportFormat = new MSBibExportFormat();
tempFile = testFolder.newFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

import net.sf.jabref.BibDatabaseContext;
import net.sf.jabref.Globals;
import net.sf.jabref.MetaData;
import net.sf.jabref.model.database.BibDatabase;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.preferences.JabRefPreferences;

Expand All @@ -37,7 +35,7 @@ public class MsBibExportFormatTest {
@Before
public void setUp() throws Exception {
Globals.prefs = JabRefPreferences.getInstance();
databaseContext = new BibDatabaseContext(new BibDatabase(), new MetaData());
databaseContext = new BibDatabaseContext();
charset = Charsets.UTF_8;
msBibExportFormat = new MSBibExportFormat();
tempFile = testFolder.newFile();
Expand Down

0 comments on commit f808a73

Please sign in to comment.