[med-svn] [picard-tools] 01/02: Fix path handling to allow '+' in directory names

Vincent Danjean vdanjean at debian.org
Tue Sep 8 09:34:34 UTC 2015


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

vdanjean pushed a commit to branch master
in repository picard-tools.

commit 516c05947657bb9550ec0886e25d76332ac562e4
Author: Vincent Danjean <vdanjean at debian.org>
Date:   Tue Sep 8 11:15:12 2015 +0200

    Fix path handling to allow '+' in directory names
---
 debian/patches/00-for-upstream-fix-testsuite   |  2 +-
 debian/patches/01-for-upstream-fix-classloader | 47 ++++++++++++++++++++++++++
 debian/patches/{01-build.xml => 10-build.xml}  |  0
 debian/patches/series                          |  3 +-
 4 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/debian/patches/00-for-upstream-fix-testsuite b/debian/patches/00-for-upstream-fix-testsuite
index 40ecf11..3a6c393 100644
--- a/debian/patches/00-for-upstream-fix-testsuite
+++ b/debian/patches/00-for-upstream-fix-testsuite
@@ -2,7 +2,7 @@ Description: Fix a bug in the testsuite
  This patch fixes the number of arguments of the
  testIlluminaDataProviderMissingDatas function.
 Origin: vendor
-Forwarded: no
+Forwarded: yes
 --- a/src/tests/java/picard/illumina/parser/IlluminaDataProviderTest.java
 +++ b/src/tests/java/picard/illumina/parser/IlluminaDataProviderTest.java
 @@ -259,10 +259,12 @@ public class IlluminaDataProviderTest {
diff --git a/debian/patches/01-for-upstream-fix-classloader b/debian/patches/01-for-upstream-fix-classloader
new file mode 100644
index 0000000..1d9974b
--- /dev/null
+++ b/debian/patches/01-for-upstream-fix-classloader
@@ -0,0 +1,47 @@
+Description: Fix a bug in path handling
+ This patch fixes the convertion from URL to path so that paths
+ containing the '+' character are not converted to ' '. As the
+ Debian package has +dfsg suffix in its version string, sbuilder
+ create a directory with this string and the test suite suffer
+ from this bug.
+Origin: vendor
+Forwarded: yes
+--- a/src/java/picard/cmdline/ClassFinder.java
++++ b/src/java/picard/cmdline/ClassFinder.java
+@@ -30,7 +30,8 @@ import java.io.File;
+ import java.io.IOException;
+ import java.net.URL;
+ import java.net.URLClassLoader;
+-import java.net.URLDecoder;
++import java.net.URI;
++import java.net.URISyntaxException;
+ import java.util.*;
+ import java.util.zip.ZipEntry;
+ import java.util.zip.ZipFile;
+@@ -63,7 +64,7 @@ public class ClassFinder {
+         // but the jarPath is remembered so that the iteration over the classpath skips anything other than
+         // the jarPath.
+         jarPath = jarFile.getCanonicalPath();
+-        final URL[] urls = {new URL("file", "", jarPath)};
++        final URL[] urls = {new File(jarPath).toURI().toURL()};
+         loader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader());
+     }
+ 
+@@ -95,9 +96,14 @@ public class ClassFinder {
+         while (urls.hasMoreElements()) {
+             try {
+                 String urlPath = urls.nextElement().getFile();
+-                urlPath = URLDecoder.decode(urlPath, "UTF-8");
+-                if ( urlPath.startsWith("file:") ) {
+-                    urlPath = urlPath.substring(5);
++                // convert URL to URI
++                // http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4466485
++                // using URLDecode does not work if urlPath has a '+' character
++                try {
++                    URI uri = new URI(urlPath);
++                   urlPath = uri.getPath();
++                } catch (URISyntaxException e) {
++                    log.warn("Cannot convert to URI the " + urlPath + " URL");
+                 }
+                 if (urlPath.indexOf('!') > 0) {
+                     urlPath = urlPath.substring(0, urlPath.indexOf('!'));
diff --git a/debian/patches/01-build.xml b/debian/patches/10-build.xml
similarity index 100%
rename from debian/patches/01-build.xml
rename to debian/patches/10-build.xml
diff --git a/debian/patches/series b/debian/patches/series
index 2082a43..f213547 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 00-for-upstream-fix-testsuite
-01-build.xml
+01-for-upstream-fix-classloader
+10-build.xml

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/picard-tools.git



More information about the debian-med-commit mailing list