jokiazhang / metadata-extractor

Automatically exported from code.google.com/p/metadata-extractor
0 stars 0 forks source link

XMP jar lib available for download seems not correct #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. Since I downloaded your jarlib at version 2.6.2 from the download link, my 
tests on reading XMP metadata from JPEG images fail with the following error:

java.lang.NoSuchMethodError: 
com.adobe.xmp.properties.XMPPropertyInfo.getValue()Ljava/lang/Object;

2. I fetched your sources with git and did a build (ant dist-binaries).
The tests failed with the same error.

3. I remarked that your copy of XMPCore isn't correct. For example, in your 
sources XMPPropertyInfo#getValue() return an Object but in the official sources 
of XMPPcore 5.1.0 or 5.1.1, it returns a String.
So, I replaced your xmpcore.jar by the official one and build again the 
metadata-extractor. Now, the tests passes correctly!

PS: with maven (or your ant coupled with ivy), thanks to its management of 
dependencies, this problem could have been avoided.

Original issue reported on code.google.com by miguel.m...@gmail.com on 29 Jun 2012 at 1:18

GoogleCodeExporter commented 9 years ago
You need to clone the git repo and use tag 2.6.2 to make this happen.
Official version XMP Core 5.12 from Maven Central worked for me

Original comment by vitek.ri...@gmail.com on 10 Jul 2012 at 11:07

GoogleCodeExporter commented 9 years ago
The problem occurs whatever the library comes from a build of the sources 
fetched by a git clone or by the download link.

Yes, with XMP core 5.12 from the Maven Central the problem doesn't occur 
anymore because the problem comes from the incorrect copy of XMP Core in the 
sources.
So, the solution is either to replace this incorrect copy in the sources by the 
one in the Maven Central or to use a dependency mechanism based on Maven or Ivy.

Original comment by miguel.m...@gmail.com on 24 Jul 2012 at 9:35

GoogleCodeExporter commented 9 years ago

Original comment by drewnoakes on 16 Oct 2012 at 2:19

GoogleCodeExporter commented 9 years ago

Original comment by drewnoakes on 16 Oct 2012 at 8:03

GoogleCodeExporter commented 9 years ago
The sources of XMP core were not actually being used anyway, so I've removed 
them from the repo.

Version 2.7.0 of metadata-extractor will come bundled with version 5.1.2 of 
Adobe's XMPCore too.

Thanks.

Original comment by drewnoakes on 1 Jan 2013 at 11:44

GoogleCodeExporter commented 9 years ago
I'm also running into this issue. We're using metadata-extractor-2.6.3.jar and 
neither com.adobe.xmp:xmpcore:5.1.0, 5.1.1 or 5.1.2 worked for me (always 
NoSuchMethodError: 
com.adobe.xmp.properties.XMPPropertyInfo.getValue()Ljava/lang/Object;).

In maven central I also cannot find xmpcore 5.12, but only the mentioned 
versions: http://repo1.maven.org/maven2/com/adobe/xmp/xmpcore/

What is the recommended approach to get the metadata-extractor working with 
libs from some maven repo? The best would be to have the metadata-extractor 
itself available in maven central.

Original comment by martin.grotzke on 17 Jan 2013 at 8:41

GoogleCodeExporter commented 9 years ago
It was misspell: the version of xmpcore in Maven Central isn't 5.12 but 5.1.2 
(a dot was missed between the 1 and 2).

Original comment by miguel.m...@gmail.com on 17 Jan 2013 at 10:56

GoogleCodeExporter commented 9 years ago
@martin.grotzke, does @miguel.moquillon's comment mean that your problem is 
fixed now?

Original comment by drewnoakes on 17 Jan 2013 at 6:08

GoogleCodeExporter commented 9 years ago
IMHO it's not fixed. The problem is that all versions of com.adobe.xmp:xmpcore 
currently available from maven repositories (5.1.0, 5.1.1, 5.1.2) return a 
String in com.adobe.xmp.properties.XMPPropertyInfo.getValue() and not an Object 
(see 
http://grepcode.com/file/repo1.maven.org/maven2/com.adobe.xmp/xmpcore/5.1.2/com/
adobe/xmp/properties/XMPProperty.java#XMPProperty.getValue%28%29)

The only incarnation of an Object-returning XMPPropertyInfo.getValue() function 
I could find is in the xmpcore lib of this projects repo 
(https://code.google.com/p/metadata-extractor/source/browse/Libraries/XMPCore/sr
c/com/adobe/xmp/properties/XMPPropertyInfo.java?name=2.6.4)

I'm not sure who's wrong here. I'm also not sure, if there are other issues 
with standard xmpcore 5.1.2 compared this project's version. However, IMHO it'd 
be great if metadata-extractor would work with libs from standard sources...

And as you're converting this to String anyway, a change should be trivial:

com\drew\metadata\xmp\XmpReader.java:

    164             for (XMPIterator iterator = xmpMeta.iterator(); iterator.hasNext();) {
    165                 XMPPropertyInfo propInfo = (XMPPropertyInfo) iterator.next();
    166                 String path = propInfo.getPath();
>>  167                 Object value = propInfo.getValue();
    168                 if (path != null && value != null)
>>  169                     directory.addProperty(path, value.toString());
    170             }

Original comment by matthias...@infineon.com on 10 Jun 2013 at 12:49

GoogleCodeExporter commented 9 years ago
Cheers Matthias,

I'll reopen and take another look at it.

Original comment by drewnoakes on 10 Jun 2013 at 12:53

GoogleCodeExporter commented 9 years ago
Sorry. Just checked it again. 2.7.0 should be okay. But 2.6.x still has the 
issue...

Original comment by matthias...@infineon.com on 10 Jun 2013 at 1:01

GoogleCodeExporter commented 9 years ago
Ok, cheers. In that case I'll close it. Hope to get 2.7.0 out soon, but it 
won't be for another month at least. I'm flat out on a project right now.

Original comment by drewnoakes on 10 Jun 2013 at 1:03