Changeset 9697 in josm


Ignore:
Timestamp:
2016-01-31T14:38:51+01:00 (9 years ago)
Author:
simon04
Message:

Fix MetadataException: "Tag 'Orientation' has not been set -- check using containsTag() first"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ExifReader.java

    r9672 r9697  
    104104            final Metadata metadata = JpegMetadataReader.readMetadata(filename);
    105105            final Directory dir = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
    106             return dir.getInt(ExifIFD0Directory.TAG_ORIENTATION);
    107         } catch (JpegProcessingException | MetadataException | IOException e) {
     106            return dir == null ? null : dir.getInteger(ExifIFD0Directory.TAG_ORIENTATION);
     107        } catch (JpegProcessingException | IOException e) {
    108108            Main.error(e);
    109109        }
     
    122122            final GpsDirectory dirGps = metadata.getFirstDirectoryOfType(GpsDirectory.class);
    123123            return readLatLon(dirGps);
    124         } catch (JpegProcessingException e) {
    125             Main.error(e);
    126         } catch (IOException e) {
    127             Main.error(e);
    128         } catch (MetadataException e) {
     124        } catch (JpegProcessingException | IOException | MetadataException e) {
    129125            Main.error(e);
    130126        }
     
    160156            final GpsDirectory dirGps = metadata.getFirstDirectoryOfType(GpsDirectory.class);
    161157            return readDirection(dirGps);
    162         } catch (JpegProcessingException e) {
    163             Main.error(e);
    164         } catch (IOException e) {
     158        } catch (JpegProcessingException | IOException e) {
    165159            Main.error(e);
    166160        }
Note: See TracChangeset for help on using the changeset viewer.