[Pkg-osm-commits] [SCM] josm branch, master, updated. debian/0.0.svn6115+dfsg1-1-9-g6e288a4
Andrew Shadura
andrew at shadura.me
Wed Jan 15 15:03:26 UTC 2014
The following commit has been merged in the master branch:
commit 6e288a4553e97f1d005bae0245e41fef0effec34
Author: Andrew Shadura <andrew at shadura.me>
Date: Wed Jan 15 13:57:43 2014 +0100
Add patch to build against metadata-extractor from unstable.
diff --git a/debian/patches/07-downgrade-metadata-extractor.patch b/debian/patches/07-downgrade-metadata-extractor.patch
new file mode 100644
index 0000000..c37fa74
--- /dev/null
+++ b/debian/patches/07-downgrade-metadata-extractor.patch
@@ -0,0 +1,161 @@
+--- a/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
++++ b/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
+@@ -68,7 +68,7 @@
+ import com.drew.metadata.Directory;
+ import com.drew.metadata.Metadata;
+ import com.drew.metadata.MetadataException;
+-import com.drew.metadata.exif.ExifIFD0Directory;
++import com.drew.metadata.exif.ExifDirectory;
+ import com.drew.metadata.exif.GpsDirectory;
+
+ /**
+@@ -557,21 +557,17 @@
+
+ try {
+ metadata = JpegMetadataReader.readMetadata(e.getFile());
+- dirExif = metadata.getDirectory(ExifIFD0Directory.class);
+- dirGps = metadata.getDirectory(GpsDirectory.class);
++ dirExif = metadata.getDirectory(ExifDirectory.class);
++ dirGps = (GpsDirectory) metadata.getDirectory(GpsDirectory.class);
+ } catch (CompoundException p) {
+ e.setExifCoor(null);
+ e.setPos(null);
+ return;
+- } catch (IOException p) {
+- e.setExifCoor(null);
+- e.setPos(null);
+- return;
+ }
+
+ try {
+ if (dirExif != null) {
+- int orientation = dirExif.getInt(ExifIFD0Directory.TAG_ORIENTATION);
++ int orientation = dirExif.getInt(ExifDirectory.TAG_ORIENTATION);
+ e.setExifOrientation(orientation);
+ }
+ } catch (MetadataException ex) {
+@@ -617,7 +613,12 @@
+ // 1) GPS_TIME_STAMP not set -> date/time will be null
+ // 2) GPS_DATE_STAMP not set -> use EXIF date or set to default
+ // 3) GPS_TIME_STAMP and GPS_DATE_STAMP are set
+- int[] timeStampComps = dirGps.getIntArray(GpsDirectory.TAG_GPS_TIME_STAMP);
++ int[] timeStampComps = null;
++ try {
++ timeStampComps = dirGps.getIntArray(GpsDirectory.TAG_GPS_TIME_STAMP);
++ } catch (MetadataException ex) {
++ // Do nothing
++ }
+ if (timeStampComps != null) {
+ int gpsHour = timeStampComps[0];
+ int gpsMin = timeStampComps[1];
+@@ -626,7 +627,7 @@
+
+ // We have the time. Next step is to check if the GPS date stamp is set.
+ // dirGps.getString() always succeeds, but the return value might be null.
+- String dateStampStr = dirGps.getString(GpsDirectory.TAG_GPS_DATE_STAMP);
++ String dateStampStr = dirGps.getString(0x001D /* GpsDirectory.TAG_GPS_DATE_STAMP */);
+ if (dateStampStr != null && dateStampStr.matches("^\\d+:\\d+:\\d+$")) {
+ String[] dateStampComps = dateStampStr.split(":");
+ cal.set(Calendar.YEAR, Integer.parseInt(dateStampComps[0]));
+--- a/src/org/openstreetmap/josm/tools/ExifReader.java
++++ b/src/org/openstreetmap/josm/tools/ExifReader.java
+@@ -5,6 +5,7 @@
+ import java.io.IOException;
+ import java.text.ParseException;
+ import java.util.Date;
++import java.util.Iterator;
+
+ import org.openstreetmap.josm.data.coor.LatLon;
+
+@@ -15,8 +16,7 @@
+ import com.drew.metadata.Metadata;
+ import com.drew.metadata.MetadataException;
+ import com.drew.metadata.Tag;
+-import com.drew.metadata.exif.ExifIFD0Directory;
+-import com.drew.metadata.exif.ExifSubIFDDirectory;
++import com.drew.metadata.exif.ExifDirectory;
+ import com.drew.metadata.exif.GpsDirectory;
+
+ /**
+@@ -41,14 +41,15 @@
+ Metadata metadata = JpegMetadataReader.readMetadata(filename);
+ String dateStr = null;
+ OUTER:
+- for (Directory dirIt : metadata.getDirectories()) {
+- for (Tag tag : dirIt.getTags()) {
+- if (tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL /* 0x9003 */) {
++ for (Iterator<Directory> dirIt = metadata.getDirectoryIterator(); dirIt.hasNext();) {
++ for (Iterator<Tag> tagIt = dirIt.next().getTagIterator(); tagIt.hasNext();) {
++ Tag tag = tagIt.next();
++ if (tag.getTagType() == ExifDirectory.TAG_DATETIME_ORIGINAL /* 0x9003 */) {
+ dateStr = tag.getDescription();
+ break OUTER; // prefer this tag
+ }
+- if (tag.getTagType() == ExifIFD0Directory.TAG_DATETIME /* 0x0132 */ ||
+- tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */) {
++ if (tag.getTagType() == ExifDirectory.TAG_DATETIME /* 0x0132 */ ||
++ tag.getTagType() == ExifDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */) {
+ dateStr = tag.getDescription();
+ }
+ }
+@@ -83,14 +84,12 @@
+ public static Integer readOrientation(File filename) {
+ try {
+ final Metadata metadata = JpegMetadataReader.readMetadata(filename);
+- final Directory dir = metadata.getDirectory(ExifIFD0Directory.class);
+- return dir.getInt(ExifIFD0Directory.TAG_ORIENTATION);
++ final Directory dir = metadata.getDirectory(ExifDirectory.class);
++ return dir.getInt(ExifDirectory.TAG_ORIENTATION);
+ } catch (JpegProcessingException e) {
+ e.printStackTrace();
+ } catch (MetadataException e) {
+ e.printStackTrace();
+- } catch (IOException e) {
+- e.printStackTrace();
+ }
+ return null;
+ }
+@@ -104,12 +103,10 @@
+ public static LatLon readLatLon(File filename) {
+ try {
+ final Metadata metadata = JpegMetadataReader.readMetadata(filename);
+- final GpsDirectory dirGps = metadata.getDirectory(GpsDirectory.class);
++ final GpsDirectory dirGps = (GpsDirectory) metadata.getDirectory(GpsDirectory.class);
+ return readLatLon(dirGps);
+ } catch (JpegProcessingException e) {
+ e.printStackTrace();
+- } catch (IOException e) {
+- e.printStackTrace();
+ } catch (MetadataException e) {
+ e.printStackTrace();
+ }
+@@ -141,12 +138,10 @@
+ public static Double readDirection(File filename) {
+ try {
+ final Metadata metadata = JpegMetadataReader.readMetadata(filename);
+- final GpsDirectory dirGps = metadata.getDirectory(GpsDirectory.class);
++ final GpsDirectory dirGps = (GpsDirectory) metadata.getDirectory(GpsDirectory.class);
+ return readDirection(dirGps);
+ } catch (JpegProcessingException e) {
+ e.printStackTrace();
+- } catch (IOException e) {
+- e.printStackTrace();
+ }
+ return null;
+ }
+@@ -159,9 +154,12 @@
+ */
+ public static Double readDirection(GpsDirectory dirGps) {
+ if (dirGps != null) {
+- Rational direction = dirGps.getRational(GpsDirectory.TAG_GPS_IMG_DIRECTION);
+- if (direction != null) {
+- return direction.doubleValue();
++ try {
++ Rational direction = dirGps.getRational(GpsDirectory.TAG_GPS_IMG_DIRECTION);
++ if (direction != null) {
++ return direction.doubleValue();
++ }
++ } catch (MetadataException ex) {
+ }
+ }
+ return null;
diff --git a/debian/patches/series b/debian/patches/series
index 320864c..061cbaa 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
05-fix_version.patch
#100-fix_SlippyMapBBoxChooser.patch
06-move_data_out_of_jar.patch
+07-downgrade-metadata-extractor.patch
--
Editor for OpenStreetMap
More information about the Pkg-osm-commits
mailing list