This is an automated email from the git hooks/post-receive script. tmancill pushed a commit to branch dev in repository jabref.
commit cdabebd44b8ef9acd608fb17bb2f10fe7e79503b Author: tony mancill <[email protected]> Date: Wed Dec 14 23:09:56 2016 -0800 add 001_koppor_debian_3.8.patch difference between jabref/master and koppor/debian_3.8 --- debian/patches/001_koppor_debian_3.8.patch | 1427 ++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 1428 insertions(+) diff --git a/debian/patches/001_koppor_debian_3.8.patch b/debian/patches/001_koppor_debian_3.8.patch new file mode 100644 index 0000000..785d609 --- /dev/null +++ b/debian/patches/001_koppor_debian_3.8.patch @@ -0,0 +1,1427 @@ +diff --git a/build.gradle b/build.gradle +index c31aab6d2..343d21c63 100644 +--- a/build.gradle ++++ b/build.gradle +@@ -91,8 +91,6 @@ dependencies { + compile 'org.openoffice:ridl:4.1.2' + compile 'org.openoffice:unoil:4.1.2' + +- compile 'com.github.bkromhout:java-diff-utils:2.1.1' +- + antlr3 'org.antlr:antlr:3.5.2' + compile 'org.antlr:antlr-runtime:3.5.2' + +@@ -102,7 +100,7 @@ dependencies { + // VersionEye states that 6.0.5 is the most recent version, but http://dev.mysql.com/downloads/connector/j/ shows that as "Development Release" + compile 'mysql:mysql-connector-java:5.1.40' + +- compile 'com.impossibl.pgjdbc-ng:pgjdbc-ng:0.6' ++ compile 'org.postgresql:postgresql:9.4.1210' + + compile 'net.java.dev.glazedlists:glazedlists_java15:1.9.1' + compile fileTree(dir: 'lib', includes: ['*.jar']) +@@ -123,13 +121,6 @@ dependencies { + compile 'org.xmlunit:xmlunit-core:2.3.0' + compile 'org.xmlunit:xmlunit-matchers:2.3.0' + +- // need to use snapshots as the stable version is from 2013 and doesn't support v1.0.1 CitationStyles +- compile 'org.citationstyles:styles:1.0.1-SNAPSHOT' +- compile 'org.citationstyles:locales:1.0.1-SNAPSHOT' +- compile 'de.undercouch:citeproc-java:1.0.1' +- +- compile 'com.github.lgooddatepicker:LGoodDatePicker:8.3.0' +- + testCompile 'junit:junit:4.12' + testCompile 'org.mockito:mockito-core:2.3.0' + testCompile 'com.github.tomakehurst:wiremock:2.4.1' +diff --git a/external-libraries.txt b/external-libraries.txt +index 4d969fa02..52518a719 100644 +--- a/external-libraries.txt ++++ b/external-libraries.txt +@@ -45,16 +45,6 @@ Project: Apache Commons Logging + URL: http://commons.apache.org/logging/ + License: Apache-2.0 + +-Id: com.github.bkromhout:java-diff-utils +-Project: java-diff-utils +-URL: https://github.com/bkromhout/java-diff-utils +-License: Apache-2.0 +- +-Id: com.impossibl.pgjdbc-ng:pgjdbc-ng +-Project: pgjdbc-ng +-URL: http://impossibl.github.io/pgjdbc-ng +-License: BSD +- + Id: com.jgoodies:jgoodies-common + Project: JGoodies Common + URL: http://www.jgoodies.com/downloads/libraries/ +@@ -145,10 +135,11 @@ Project: SwingX + URL: https://swingx.java.net/ + License: LGPL-3.0 + +-Id: com.github.lgooddatepicker:LGoodDatePicker +-Project: LGoodDatePicker +-URL: https://github.com/LGoodDatePicker/LGoodDatePicker +-License: MIT ++Id: microba ++Path: lib/microba.jar ++Project: Microba ++URL: https://github.com/tdbear/microba ++License: BSD + + Id: spin + Path: lib/spin.jar +@@ -156,19 +147,4 @@ Project: Spin + URL: http://spin.sourceforge.net/ + License: LGPL-2.1+ + +-Id: org.citationstyles.styles +-Project: CSL Styles +-URL: https://github.com/citation-style-language/styles +-Licence: Creative Commons Attribution-ShareAlike 3.0 Unported license +- +-Id: org.citationstyles.locales +-Project: CSL Locales +-URL: https://github.com/citation-style-language/locales +-Licence: CC-BY-SA-3.0 +- +-Id: de.undercouch.citeproc-java +-Project: Citeproc-Java +-URL: http://michel-kraemer.github.io/citeproc-java/ +-Licence: Apache-2.0 +- + The last entry has to end with an empty line. Otherwise the entry is not present in About.html. +diff --git a/src/main/java/net/sf/jabref/gui/BasePanel.java b/src/main/java/net/sf/jabref/gui/BasePanel.java +index f89a0a9bc..25a6d1437 100644 +--- a/src/main/java/net/sf/jabref/gui/BasePanel.java ++++ b/src/main/java/net/sf/jabref/gui/BasePanel.java +@@ -98,7 +98,6 @@ import net.sf.jabref.logic.autocompleter.AutoCompleter; + import net.sf.jabref.logic.autocompleter.AutoCompleterFactory; + import net.sf.jabref.logic.autocompleter.ContentAutoCompleters; + import net.sf.jabref.logic.bibtexkeypattern.BibtexKeyPatternUtil; +-import net.sf.jabref.logic.citationstyle.CitationStyleCache; + import net.sf.jabref.logic.exporter.BibtexDatabaseWriter; + import net.sf.jabref.logic.exporter.FileSaveSession; + import net.sf.jabref.logic.exporter.SaveException; +@@ -151,8 +150,6 @@ public class BasePanel extends JPanel implements ClipboardOwner, FileUpdateListe + private final BibDatabaseContext bibDatabaseContext; + private final MainTableDataModel tableModel; + +- private final CitationStyleCache citationStyleCache; +- + // To contain instantiated entry editors. This is to save time + // As most enums, this must not be null + private BasePanelMode mode = BasePanelMode.SHOWING_NOTHING; +@@ -219,8 +216,6 @@ public class BasePanel extends JPanel implements ClipboardOwner, FileUpdateListe + this.frame = frame; + this.tableModel = new MainTableDataModel(getBibDatabaseContext()); + +- citationStyleCache = new CitationStyleCache(bibDatabaseContext); +- + setupMainPanel(); + + setupActions(); +@@ -2382,10 +2377,6 @@ public class BasePanel extends JPanel implements ClipboardOwner, FileUpdateListe + this.currentSearchQuery = currentSearchQuery; + } + +- public CitationStyleCache getCitationStyleCache() { +- return citationStyleCache; +- } +- + public PreviewPanel getPreviewPanel() { + if (selectionListener == null) { + // only occurs if this is called while instantiating this BasePanel +diff --git a/src/main/java/net/sf/jabref/gui/IconTheme.java b/src/main/java/net/sf/jabref/gui/IconTheme.java +index f43f8f9bd..2177138bc 100644 +--- a/src/main/java/net/sf/jabref/gui/IconTheme.java ++++ b/src/main/java/net/sf/jabref/gui/IconTheme.java +@@ -158,7 +158,6 @@ public class IconTheme { + FACEBOOK("\uf20c"), /* css: facebook */ + BLOG("\uf46b"), /* css: rss */ + GLOBAL_SEARCH("\uF1E7"), /* css: earth */ +- DATE_PICKER("\uF0ED;"), /* css: calendar */ + // STILL MISSING: + GROUP_REGULAR("\uF4E6", Color.RED); + +diff --git a/src/main/java/net/sf/jabref/gui/PreviewPanel.java b/src/main/java/net/sf/jabref/gui/PreviewPanel.java +index 0238f1861..97501e09b 100644 +--- a/src/main/java/net/sf/jabref/gui/PreviewPanel.java ++++ b/src/main/java/net/sf/jabref/gui/PreviewPanel.java +@@ -31,8 +31,6 @@ import net.sf.jabref.JabRefExecutorService; + import net.sf.jabref.gui.desktop.JabRefDesktop; + import net.sf.jabref.gui.fieldeditors.PreviewPanelTransferHandler; + import net.sf.jabref.gui.keyboard.KeyBinding; +-import net.sf.jabref.gui.worker.CitationStyleWorker; +-import net.sf.jabref.logic.citationstyle.CitationStyle; + import net.sf.jabref.logic.exporter.ExportFormats; + import net.sf.jabref.logic.l10n.Localization; + import net.sf.jabref.logic.layout.Layout; +@@ -79,7 +77,6 @@ public class PreviewPanel extends JPanel implements SearchQueryHighlightListener + private final CopyPreviewAction copyPreviewAction = new CopyPreviewAction(); + + private Optional<Pattern> highlightPattern = Optional.empty(); +- private Optional<CitationStyleWorker> citationStyleWorker = Optional.empty(); + + /** + * @param databaseContext +@@ -202,21 +199,10 @@ public class PreviewPanel extends JPanel implements SearchQueryHighlightListener + PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences(); + String style = previewPreferences.getPreviewCycle().get(previewPreferences.getPreviewCyclePosition()); + +- if (CitationStyle.isCitationStyleFile(style)) { +- if (basePanel.isPresent()) { +- layout = Optional.empty(); +- CitationStyle citationStyle = CitationStyle.createCitationStyleFromFile(style); +- if (citationStyle != null) { +- basePanel.get().getCitationStyleCache().setCitationStyle(citationStyle); +- basePanel.get().output(Localization.lang("Preview style changed to: %0", citationStyle.getTitle())); +- } +- } +- } else { + updatePreviewLayout(previewPreferences.getPreviewStyle()); + if (basePanel.isPresent()) { + basePanel.get().output(Localization.lang("Preview style changed to: %0", Localization.lang("Preview"))); + } +- } + + update(); + } +@@ -264,11 +250,6 @@ public class PreviewPanel extends JPanel implements SearchQueryHighlightListener + public void update() { + ExportFormats.entryNumber = 1; // Set entry number in case that is included in the preview layout. + +- if (citationStyleWorker.isPresent()){ +- citationStyleWorker.get().cancel(true); +- citationStyleWorker = Optional.empty(); +- } +- + if (layout.isPresent()){ + StringBuilder sb = new StringBuilder(); + bibEntry.ifPresent(entry -> sb.append(layout.get() +@@ -276,10 +257,6 @@ public class PreviewPanel extends JPanel implements SearchQueryHighlightListener + setPreviewLabel(sb.toString()); + markHighlights(); + } +- else if (basePanel.isPresent()){ +- citationStyleWorker = Optional.of(new CitationStyleWorker(this, previewPane)); +- citationStyleWorker.get().execute(); +- } + + } + +@@ -316,18 +293,12 @@ public class PreviewPanel extends JPanel implements SearchQueryHighlightListener + + /** + * this fixes the Layout, the user cannot change it anymore. Useful for testing the styles in the settings +- * @param parameter should be either a {@link String} (for the old PreviewStyle) or a {@link CitationStyle}. + */ +- public PreviewPanel setFixedLayout(Object parameter) { ++ public PreviewPanel setFixedLayout(String parameter) { + this.fixedLayout = true; + + if (parameter instanceof String) { + updatePreviewLayout((String) parameter); +- } else if (parameter instanceof CitationStyle) { +- layout = Optional.empty(); +- if (basePanel.isPresent()){ +- basePanel.get().getCitationStyleCache().setCitationStyle((CitationStyle) parameter); +- } + } else { + LOGGER.error("unknown style type"); + } +diff --git a/src/main/java/net/sf/jabref/gui/date/DatePickerButton.java b/src/main/java/net/sf/jabref/gui/date/DatePickerButton.java +index 6b4a3b997..a11d7710d 100644 +--- a/src/main/java/net/sf/jabref/gui/date/DatePickerButton.java ++++ b/src/main/java/net/sf/jabref/gui/date/DatePickerButton.java +@@ -1,30 +1,26 @@ + package net.sf.jabref.gui.date; + + import java.awt.BorderLayout; +-import java.time.LocalDate; +-import java.time.ZonedDateTime; +-import java.time.format.DateTimeFormatter; ++import java.awt.event.ActionEvent; ++import java.awt.event.ActionListener; ++import java.util.Date; + + import javax.swing.JComponent; + import javax.swing.JPanel; + + import net.sf.jabref.Globals; +-import net.sf.jabref.gui.IconTheme; + import net.sf.jabref.gui.fieldeditors.FieldEditor; + import net.sf.jabref.logic.util.date.EasyDateFormat; + import net.sf.jabref.preferences.JabRefPreferences; + +-import com.github.lgooddatepicker.components.DatePicker; +-import com.github.lgooddatepicker.components.DatePickerSettings; +-import com.github.lgooddatepicker.optionalusertools.DateChangeListener; +-import com.github.lgooddatepicker.zinternaltools.DateChangeEvent; ++import com.michaelbaranov.microba.calendar.DatePicker; + + /** + * wrapper and service class for the DatePicker handling at the EntryEditor + */ +-public class DatePickerButton implements DateChangeListener { ++public class DatePickerButton implements ActionListener { + +- private final DatePicker datePicker; ++ private final DatePicker datePicker = new DatePicker(); + private final JPanel panel = new JPanel(); + private final FieldEditor editor; + private final boolean isoFormat; +@@ -32,29 +28,24 @@ public class DatePickerButton implements DateChangeListener { + + public DatePickerButton(FieldEditor pEditor, Boolean isoFormat) { + this.isoFormat = isoFormat; +- // Create a date picker with hidden text field (showing button only). +- DatePickerSettings dateSettings = new DatePickerSettings(); +- dateSettings.setVisibleDateTextField(false); +- dateSettings.setGapBeforeButtonPixels(0); +- +- datePicker = new DatePicker(dateSettings); +- datePicker.addDateChangeListener(this); +- datePicker.getComponentToggleCalendarButton().setIcon(IconTheme.JabRefIcon.DATE_PICKER.getIcon()); +- datePicker.getComponentToggleCalendarButton().setText(""); +- ++ datePicker.showButtonOnly(true); ++ datePicker.addActionListener(this); ++ datePicker.setShowTodayButton(true); + panel.setLayout(new BorderLayout()); + panel.add(datePicker, BorderLayout.WEST); + editor = pEditor; + } + + @Override +- public void dateChanged(DateChangeEvent dateChangeEvent) { +- LocalDate date = datePicker.getDate(); ++ public void actionPerformed(ActionEvent e) { ++ Date date = datePicker.getDate(); + if (date != null) { + if (isoFormat) { +- editor.setText(date.format(DateTimeFormatter.ISO_DATE)); ++ editor.setText(EasyDateFormat.isoDateFormat().getDateAt(date)); + } else { +- EasyDateFormat.fromTimeStampFormat(Globals.prefs.get(JabRefPreferences.TIME_STAMP_FORMAT)).getDateAt(ZonedDateTime.from(date)); ++ editor.setText(EasyDateFormat ++ .fromTimeStampFormat(Globals.prefs.get(JabRefPreferences.TIME_STAMP_FORMAT)) ++ .getDateAt(date)); + } + } else { + // in this case the user selected "none" in the date picker, so we just clear the field +diff --git a/src/main/java/net/sf/jabref/gui/mergeentries/MergeEntries.java b/src/main/java/net/sf/jabref/gui/mergeentries/MergeEntries.java +index e5b65c483..1b19f585e 100644 +--- a/src/main/java/net/sf/jabref/gui/mergeentries/MergeEntries.java ++++ b/src/main/java/net/sf/jabref/gui/mergeentries/MergeEntries.java +@@ -34,7 +34,6 @@ import net.sf.jabref.logic.bibtex.BibEntryWriter; + import net.sf.jabref.logic.bibtex.LatexFieldFormatter; + import net.sf.jabref.logic.formatter.casechanger.SentenceCaseFormatter; + import net.sf.jabref.logic.l10n.Localization; +-import net.sf.jabref.logic.util.strings.DiffHighlighting; + import net.sf.jabref.model.database.BibDatabaseMode; + import net.sf.jabref.model.entry.BibEntry; + import net.sf.jabref.model.entry.InternalBibtexFields; +@@ -272,7 +271,7 @@ public class MergeEntries { + mergePanel.add(boldFontLabel(Localization.lang("Entry type")), CELL_CONSTRAINTS.xy(1, 1)); + + JTextPane leftTypeDisplay = new DiffHighlightingTextPane(); +- leftTypeDisplay.setText(DiffHighlighting.HTML_START + leftEntry.getType() + DiffHighlighting.HTML_END); ++ leftTypeDisplay.setText(leftEntry.getType()); + mergePanel.add(leftTypeDisplay, CELL_CONSTRAINTS.xy(3, 1)); + if (leftEntry.getType().equals(rightEntry.getType())) { + identicalTypes = true; +@@ -290,13 +289,14 @@ public class MergeEntries { + typeRadioButtons.get(0).setSelected(true); + } + JTextPane rightTypeDisplay = new DiffHighlightingTextPane(); +- rightTypeDisplay.setText(DiffHighlighting.HTML_START + rightEntry.getType() + DiffHighlighting.HTML_END); ++ rightTypeDisplay.setText(rightEntry.getType()); + mergePanel.add(rightTypeDisplay, CELL_CONSTRAINTS.xy(11, 1)); + } + + private void setupHeadingRows() { + mainPanel.add(boldFontLabel(Localization.lang("Use")), CELL_CONSTRAINTS.xyw(4, 1, 7, "center, bottom")); + mainPanel.add(diffMode, CELL_CONSTRAINTS.xy(11, 1, "right, bottom")); ++ diffMode.setVisible(false); + + // Set headings + for (int i = 0; i < 6; i++) { +@@ -362,33 +362,11 @@ public class MergeEntries { + for (String field : fields) { + String leftString = leftEntry.getField(field).orElse(""); + String rightString = rightEntry.getField(field).orElse(""); +- switch (diffMode.getSelectedIndex()) { +- case 0: // Plain text +- break; +- case 1: // Latexdiff style - word +- rightString = DiffHighlighting.generateDiffHighlighting(leftString, rightString, " "); +- break; +- case 2: // Latexdiff style - character +- rightString = DiffHighlighting.generateDiffHighlighting(leftString, rightString, ""); +- break; +- case 3: // Symmetric style - word +- String tmpLeftString = DiffHighlighting.generateSymmetricHighlighting(leftString, rightString, " "); +- rightString = DiffHighlighting.generateSymmetricHighlighting(rightString, leftString, " "); +- leftString = tmpLeftString; +- break; +- case 4: // Symmetric style - character +- tmpLeftString = DiffHighlighting.generateSymmetricHighlighting(leftString, rightString, ""); +- rightString = DiffHighlighting.generateSymmetricHighlighting(rightString, leftString, ""); +- leftString = tmpLeftString; +- break; +- default: // Shouldn't happen +- break; +- } + if ((leftString != null) && leftTextPanes.containsKey(field)) { +- leftTextPanes.get(field).setText(DiffHighlighting.HTML_START + leftString + DiffHighlighting.HTML_END); ++ leftTextPanes.get(field).setText(leftString); + } + if ((rightString != null) && rightTextPanes.containsKey(field)) { +- rightTextPanes.get(field).setText(DiffHighlighting.HTML_START + rightString + DiffHighlighting.HTML_END); ++ rightTextPanes.get(field).setText(rightString); + } + } + SwingUtilities.invokeLater(() -> scrollPane.getVerticalScrollBar() +diff --git a/src/main/java/net/sf/jabref/gui/preftabs/PreviewPrefsTab.java b/src/main/java/net/sf/jabref/gui/preftabs/PreviewPrefsTab.java +index 38bdaf180..3cbfc9978 100644 +--- a/src/main/java/net/sf/jabref/gui/preftabs/PreviewPrefsTab.java ++++ b/src/main/java/net/sf/jabref/gui/preftabs/PreviewPrefsTab.java +@@ -22,7 +22,6 @@ import net.sf.jabref.Globals; + import net.sf.jabref.JabRefGUI; + import net.sf.jabref.gui.BasePanel; + import net.sf.jabref.gui.PreviewPanel; +-import net.sf.jabref.logic.citationstyle.CitationStyle; + import net.sf.jabref.logic.l10n.Localization; + import net.sf.jabref.logic.util.TestEntry; + import net.sf.jabref.preferences.PreviewPreferences; +@@ -38,8 +37,6 @@ public class PreviewPrefsTab extends JPanel implements PrefsTab { + + private static final Log LOGGER = LogFactory.getLog(PreviewPrefsTab.class); + +- private SwingWorker<List<CitationStyle>, Void> discoverCitationStyleWorker; +- + private final DefaultListModel<Object> availableModel = new DefaultListModel<>(); + private final DefaultListModel<Object> chosenModel = new DefaultListModel<>(); + +@@ -171,16 +168,12 @@ public class PreviewPrefsTab extends JPanel implements PrefsTab { + chosenModel.clear(); + boolean isPreviewChosen = false; + for (String style : previewPreferences.getPreviewCycle()) { +- if (CitationStyle.isCitationStyleFile(style)) { +- chosenModel.addElement(CitationStyle.createCitationStyleFromFile(style)); +- } else { + if (isPreviewChosen) { + LOGGER.error("Preview is already in the list, something went wrong"); + continue; + } + isPreviewChosen = true; + chosenModel.addElement(Localization.lang("Preview")); +- } + } + + availableModel.clear(); +@@ -193,35 +186,6 @@ public class PreviewPrefsTab extends JPanel implements PrefsTab { + btnUp.setEnabled(!chosen.isSelectionEmpty()); + btnDown.setEnabled(!chosen.isSelectionEmpty()); + +- if (discoverCitationStyleWorker != null){ +- discoverCitationStyleWorker.cancel(true); +- } +- +- discoverCitationStyleWorker = new SwingWorker<List<CitationStyle>, Void>() { +- @Override +- protected List<CitationStyle> doInBackground() throws Exception { +- return CitationStyle.discoverCitationStyles(); +- } +- +- @Override +- public void done(){ +- if (this.isCancelled()) { +- return; +- } +- try { +- get().stream() +- .filter(style -> !previewPreferences.getPreviewCycle().contains(style.getFilepath())) +- .sorted((style0, style1) -> style0.getTitle().compareTo(style1.getTitle())) +- .forEach(availableModel::addElement); +- +- btnRight.setEnabled(!availableModel.isEmpty()); +- } catch (InterruptedException | ExecutionException e) { +- LOGGER.error("something went wrong while adding the discovered CitationStyles to the list "); +- } +- } +- }; +- discoverCitationStyleWorker.execute(); +- + layout.setText(Globals.prefs.getPreviewPreferences().getPreviewStyle().replace("__NEWLINE__", "\n")); + } + +@@ -231,11 +195,7 @@ public class PreviewPrefsTab extends JPanel implements PrefsTab { + Enumeration<Object> elements = chosenModel.elements(); + while (elements.hasMoreElements()) { + Object obj = elements.nextElement(); +- if (obj instanceof CitationStyle) { +- styles.add(((CitationStyle) obj).getFilepath()); +- } else if (obj instanceof String) { +- styles.add("Preview"); +- } ++ styles.add("Preview"); + } + PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences() + .getBuilder() +diff --git a/src/main/java/net/sf/jabref/gui/worker/CitationStyleWorker.java b/src/main/java/net/sf/jabref/gui/worker/CitationStyleWorker.java +deleted file mode 100644 +index 1cd1489d7..000000000 +--- a/src/main/java/net/sf/jabref/gui/worker/CitationStyleWorker.java ++++ /dev/null +@@ -1,77 +0,0 @@ +-package net.sf.jabref.gui.worker; +- +-import java.util.Objects; +-import java.util.Optional; +-import java.util.concurrent.ExecutionException; +- +-import javax.swing.JEditorPane; +-import javax.swing.SwingWorker; +- +-import net.sf.jabref.gui.BasePanel; +-import net.sf.jabref.gui.PreviewPanel; +-import net.sf.jabref.logic.citationstyle.CitationStyle; +-import net.sf.jabref.logic.l10n.Localization; +-import net.sf.jabref.model.entry.BibEntry; +- +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +- +- +-/** +- * Generates a citation and updates the linked preview panel +- */ +-public class CitationStyleWorker extends SwingWorker<String, Void> { +- +- private static final Log LOGGER = LogFactory.getLog(CitationStyleWorker.class); +- +- private final PreviewPanel previewPanel; +- +- +- public CitationStyleWorker(PreviewPanel previewPanel, JEditorPane previewPane) { +- this.previewPanel = Objects.requireNonNull(previewPanel); +- Objects.requireNonNull(previewPane); +- +- Optional<BasePanel> basePanel = previewPanel.getBasePanel(); +- if (basePanel.isPresent()){ +- CitationStyle citationStyle = basePanel.get().getCitationStyleCache().getCitationStyle(); +- previewPane.setText("<i>" + Localization.lang("Processing %0", Localization.lang("Citation Style")) + +- ": " + citationStyle.getTitle() + " ..." + "</i>"); +- } +- previewPane.revalidate(); +- } +- +- @Override +- protected String doInBackground() throws Exception { +- Optional<BasePanel> basePanel = previewPanel.getBasePanel(); +- BibEntry entry = previewPanel.getEntry(); +- +- String fieldText = ""; +- if ((entry != null) && basePanel.isPresent()) { +- fieldText = basePanel.get().getCitationStyleCache().getCitationFor(entry); +- } +- return fieldText; +- } +- +- @Override +- public void done() { +- if (this.isCancelled()) { +- return; +- } +- String text; +- Boolean success = true; +- try { +- text = this.get(); +- } catch (InterruptedException | ExecutionException e) { +- LOGGER.error("Error while generating citation style", e); +- text = Localization.lang("Error while generating citation style"); +- success = false; +- } +- +- previewPanel.setPreviewLabel(text); +- +- if (success) { +- previewPanel.markHighlights(); +- } +- } +- +-} +diff --git a/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyle.java b/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyle.java +deleted file mode 100644 +index f4988b46d..000000000 +--- a/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyle.java ++++ /dev/null +@@ -1,178 +0,0 @@ +-package net.sf.jabref.logic.citationstyle; +- +-import java.io.IOException; +-import java.io.StringReader; +-import java.net.URISyntaxException; +-import java.net.URL; +-import java.nio.charset.StandardCharsets; +-import java.nio.file.Files; +-import java.nio.file.NoSuchFileException; +-import java.nio.file.Paths; +-import java.util.ArrayList; +-import java.util.Arrays; +-import java.util.Collections; +-import java.util.Enumeration; +-import java.util.List; +-import java.util.Objects; +-import java.util.jar.JarEntry; +-import java.util.jar.JarFile; +- +-import javax.xml.parsers.DocumentBuilder; +-import javax.xml.parsers.DocumentBuilderFactory; +-import javax.xml.parsers.ParserConfigurationException; +- +-import net.sf.jabref.logic.util.FileExtensions; +- +-import de.undercouch.citeproc.helper.CSLUtils; +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.w3c.dom.CharacterData; +-import org.w3c.dom.Document; +-import org.w3c.dom.Element; +-import org.w3c.dom.NodeList; +-import org.xml.sax.InputSource; +-import org.xml.sax.SAXException; +- +- +-/** +- * Representation of a CitationStyle +- * Stores its name, the filepath and the style itself +- */ +-public class CitationStyle { +- +- public static final String DEFAULT = "/ieee.csl"; +- private static final Log LOGGER = LogFactory.getLog(CitationStyle.class); +- +- private final String filepath; +- private final String title; +- private final String source; +- +- +- private CitationStyle(final String filename, final String title, final String source) { +- this.filepath = Objects.requireNonNull(filename); +- this.title = Objects.requireNonNull(title); +- this.source = Objects.requireNonNull(source); +- } +- +- /** +- * Creates an CitationStyle instance out of the style string +- */ +- private static CitationStyle createCitationStyleFromSource(final String source, final String filename) { +- try { +- DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); +- InputSource is = new InputSource(); +- is.setCharacterStream(new StringReader(source)); +- +- Document doc = db.parse(is); +- NodeList nodes = doc.getElementsByTagName("info"); +- +- NodeList titleNode = ((Element) nodes.item(0)).getElementsByTagName("title"); +- String title = ((CharacterData) titleNode.item(0).getFirstChild()).getData(); +- +- return new CitationStyle(filename, title, source); +- } catch (ParserConfigurationException | SAXException | IOException e) { +- LOGGER.error("Error while parsing source", e); +- } +- return null; +- } +- +- /** +- * Loads the CitationStyle from the given file +- */ +- public static CitationStyle createCitationStyleFromFile(final String styleFile) { +- if (!isCitationStyleFile(styleFile)) { +- LOGGER.error("Can only load style files: "+ styleFile); +- return null; +- } +- +- try { +- String text; +- String internalFile = (styleFile.startsWith("/") ? "" : "/") + styleFile; +- URL url = CitationStyle.class.getResource(internalFile); +- if (url != null) { +- text = CSLUtils.readURLToString(url, StandardCharsets.UTF_8.toString()); +- } else { +- // if the url is null then the style is located outside the classpath +- text = new String(Files.readAllBytes(Paths.get(styleFile)), StandardCharsets.UTF_8); +- } +- return createCitationStyleFromSource(text, styleFile); +- } catch (NoSuchFileException e){ +- LOGGER.error("Could not find file: "+ styleFile, e); +- } catch (IOException e) { +- LOGGER.error("Error reading source file", e); +- } +- return null; +- } +- +- public static CitationStyle getDefault(){ +- return createCitationStyleFromFile(DEFAULT); +- } +- +- /** +- * THIS ONLY WORKS WHEN JabRef IS STARTED AS AN APPLICATION (JAR) +- * +- * Reads all available CitationStyle in the Jar +- */ +- public static List<CitationStyle> discoverCitationStyles() { +- try { +- final List<CitationStyle> citationStyles = new ArrayList<>(); +- String path = CitationStyle.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath(); +- +- try (JarFile file = new JarFile(path)) { +- Enumeration<JarEntry> entries = file.entries(); +- while (entries.hasMoreElements()) { +- String filename = entries.nextElement().getName(); +- if (!filename.startsWith("dependent") && filename.endsWith("csl")) { +- CitationStyle citationStyle = CitationStyle.createCitationStyleFromFile(filename); +- if (citationStyle != null) { +- citationStyles.add(citationStyle); +- } +- } +- } +- } +- return citationStyles; +- } catch (IOException | URISyntaxException ex) { +- LOGGER.error("something went wrong while searching available CitationStyles. " + +- "Are you running directly from source code?", ex); +- } +- return Collections.emptyList(); +- } +- +- /** +- * Checks if the given style file is a CitationStyle +- */ +- public static boolean isCitationStyleFile(String styleFile){ +- return Arrays.stream(FileExtensions.CITATION_STYLE.getExtensions()).anyMatch(styleFile::endsWith); +- } +- +- public String getTitle() { +- return title; +- } +- +- public String getSource() { +- return source; +- } +- +- public String getFilepath() { +- return filepath; +- } +- +- @Override +- public String toString() { +- return title; +- } +- +- @Override +- public boolean equals(Object other) { +- if (this == other) { +- return true; +- } +- if (other == null || getClass() != other.getClass()) { +- return false; +- } +- +- CitationStyle that = (CitationStyle) other; +- return source != null ? source.equals(that.source) : that.source == null; +- } +- +-} +diff --git a/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleCache.java b/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleCache.java +deleted file mode 100644 +index aef0b05e9..000000000 +--- a/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleCache.java ++++ /dev/null +@@ -1,77 +0,0 @@ +-package net.sf.jabref.logic.citationstyle; +- +-import java.util.HashMap; +-import java.util.Map; +-import java.util.Objects; +- +-import net.sf.jabref.model.database.BibDatabaseContext; +-import net.sf.jabref.model.database.event.EntryRemovedEvent; +-import net.sf.jabref.model.entry.BibEntry; +-import net.sf.jabref.model.entry.event.EntryChangedEvent; +- +-import com.google.common.eventbus.Subscribe; +- +- +-/** +- * Caches the generated Citations for quicker access +- * {@link CitationStyleGenerator} generates the citaiton with JavaScript which may take some time +- */ +-public class CitationStyleCache { +- +- private CitationStyle citationStyle = CitationStyle.getDefault(); +- private Map<BibEntry, String> citationStylesCache = new HashMap<>(); +- +- +- public CitationStyleCache(BibDatabaseContext bibDatabaseContext) { +- this(bibDatabaseContext, CitationStyle.getDefault()); +- } +- +- public CitationStyleCache(BibDatabaseContext bibDatabaseContext, CitationStyle citationStyle) { +- this.setCitationStyle(citationStyle); +- bibDatabaseContext.getDatabase().registerListener(new BibDatabaseEntryListener()); +- } +- +- /** +- * returns the citation for the given BibEntry and the set CitationStyle +- */ +- public String getCitationFor(BibEntry entry) { +- String citation = citationStylesCache.get(entry); +- if (citation == null) { +- citation = CitationStyleGenerator.generateCitation(entry, this.citationStyle); +- citationStylesCache.put(entry, citation); +- } +- return citation; +- } +- +- public void setCitationStyle(CitationStyle citationStyle) { +- Objects.requireNonNull(citationStyle); +- if (!this.citationStyle.equals(citationStyle)){ +- this.citationStyle = citationStyle; +- this.citationStylesCache.clear(); +- } +- } +- +- public CitationStyle getCitationStyle() { +- return citationStyle; +- } +- +- +- private class BibDatabaseEntryListener { +- /** +- * removes the outdated citation of the changed entry +- */ +- @Subscribe +- public void listen(EntryChangedEvent entryChangedEvent) { +- citationStylesCache.remove(entryChangedEvent.getBibEntry()); +- } +- +- /** +- * removes the citation of the removed entry as it's not needed anymore +- */ +- @Subscribe +- public void listen(EntryRemovedEvent entryRemovedEvent) { +- citationStylesCache.remove(entryRemovedEvent.getBibEntry()); +- } +- } +- +-} +diff --git a/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleGenerator.java b/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleGenerator.java +deleted file mode 100644 +index fed37f29c..000000000 +--- a/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleGenerator.java ++++ /dev/null +@@ -1,80 +0,0 @@ +-package net.sf.jabref.logic.citationstyle; +- +-import java.io.IOException; +-import java.util.Map; +- +-import net.sf.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter; +-import net.sf.jabref.logic.l10n.Localization; +-import net.sf.jabref.model.entry.BibEntry; +- +-import de.undercouch.citeproc.CSL; +-import de.undercouch.citeproc.bibtex.BibTeXConverter; +-import de.undercouch.citeproc.csl.CSLItemData; +-import de.undercouch.citeproc.output.Bibliography; +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.jbibtex.BibTeXEntry; +-import org.jbibtex.DigitStringValue; +-import org.jbibtex.Key; +-import org.jbibtex.TokenMgrException; +- +- +-/** +- * WARNING: the citation is generated with JavaScript which may take some time, better call it in outside the main Thread +- */ +-public class CitationStyleGenerator { +- +- private static final Log LOGGER = LogFactory.getLog(CitationStyleGenerator.class); +- private static final UnicodeToLatexFormatter UNICODE_TO_LATEX_FORMATTER = new UnicodeToLatexFormatter(); +- private static final BibTeXConverter BIBTEX_CONVERTER = new BibTeXConverter(); +- +- /** +- * Generates a Citation based on the given entry and style +- * WARNING: the citation is generated with JavaScript which may take some time, better call it in outside the main Thread +- */ +- protected static String generateCitation(BibEntry entry, CitationStyle style) { +- return generateCitation(entry, style.getSource(), CitationStyleOutputFormat.HTML); +- } +- +- /** +- * Generates a Citation based on the given entry and style +- * WARNING: the citation is generated with JavaScript which may take some time, better call it in outside the main Thread +- */ +- protected static String generateCitation(BibEntry entry, String style) { +- return generateCitation(entry, style, CitationStyleOutputFormat.HTML); +- } +- +- /** +- * Generates a Citation based on the given entry, style, and output format +- * WARNING: the citation is generated with JavaScript which may take some time, better call it in outside the main Thread +- */ +- protected static String generateCitation(BibEntry entry, String style, CitationStyleOutputFormat outputFormat) { +- try { +- String citeKey = entry.getCiteKeyOptional().orElse(""); +- BibTeXEntry bibTeXEntry = new BibTeXEntry(new Key(entry.getType()), new Key(citeKey)); +- for (Map.Entry<String, String> field : entry.getFieldMap().entrySet()) { +- String value = UNICODE_TO_LATEX_FORMATTER.format(field.getValue()); +- bibTeXEntry.addField(new Key(field.getKey()), new DigitStringValue(value)); +- } +- +- CSLItemData cslItemData = BIBTEX_CONVERTER.toItemData(bibTeXEntry); +- Bibliography bibliography = CSL.makeAdhocBibliography(style, outputFormat.getFormat(), cslItemData); +- return bibliography.getEntries()[0]; +- +- } catch (IOException | ArrayIndexOutOfBoundsException e) { +- LOGGER.error("Could not generate BibEntry citation", e); +- return Localization.lang("Cannot generate preview based on selected citation style."); +- } catch (TokenMgrException e) { +- LOGGER.error("Bad character inside BibEntry", e); +- // sadly one cannot easily retrieve the bad char from the TokenMgrError +- return new StringBuilder() +- .append(Localization.lang("Cannot generate preview based on selected citation style.")) +- .append(outputFormat == CitationStyleOutputFormat.HTML ? "<br>" : "\n") +- .append(Localization.lang("Bad character inside entry")) +- .append(outputFormat == CitationStyleOutputFormat.HTML ? "<br>" : "\n") +- .append(e.getLocalizedMessage()) +- .toString(); +- } +- } +- +-} +diff --git a/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleOutputFormat.java b/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleOutputFormat.java +deleted file mode 100644 +index dc6bf3119..000000000 +--- a/src/main/java/net/sf/jabref/logic/citationstyle/CitationStyleOutputFormat.java ++++ /dev/null +@@ -1,27 +0,0 @@ +-package net.sf.jabref.logic.citationstyle; +- +- +-public enum CitationStyleOutputFormat { +- +- HTML("html"), +- TEXT("text"), +- ASCII_DOC("asciidoc"), +- FO("fo"), +- RTF("rtf"); +- +- private final String format; +- +- CitationStyleOutputFormat(String format) { +- this.format = format; +- } +- +- public String getFormat() { +- return format; +- } +- +- @Override +- public String toString() { +- return format; +- } +- +-} +diff --git a/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java b/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java +index 25885be93..3eb5a03dd 100644 +--- a/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java ++++ b/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java +@@ -1,7 +1,9 @@ + package net.sf.jabref.logic.util.date; + ++import java.time.ZoneId; + import java.time.ZonedDateTime; + import java.time.format.DateTimeFormatter; ++import java.util.Date; + + public class EasyDateFormat { + +@@ -36,6 +38,16 @@ public class EasyDateFormat { + * + * @return The formatted date string. + */ ++ public String getDateAt(Date date) { ++ return getDateAt(date.toInstant().atZone(ZoneId.systemDefault())); ++ } ++ ++ /** ++ * Creates a readable Date string from the parameter date. The format is set ++ * in preferences under the key "timeStampFormat". ++ * ++ * @return The formatted date string. ++ */ + public String getDateAt(ZonedDateTime dateTime) { + // first use, create an instance + return dateTime.format(dateFormatter); +diff --git a/src/main/java/net/sf/jabref/logic/util/strings/DiffHighlighting.java b/src/main/java/net/sf/jabref/logic/util/strings/DiffHighlighting.java +deleted file mode 100644 +index ba6463b1f..000000000 +--- a/src/main/java/net/sf/jabref/logic/util/strings/DiffHighlighting.java ++++ /dev/null +@@ -1,101 +0,0 @@ +-package net.sf.jabref.logic.util.strings; +- +-import java.util.ArrayList; +-import java.util.Arrays; +-import java.util.Collections; +-import java.util.List; +-import java.util.Objects; +- +-import difflib.Delta; +-import difflib.DiffUtils; +- +-public class DiffHighlighting { +- +- private static final String ADDITION_START = "<span class=add>"; +- private static final String REMOVAL_START = "<span class=del>"; +- private static final String CHANGE_START = "<span class=change>"; +- private static final String TAG_END = "</span>"; +- +- public static final String HTML_START = "<html><body>"; +- public static final String HTML_END = "</body></html>"; +- +- +- public static String generateDiffHighlighting(String baseString, String modifiedString, String separator) { +- Objects.requireNonNull(separator); +- if ((baseString != null) && (modifiedString != null)) { +- List<String> stringList = new ArrayList<>(Arrays.asList(baseString.split(separator))); +- List<Delta<String>> deltaList = new ArrayList<>( +- DiffUtils.diff(stringList, Arrays.asList(modifiedString.split(separator))).getDeltas()); +- Collections.reverse(deltaList); +- for (Delta<String> delta : deltaList) { +- int startPos = delta.getOriginal().getPosition(); +- List<String> lines = delta.getOriginal().getLines(); +- int offset = 0; +- switch (delta.getType()) { +- case CHANGE: +- for (String line : lines) { +- stringList.set(startPos + offset, (offset == 0 ? DiffHighlighting.REMOVAL_START : "") + line); +- offset++; +- } +- stringList.set((startPos + offset) - 1, +- stringList.get((startPos + offset) - 1) + DiffHighlighting.TAG_END + separator + DiffHighlighting.ADDITION_START +- + String.join(separator, delta.getRevised().getLines()) + DiffHighlighting.TAG_END); +- break; +- case DELETE: +- for (String line : lines) { +- stringList.set(startPos + offset, (offset == 0 ? DiffHighlighting.REMOVAL_START : "") + line); +- offset++; +- } +- stringList.set((startPos + offset) - 1, +- stringList.get((startPos + offset) - 1) + DiffHighlighting.TAG_END); +- break; +- case INSERT: +- stringList.add(delta.getOriginal().getPosition(), +- DiffHighlighting.ADDITION_START + String.join(separator, delta.getRevised().getLines()) + DiffHighlighting.TAG_END); +- break; +- default: +- break; +- } +- } +- return String.join(separator, stringList); +- } +- return modifiedString; +- } +- +- public static String generateSymmetricHighlighting(String baseString, String modifiedString, String separator) { +- if ((baseString != null) && (modifiedString != null)) { +- List<String> stringList = new ArrayList<>(Arrays.asList(baseString.split(separator))); +- List<Delta<String>> deltaList = new ArrayList<>(DiffUtils +- .diff(stringList, new ArrayList<>(Arrays.asList(modifiedString.split(separator)))).getDeltas()); +- Collections.reverse(deltaList); +- for (Delta<String> delta : deltaList) { +- int startPos = delta.getOriginal().getPosition(); +- List<String> lines = delta.getOriginal().getLines(); +- int offset = 0; +- switch (delta.getType()) { +- case CHANGE: +- for (String line : lines) { +- stringList.set(startPos + offset, (offset == 0 ? DiffHighlighting.CHANGE_START : "") + line); +- offset++; +- } +- stringList.set((startPos + offset) - 1, stringList.get((startPos + offset) - 1) + DiffHighlighting.TAG_END); +- break; +- case DELETE: +- for (String line : lines) { +- stringList.set(startPos + offset, (offset == 0 ? DiffHighlighting.ADDITION_START : "") + line); +- offset++; +- } +- stringList.set((startPos + offset) - 1, stringList.get((startPos + offset) - 1) + DiffHighlighting.TAG_END); +- break; +- case INSERT: +- break; +- default: +- break; +- } +- } +- return String.join(separator, stringList); +- } +- return modifiedString; +- } +- +-} +diff --git a/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java b/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java +index d98895592..c85dc1da5 100644 +--- a/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java ++++ b/src/main/java/net/sf/jabref/preferences/JabRefPreferences.java +@@ -42,7 +42,6 @@ import net.sf.jabref.logic.autocompleter.AutoCompletePreferences; + import net.sf.jabref.logic.bibtex.FieldContentParserPreferences; + import net.sf.jabref.logic.bibtex.LatexFieldFormatterPreferences; + import net.sf.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences; +-import net.sf.jabref.logic.citationstyle.CitationStyle; + import net.sf.jabref.logic.cleanup.CleanupPreferences; + import net.sf.jabref.logic.cleanup.CleanupPreset; + import net.sf.jabref.logic.cleanup.Cleanups; +@@ -799,7 +798,7 @@ public class JabRefPreferences { + defaults.put(VERSION_IGNORED_UPDATE, ""); + + // preview +- defaults.put(CYCLE_PREVIEW, "Preview;" + CitationStyle.DEFAULT); ++ defaults.put(CYCLE_PREVIEW, "Preview"); + defaults.put(CYCLE_PREVIEW_POS, 0); + defaults.put(PREVIEW_PANEL_HEIGHT, 200); + defaults.put(PREVIEW_ENABLED, Boolean.TRUE); +diff --git a/src/main/java/net/sf/jabref/shared/DBMSType.java b/src/main/java/net/sf/jabref/shared/DBMSType.java +index d27b0af63..e96f567e5 100644 +--- a/src/main/java/net/sf/jabref/shared/DBMSType.java ++++ b/src/main/java/net/sf/jabref/shared/DBMSType.java +@@ -18,8 +18,8 @@ public enum DBMSType { + "jdbc:oracle:thin:@%s:%d:%s", 1521), + POSTGRESQL( + "PostgreSQL", +- "com.impossibl.postgres.jdbc.PGDriver", +- "jdbc:pgsql://%s:%d/%s", 5432); ++ "org.postgresql.Driver", ++ "jdbc:postgresql://%s:%d/%s", 5432); + + private final String type; + private final String driverPath; +diff --git a/src/main/java/net/sf/jabref/shared/PostgreSQLProcessor.java b/src/main/java/net/sf/jabref/shared/PostgreSQLProcessor.java +index 6a302d1a0..1191eb26c 100644 +--- a/src/main/java/net/sf/jabref/shared/PostgreSQLProcessor.java ++++ b/src/main/java/net/sf/jabref/shared/PostgreSQLProcessor.java +@@ -1,5 +1,6 @@ + package net.sf.jabref.shared; + ++import java.sql.Connection; + import java.sql.PreparedStatement; + import java.sql.ResultSet; + import java.sql.SQLException; +@@ -8,22 +9,12 @@ import java.util.logging.Level; + import java.util.logging.Logger; + + import net.sf.jabref.model.entry.BibEntry; +-import net.sf.jabref.shared.listener.PostgresSQLNotificationListener; +- +-import com.impossibl.postgres.api.jdbc.PGConnection; +-import com.impossibl.postgres.jdbc.PGDataSource; +-import com.impossibl.postgres.jdbc.ThreadedHousekeeper; + + /** + * Processes all incoming or outgoing bib data to PostgreSQL database and manages its structure. + */ + public class PostgreSQLProcessor extends DBMSProcessor { + +- private PGConnection pgConnection; +- +- private PostgresSQLNotificationListener listener; +- +- + public PostgreSQLProcessor(DBMSConnection connection) { + super(connection); + } +@@ -85,47 +76,4 @@ public class PostgreSQLProcessor extends DBMSProcessor { + return "\"" + expression + "\""; + } + +- +- @Override +- public void startNotificationListener(DBMSSynchronizer dbmsSynchronizer) { +- // Disable cleanup output of ThreadedHousekeeper +- Logger.getLogger(ThreadedHousekeeper.class.getName()).setLevel(Level.SEVERE); +- +- this.listener = new PostgresSQLNotificationListener(dbmsSynchronizer); +- +- PGDataSource dataSource = new PGDataSource(); +- dataSource.setHost(connectionProperties.getHost()); +- dataSource.setPort(connectionProperties.getPort()); +- dataSource.setDatabase(connectionProperties.getDatabase()); +- dataSource.setUser(connectionProperties.getUser()); +- dataSource.setPassword(connectionProperties.getPassword()); +- +- try { +- pgConnection = (PGConnection) dataSource.getConnection(); +- pgConnection.createStatement().execute("LISTEN jabrefLiveUpdate"); +- // Do not use `new PostgresSQLNotificationListener(...)` as the object has to exist continuously! +- // Otherwise the listener is going to be deleted by GC. +- pgConnection.addNotificationListener(listener); +- } catch (SQLException e) { +- LOGGER.error("SQL Error: ", e); +- } +- } +- +- @Override +- public void stopNotificationListener() { +- try { +- pgConnection.close(); +- } catch (SQLException e) { +- LOGGER.error("SQL Error: ", e); +- } +- } +- +- @Override +- public void notifyClients() { +- try { +- pgConnection.createStatement().execute("NOTIFY jabrefLiveUpdate, '" + PROCESSOR_ID + "';"); +- } catch (SQLException e) { +- LOGGER.error("SQL Error: ", e); +- } +- } + } +diff --git a/src/main/java/net/sf/jabref/shared/listener/PostgresSQLNotificationListener.java b/src/main/java/net/sf/jabref/shared/listener/PostgresSQLNotificationListener.java +deleted file mode 100644 +index 2cae95385..000000000 +--- a/src/main/java/net/sf/jabref/shared/listener/PostgresSQLNotificationListener.java ++++ /dev/null +@@ -1,27 +0,0 @@ +-package net.sf.jabref.shared.listener; +- +-import net.sf.jabref.shared.DBMSProcessor; +-import net.sf.jabref.shared.DBMSSynchronizer; +- +-import com.impossibl.postgres.api.jdbc.PGNotificationListener; +- +-/** +- * A listener for PostgreSQL database notifications. +- */ +-public class PostgresSQLNotificationListener implements PGNotificationListener { +- +- private final DBMSSynchronizer dbmsSynchronizer; +- +- +- public PostgresSQLNotificationListener(DBMSSynchronizer dbmsSynchronizer) { +- this.dbmsSynchronizer = dbmsSynchronizer; +- } +- +- @Override +- public void notification(int processId, String channel, String payload) { +- if (!payload.equals(DBMSProcessor.PROCESSOR_ID)) { +- dbmsSynchronizer.pullChanges(); +- } +- } +- +-} +diff --git a/src/test/java/net/sf/jabref/logic/citationstyle/CitationStyleGeneratorTest.java b/src/test/java/net/sf/jabref/logic/citationstyle/CitationStyleGeneratorTest.java +deleted file mode 100644 +index 03f580009..000000000 +--- a/src/test/java/net/sf/jabref/logic/citationstyle/CitationStyleGeneratorTest.java ++++ /dev/null +@@ -1,46 +0,0 @@ +-package net.sf.jabref.logic.citationstyle; +- +-import net.sf.jabref.logic.l10n.Localization; +-import net.sf.jabref.model.entry.BibEntry; +-import net.sf.jabref.model.entry.FieldName; +- +-import org.junit.Test; +- +-import static org.junit.Assert.assertEquals; +- +-public class CitationStyleGeneratorTest { +- +- @Test +- public void testIgnoreNewLine() { +- BibEntry entry = new BibEntry(); +- entry.setField(FieldName.AUTHOR, "Last, First and\nDoe, Jane"); +- +- // if the default citation style changes this has to be modified +- String expected = " <div class=\"csl-entry\">\n" + +- " <div class=\"csl-left-margin\">[1]</div><div class=\"csl-right-inline\">F. Last and J. Doe, .</div>\n" + +- " </div>\n"; +- String citation = CitationStyleGenerator.generateCitation(entry, CitationStyle.getDefault()); +- assertEquals(expected, citation); +- } +- +- @Test +- public void testIgnoreCarriageReturnNewLine() { +- BibEntry entry = new BibEntry(); +- entry.setField(FieldName.AUTHOR, "Last, First and\r\nDoe, Jane"); +- +- // if the default citation style changes this has to be modified +- String expected = " <div class=\"csl-entry\">\n" + +- " <div class=\"csl-left-margin\">[1]</div><div class=\"csl-right-inline\">F. Last and J. Doe, .</div>\n" + +- " </div>\n"; +- String citation = CitationStyleGenerator.generateCitation(entry, CitationStyle.getDefault()); +- assertEquals(expected, citation); +- } +- +- @Test +- public void testMissingCitationStyle() { +- String expected = Localization.lang("Cannot generate preview based on selected citation style."); +- String citation = CitationStyleGenerator.generateCitation(new BibEntry(), "faulty citation style"); +- assertEquals(expected, citation); +- } +- +-} +diff --git a/src/test/java/net/sf/jabref/logic/citationstyle/CitationStyleTest.java b/src/test/java/net/sf/jabref/logic/citationstyle/CitationStyleTest.java +deleted file mode 100644 +index 1e673494a..000000000 +--- a/src/test/java/net/sf/jabref/logic/citationstyle/CitationStyleTest.java ++++ /dev/null +@@ -1,30 +0,0 @@ +-package net.sf.jabref.logic.citationstyle; +- +-import net.sf.jabref.logic.util.TestEntry; +- +-import org.junit.Assert; +-import org.junit.Test; +- +- +-public class CitationStyleTest { +- +- @Test +- public void getDefault() throws Exception { +- Assert.assertNotNull(CitationStyle.getDefault()); +- } +- +- @Test +- public void testDefaultCitation() { +- String citation = CitationStyleGenerator.generateCitation(TestEntry.getTestEntry(), CitationStyle.getDefault()); +- +- // if the default citation style changes this has to be modified +- String expected = " <div class=\"csl-entry\">\n" + +- " <div class=\"csl-left-margin\">[1]</div><div class=\"csl-right-inline\">" + +- "B. Smith, B. Jones, and J. Williams, “Title of the test entry,” " + +- "<i>BibTeX Journal</i>, vol. 34, no. 3, pp. 45–67, Jul. 2016.</div>\n" + +- " </div>\n"; +- +- Assert.assertEquals(citation, expected); +- } +- +-} +diff --git a/src/test/java/net/sf/jabref/logic/util/strings/DiffHighlightingTest.java b/src/test/java/net/sf/jabref/logic/util/strings/DiffHighlightingTest.java +deleted file mode 100644 +index 1ba979657..000000000 +--- a/src/test/java/net/sf/jabref/logic/util/strings/DiffHighlightingTest.java ++++ /dev/null +@@ -1,81 +0,0 @@ +-package net.sf.jabref.logic.util.strings; +- +-import org.junit.Test; +- +-import static org.junit.Assert.assertEquals; +-import static org.junit.Assert.assertNull; +- +- +-public class DiffHighlightingTest { +- +- @Test +- public void testGenerateDiffHighlightingBothNullReturnsNull() { +- assertNull(DiffHighlighting.generateDiffHighlighting(null, null, "")); +- } +- +- @Test(expected = NullPointerException.class) +- public void testNullSeparatorThrowsNPE() { +- assertNull(DiffHighlighting.generateDiffHighlighting("", "", null)); +- } +- +- @Test +- public void testGenerateDiffHighlightingNoDiff() { +- assertEquals("foo", DiffHighlighting.generateDiffHighlighting("foo", "foo", "")); +- } +- +- @Test +- public void testGenerateDiffHighlightingSingleWordAddTextWordDiff() { +- assertEquals("<span class=del>foo</span> <span class=add>foobar</span>", +- DiffHighlighting.generateDiffHighlighting("foo", "foobar", " ")); +- } +- +- @Test +- public void testGenerateDiffHighlightingSingleWordAddTextCharacterDiff() { +- assertEquals("foo<span class=add>bar</span>", DiffHighlighting.generateDiffHighlighting("foo", "foobar", "")); +- } +- +- @Test +- public void testGenerateDiffHighlightingSingleWordDeleteTextWordDiff() { +- assertEquals("<span class=del>foobar</span> <span class=add>foo</span>", +- DiffHighlighting.generateDiffHighlighting("foobar", "foo", " ")); +- } +- +- @Test +- public void testGenerateDiffHighlightingSingleWordDeleteTextCharacterDiff() { +- assertEquals("foo<span class=del>bar</span>", DiffHighlighting.generateDiffHighlighting("foobar", "foo", "")); +- } +- +- @Test +- public void generateSymmetricHighlightingSingleWordAddTextWordDiff() { +- assertEquals("<span class=change>foo</span>", +- DiffHighlighting.generateSymmetricHighlighting("foo", "foobar", " ")); +- } +- +- @Test +- public void generateSymmetricHighlightingSingleWordAddTextCharacterDiff() { +- assertEquals("foo", DiffHighlighting.generateSymmetricHighlighting("foo", "foobar", "")); +- } +- +- @Test +- public void generateSymmetricHighlightingSingleWordDeleteTextWordDiff() { +- assertEquals("<span class=change>foobar</span>", +- DiffHighlighting.generateSymmetricHighlighting("foobar", "foo", " ")); +- } +- +- @Test +- public void generateSymmetricHighlightingSingleWordDeleteTextCharacterDiff() { +- assertEquals("foo<span class=add>bar</span>", DiffHighlighting.generateSymmetricHighlighting("foobar", "foo", "")); +- } +- +- @Test +- public void generateSymmetricHighlightingMultipleWordsDeleteTextCharacterDiff() { +- assertEquals("foo<span class=add>bar</span> and <span class=add>some</span>thing", +- DiffHighlighting.generateSymmetricHighlighting("foobar and something", "foo and thing", "")); +- } +- +- @Test +- public void generateSymmetricHighlightingMultipleWordsDeleteTextWordDiff() { +- assertEquals("foo <span class=add>bar</span> and <span class=add>some</span> thing", +- DiffHighlighting.generateSymmetricHighlighting("foo bar and some thing", "foo and thing", " ")); +- } +-} +diff --git a/src/test/java/net/sf/jabref/shared/DBMSTypeTest.java b/src/test/java/net/sf/jabref/shared/DBMSTypeTest.java +index 0ec8936fb..bfe9c0c1e 100644 +--- a/src/test/java/net/sf/jabref/shared/DBMSTypeTest.java ++++ b/src/test/java/net/sf/jabref/shared/DBMSTypeTest.java +@@ -20,7 +20,7 @@ public class DBMSTypeTest { + public void testGetDriverClassPath() { + Assert.assertEquals("com.mysql.jdbc.Driver", DBMSType.MYSQL.getDriverClassPath()); + Assert.assertEquals("oracle.jdbc.driver.OracleDriver", DBMSType.ORACLE.getDriverClassPath()); +- Assert.assertEquals("com.impossibl.postgres.jdbc.PGDriver", DBMSType.POSTGRESQL.getDriverClassPath()); ++ Assert.assertEquals("org.postgresql.Driver", DBMSType.POSTGRESQL.getDriverClassPath()); + } + + @Test +@@ -35,7 +35,7 @@ public class DBMSTypeTest { + public void testGetUrl() { + Assert.assertEquals("jdbc:mysql://localhost:3306/xe", DBMSType.MYSQL.getUrl("localhost", 3306, "xe")); + Assert.assertEquals("jdbc:oracle:thin:@localhost:1521:xe", DBMSType.ORACLE.getUrl("localhost", 1521, "xe")); +- Assert.assertEquals("jdbc:pgsql://localhost:5432/xe", DBMSType.POSTGRESQL.getUrl("localhost", 5432, "xe")); ++ Assert.assertEquals("jdbc:postgresql://localhost:5432/xe", DBMSType.POSTGRESQL.getUrl("localhost", 5432, "xe")); + } + + @Test diff --git a/debian/patches/series b/debian/patches/series index 88f64bf..7728069 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ +001_koppor_debian_3.8.patch 010_gradle_build.patch 020_disable_automatic_upgrade_check.patch 030_xjc.patch -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jabref.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

