#8895 closed enhancement (fixed)
[Patch] Upgrade metadata-extractor
Reported by: | ebourg | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | exif | Cc: |
Description
JOSM uses the version 2.3 of metadata-extractor but the version 2.6 is now available. Here is a patch that updates the code to use the latest version.
Attachments (6)
Change History (42)
by , 11 years ago
Attachment: | upgrade-metadata-extractor.patch added |
---|
comment:1 by , 11 years ago
Summary: | Upgrade metadata-extractor → [PATCH] Upgrade metadata-extractor |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
Keywords: | exif added |
---|
comment:4 by , 11 years ago
Thank you for pointing me to #6162, the patch fails to work with this image. I'll rework the patch and forward the issue to metadata-extractor.
follow-up: 8 comment:6 by , 11 years ago
I reported the bug:
http://code.google.com/p/metadata-extractor/issues/detail?id=84
It seems #5220 should be forwarded too.
by , 11 years ago
Attachment: | upgrade-metadata-extractor2.patch added |
---|
comment:7 by , 11 years ago
When I download the source distribution metadata-extractor 2.6.4, it doesn't compile. Classes com.adobe.xmp.XMPMeta and so on seem to be missing. How do you get these?
comment:8 by , 11 years ago
Replying to ebourg:
I reported the bug:
http://code.google.com/p/metadata-extractor/issues/detail?id=84
Thanks for reporting this!
It seems #5220 should be forwarded too.
Yes, would be nice.
comment:9 by , 11 years ago
I haven't tried to compile metadata-extractor, I just dropped the jar in the lib directory and removed the classes in the src/com/drew directory.
Do you absolutely need to compile this dependency? Using the jar directly would be easier.
comment:10 by , 11 years ago
Yes, that's how we do it at the moment. One reason is that unused classes are dropped automatically, which reduces the filesize of the binary. Another is security/transparency (so we and others can verify what is shipped).
comment:11 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
This library seems to be fairly stable, so an update doesn't have high priority. I will still do it, if you provide a patch for the lib update, as well.
by , 11 years ago
Attachment: | upgrade-metadata-extractor3.patch added |
---|
Updated patch including the metadata-extractor source files
comment:12 by , 11 years ago
I updated the patch, it now includes the subset of the metadata-extractor source files used by JOSM.
comment:13 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | needinfo → new |
comment:14 by , 11 years ago
I cannot apply your patch. This is probably related to svn:eol-style
and automated changes of newline format.
comment:15 by , 11 years ago
Ok, let's try something else then. I'll attach an archive containing the metadata-extractor source files and the modified JOSM files.
by , 11 years ago
Attachment: | src.tar.gz added |
---|
comment:16 by , 11 years ago
I get NPE when opening an image that is not geotagged:
ava.lang.NullPointerException at org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer.extractExif(GeoImageLayer.java:536) at org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer.access$000(GeoImageLayer.java:75) at org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer$Loader.realRun(GeoImageLayer.java:157) at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:82) at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:150) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679)
comment:17 by , 11 years ago
Good catch. A simple null check just before the try/catch block starting at line 535 will fix it:
if (dirGps == null) { e.setExifCoor(null); e.setPos(null); return; }
follow-up: 22 comment:20 by , 11 years ago
I just updated my code and got some conflicts. Some classes no longer exist in metadata-extractor 2.6.4 and should be removed:
src/com/drew/metadata/SampleUsage.java
src/com/drew/metadata/exif/ExifDescriptor.java
src/com/drew/metadata/exif/SonyMakernoteDescriptor.java
src/com/drew/metadata/exif/SonyMakernoteDirectory.java
src/com/drew/metadata/exif/ExifProcessingException.java
src/com/drew/metadata/exif/ExifDirectory.java
src/com/drew/metadata/iptc/IptcProcessingException.java
comment:21 by , 11 years ago
Also it looks like the version of GeoImageLayer that was committed in r6127/josm is the one from my first patch. The archive has the most recent version (minus the null check) that adresses #6162.
comment:22 by , 11 years ago
Replying to ebourg:
I just updated my code and got some conflicts. Some classes no longer exist in metadata-extractor 2.6.4 and should be removed:
src/com/drew/metadata/SampleUsage.java
src/com/drew/metadata/exif/ExifDescriptor.java
src/com/drew/metadata/exif/SonyMakernoteDescriptor.java
src/com/drew/metadata/exif/SonyMakernoteDirectory.java
src/com/drew/metadata/exif/ExifProcessingException.java
src/com/drew/metadata/exif/ExifDirectory.java
src/com/drew/metadata/iptc/IptcProcessingException.java
These files should be gone, could you check again?
comment:25 by , 11 years ago
Introduced findbugs warning:
<BugInstance type="REC_CATCH_EXCEPTION" priority="2" abbrev="REC" category="STYLE"> <Class classname="org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer"> <SourceLine classname="org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer" start="74" end="860" sourcefile="GeoImageLayer.java" sourcepath="org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java"/> </Class> <Method classname="org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer" name="extractExif" signature="(Lorg/openstreetmap/josm/gui/layer/geoimage/ImageEntry;)V" isStatic="true"> <SourceLine classname="org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer" start="518" end="621" startBytecode="0" endBytecode="1618" sourcefile="GeoImageLayer.java" sourcepath="org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java"/> </Method> <SourceLine classname="org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer" start="603" end="603" startBytecode="486" endBytecode="486" sourcefile="GeoImageLayer.java" sourcepath="org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java"/> </BugInstance>
http://findbugs.sourceforge.net/bugDescriptions.html#REC_CATCH_EXCEPTION
comment:26 by , 11 years ago
I'm not sure to understand why Findbugs reports this one. That may be caused by the JpegProcessingException thrown by JpegMetadataReader.readMetadata(), we catch its super type CompoundException.
comment:27 by , 11 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:28 by , 11 years ago
Priority: | minor → normal |
---|---|
Summary: | [PATCH] Upgrade metadata-extractor → Upgrade metadata-extractor |
by , 11 years ago
Attachment: | exif-direction-example.jpg added |
---|
regression test file (works fine with r6115, not after library upgrade)
comment:29 by , 11 years ago
Summary: | Upgrade metadata-extractor → [Patch] Upgrade metadata-extractor |
---|
comment:32 by , 11 years ago
Would that make sense to forward the ExifReader changes to the metadata-extractor developers, or is this too specific to josm?
comment:33 by , 11 years ago
It is a problem, if there are changes done by Josm wich are not reported to upstream.
When packaging JOSM we have to use depedencies, and actually we can't update JOSM because metadata-extractor used by JOSM is not the same as metadata-extractor provided by upstream.
comment:34 by , 11 years ago
@Don-vip: Could you please explain, how this change (http://josm.openstreetmap.de/changeset/6209/josm/trunk/src/com/drew/metadata/exif/ExifReader.java) fixes the problem in #9030? The original code aborts reading of meta data in case of an error. As far as I'm aware, the image exif-direction-example.jpg is valid exif and should not contain an error.
comment:35 by , 11 years ago
Honestly I don't remember :) I think I found it was this error that prevented the image to be parsed, and when I saw ignoring it resolved the issue I didn't investigate much further :) I you find a proper patch or a solution inside JOSM code, feel free to change it :)
comment:36 by , 11 years ago
FYI I forwarded the issue upstream: https://code.google.com/p/metadata-extractor/issues/detail?id=94
The modification made by @Don-vip partially reverts a change in metadata-extractor, so it's as bad/good as the previous version of metadata-extractor used by JOSM.
Have you verified, that the example from #6162 is still working?