[jabref] 303/459: New patch 08_doubleextensions.patch, kindly backported and provided by upstream: improve handling of linked files with double extensions: file types with a double extension are new recognized automatically when a new link is added manually, or when a link is added automatically and clicked-upon once, after defining the file type in the options (closes: #626582).

gregor herrmann gregoa at debian.org
Thu Sep 15 20:40:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository jabref.

commit b6ee904c39df0ea6b56e4c65d0ebca85f1bf96f3
Author: gregor herrmann <gregoa at debian.org>
Date:   Sun May 22 15:57:06 2011 +0000

    New patch 08_doubleextensions.patch, kindly backported and provided by
    upstream: improve handling of linked files with double extensions: file
    types with a double extension are new recognized automatically when a new
    link is added manually, or when a link is added automatically and
    clicked-upon once, after defining the file type in the options
    (closes: #626582).
---
 debian/changelog                         | 11 ++++++
 debian/patches/08_doubleextensions.patch | 59 ++++++++++++++++++++++++++++++++
 debian/patches/series                    |  1 +
 3 files changed, 71 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 0af748e..297aa87 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+jabref (2.7~beta1+ds-5) UNRELEASED; urgency=low
+
+  * New patch 08_doubleextensions.patch, kindly backported and provided by
+    upstream: improve handling of linked files with double extensions: file
+    types with a double extension are new recognized automatically when a new
+    link is added manually, or when a link is added automatically and
+    clicked-upon once, after defining the file type in the options
+    (closes: #626582).
+
+ -- gregor herrmann <gregoa at debian.org>  Sun, 22 May 2011 17:30:48 +0200
+
 jabref (2.7~beta1+ds-4) unstable; urgency=low
 
   [ tony mancill ]
diff --git a/debian/patches/08_doubleextensions.patch b/debian/patches/08_doubleextensions.patch
new file mode 100644
index 0000000..2f17bbb
--- /dev/null
+++ b/debian/patches/08_doubleextensions.patch
@@ -0,0 +1,59 @@
+Description: handle double extensions better
+Origin: upstream
+Bug-Debian: http://bugs.debian.org/626582
+Forwarded: not needed, it's from them :)
+Author: Morten Omholt Alver <mortenalver at gmail.com>
+Reviewed-by: gregor herrmann <gregoa at debian.org>
+Last-Update: 2011-05-22
+Applied-Upstream: yes
+
+--- a/src/java/net/sf/jabref/gui/FileListEntryEditor.java
++++ b/src/java/net/sf/jabref/gui/FileListEntryEditor.java
+@@ -198,14 +198,9 @@
+ 
+             // Try to guess the file type:
+             String theLink = link.getText().trim();
+-            int index = theLink.lastIndexOf('.');
+-            if ((index >= 0) && (index < theLink.length()-1)) {
+-
+-                ExternalFileType type = Globals.prefs.getExternalFileTypeByExt
+-                        (theLink.substring(index+1));
+-                if (type != null)
+-                    types.setSelectedItem(type);
+-            }
++            ExternalFileType type = Globals.prefs.getExternalFileTypeForName(theLink);
++            if (type != null)
++                types.setSelectedItem(type);
+         }
+     }
+ 
+--- a/src/java/net/sf/jabref/JabRefPreferences.java
++++ b/src/java/net/sf/jabref/JabRefPreferences.java
+@@ -1065,6 +1065,27 @@
+     }
+ 
+     /**
++     * Look up the external file type registered for this filename, if any.
++     * @param filename The name of the file whose type to look up.
++     * @return The ExternalFileType registered, or null if none.
++     */
++    public ExternalFileType getExternalFileTypeForName(String filename) {
++        int longestFound = -1;
++        ExternalFileType foundType = null;
++        for (Iterator<ExternalFileType> iterator = externalFileTypes.iterator(); iterator.hasNext();) {
++            ExternalFileType type = iterator.next();
++            if ((type.getExtension() != null) && filename.toLowerCase().
++                    endsWith(type.getExtension().toLowerCase())) {
++                if (type.getExtension().length() > longestFound) {
++                    longestFound = type.getExtension().length();
++                    foundType = type;
++                }
++            }
++        }
++        return foundType;
++    }
++
++    /**
+      * Look up the external file type registered for this MIME type, if any.
+      * @param mimeType The MIME type.
+      * @return The ExternalFileType registered, or null if none. For the mime type "text/html",
diff --git a/debian/patches/series b/debian/patches/series
index e74eb21..7da9af0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
 05_antlr32.patch
 06_BibtexEntry.patch
 07_pdfbox1.5.patch
+08_doubleextensions.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jabref.git



More information about the pkg-java-commits mailing list