dschmidt commented on code in PR #2938:
URL: https://github.com/apache/tika/pull/2938#discussion_r3555170062


##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/mp4/TikaMp4BoxHandler.java:
##########
@@ -186,12 +183,12 @@ private void processQuickTimeItemList(@Nullable byte[] 
payload) {
      * the raw value, so QuickTime location matches the {@code geo:*} output 
of the udta path.
      */
     private void addLocation(String iso6709) {
-        Matcher matcher = ISO6709_PATTERN.matcher(iso6709);
-        if (matcher.find()) {
-            tikaMetadata.set(TikaCoreProperties.LATITUDE, 
Double.parseDouble(matcher.group(1)));
-            tikaMetadata.set(TikaCoreProperties.LONGITUDE, 
Double.parseDouble(matcher.group(2)));
-            if (matcher.group(3) != null) {
-                tikaMetadata.set(TikaCoreProperties.ALTITUDE, 
Double.parseDouble(matcher.group(3)));
+        ISO6709.Location location = ISO6709.parse(iso6709);
+        if (location != null) {
+            tikaMetadata.set(TikaCoreProperties.LATITUDE, location.latitude);
+            tikaMetadata.set(TikaCoreProperties.LONGITUDE, location.longitude);
+            if (location.altitude != null) {
+                tikaMetadata.set(TikaCoreProperties.ALTITUDE, 
location.altitude);
             }

Review Comment:
   ... unless it would become a generic Location class - with 
`parseFromIso6709()`, `parseSomething()` methods that would also parse other 
formats as well?
   
   Was never a Java person, so not sure what's really idiomatic :) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to