Bug#880746: libmetadata-extractor-java: Manifest references xmpcore-debian.jar, but libxmpcore-java does not provide this file.

2017-11-04 Thread Markus Koschany
Control: tags -1 pending confirmed

Hi,
thanks for reporting. I will use javahelper to correct the Class-Path
attribute as you have suggested. I didn't use the verbose mode of
jh_classpath though. By the way it is also possible to use a
override_jh_classpath.

The root cause of this problem is in pom.xml. The maven-jar-plugin is
configured to set the classpath automatically with

true

By default it is assumed that all jars are in the same directory. This
is another good example why relative classpaths suck in the context of
Debian Java packaging. Instead of using javahelper we could also modify
the pom.xml and configure the maven-jar-plugin to use a custom Class-Path

https://maven.apache.org/shared/maven-archiver/examples/classpath.html#Custom

However I agree that it is simpler to use javahelper and avoid the patch
which is not needed upstream. Have a nice weekend

Cheers,

Markus



signature.asc
Description: OpenPGP digital signature


Bug#880746: libmetadata-extractor-java: Manifest references xmpcore-debian.jar, but libxmpcore-java does not provide this file.

2017-11-04 Thread Bas Couwenberg
Source: libmetadata-extractor-java
Version: 2.10.1-2
Severity: important
Control: affects -1 src:gpsprune

Dear Maintainer,

As reported in the upstream GpsPrune issue [0], loading JPG files using
libmetadata-extractor-java causes NoClassDefFoundError exceptions:

 Link: com/adobe/xmp/XMPException
 java.lang.NoClassDefFoundError: com/adobe/xmp/XMPException
 at com.drew.imaging.jpeg.JpegMetadataReader.(JpegMetadataReader.java:57)
 at 
com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:111)
 at 
com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:161)
 at tim.prune.jpeg.ExternalExifLibrary.getJpegData(ExternalExifLibrary.java:36)
 at tim.prune.jpeg.ExifGateway.getJpegData(ExifGateway.java:46)
 at tim.prune.load.JpegLoader.createPhoto(JpegLoader.java:227)
 at tim.prune.load.JpegLoader.processFile(JpegLoader.java:204)
 at tim.prune.load.JpegLoader.processFileList(JpegLoader.java:172)
 at tim.prune.load.JpegLoader.run(JpegLoader.java:127)
 at java.lang.Thread.run(Thread.java:748)
 Caused by: java.lang.ClassNotFoundException: com.adobe.xmp.XMPException
 at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

The GpsPrune upstream developer traced this issue down to an incorrect
jar being referenced in the manifest of libmetdata-extractor-java:

"
 I had a look at the jars, and the manifest of GpsPrune's jar correctly
 references the metadata-extractor.jar. However, the manifest of the
 metadata-extractor.jar refers to a file called "xmpcore-debian.jar"
 instead of "xmpcore.jar" as I would expect.
"

The xmpcore-debian.jar file is not provided by the libxmpcore-java
package, only xmpcore.jar & xmpcore-5.1.2.jar.

The attached patch uses jh_classpath from javahelper to fix the
Class-Path in metadata-extractor.jar.

Please consider applying this patch, or fix this issue in a different
way.

[0] https://github.com/activityworkshop/GpsPrune/issues/15

Kind Regards,

Bas
>From 70f18e987b094e2f562b68bb459aa7aca94f9b0c Mon Sep 17 00:00:00 2001
From: Bas Couwenberg 
Date: Sat, 4 Nov 2017 17:48:37 +0100
Subject: Use javahelper to fix the Class-Path for xmpcore.jar.

---
 debian/changelog| 7 +++
 debian/control  | 1 +
 debian/libmetadata-extractor-java.classpath | 1 +
 debian/rules| 4 
 4 files changed, 13 insertions(+)
 create mode 100644 debian/libmetadata-extractor-java.classpath

diff --git a/debian/changelog b/debian/changelog
index 4cd2d38..a87850d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libmetadata-extractor-java (2.10.1-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Use javahelper to fix the Class-Path for xmpcore.jar.
+
+ -- Bas Couwenberg   Sat, 04 Nov 2017 17:48:01 +0100
+
 libmetadata-extractor-java (2.10.1-2) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/control b/debian/control
index 06c4607..7dad3d2 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Uploaders: Emmanuel Bourg 
 Build-Depends: debhelper (>= 10),
default-jdk,
default-jdk-doc,
+   javahelper,
junit4,
libxmpcore-java,
libmaven-javadoc-plugin-java,
diff --git a/debian/libmetadata-extractor-java.classpath 
b/debian/libmetadata-extractor-java.classpath
new file mode 100644
index 000..10ba889
--- /dev/null
+++ b/debian/libmetadata-extractor-java.classpath
@@ -0,0 +1 @@
+usr/share/java/metadata-extractor.jar /usr/share/java/xmpcore.jar
diff --git a/debian/rules b/debian/rules
index fa23c8f..194f12c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,5 +3,9 @@
 %:
dh $@ --buildsystem=maven
 
+override_dh_install:
+   dh_install
+   jh_classpath -v
+
 get-orig-source::
uscan --force-download --download-current-version
-- 
2.11.0