Hi,

Another problem with not including an issue reference in a commit
message; there's no issue to comment on or to reopen in case of
problems. :-)

On Tue, Jun 29, 2010 at 3:06 PM,  <[email protected]> wrote:
> +    private static final DecimalFormat LAT_LONG_FORMAT = new 
> DecimalFormat("##0.0####");

DecimalFormat is locale-specific, which may cause problems in
environments where number formatting doesn't match the "float" format
specified by XML Schema and referenced by the W3C basic geo
vocabulary. See below for a patch that fixes this by explicitly
specifying which locale to use (Locale.US matches the conventions used
by XML Schema).

BR,

Jukka Zitting

Index: 
tika-parsers/src/main/java/org/apache/tika/parser/image/TiffExtractor.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parser/image/TiffExtractor.java
 (revision 959111)
+++ tika-parsers/src/main/java/org/apache/tika/parser/image/TiffExtractor.java
 (working copy)
@@ -19,11 +19,14 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;

 import org.apache.tika.exception.TikaException;
+import org.apache.tika.metadata.Geographic;
 import org.apache.tika.metadata.Metadata;
 import org.apache.tika.metadata.Property;
 import org.xml.sax.SAXException;
@@ -111,8 +114,15 @@
        return null;
     }
     private static final Pattern HOURS_MINUTES_SECONDS =
Pattern.compile("(-?\\d+)\"(\\d+)'(\\d+\\.?\\d*)");
-    private static final DecimalFormat LAT_LONG_FORMAT = new
DecimalFormat("##0.0####");

+    /**
+     * The decimal format used for expressing latitudes and longitudes.
+     * The basic geo vocabulary defined by W3C (@see {...@link Geographic})
+     * refers to the "float" type in XML Schema as the recommended format
+     * for latitude and longitude values.
+     */
+    private static final DecimalFormat LAT_LONG_FORMAT =
+        new DecimalFormat("##0.0####", new DecimalFormatSymbols(Locale.US));

     /**
      * Maps common TIFF and EXIF tags onto the Tika

Reply via email to