diff --git a/src/main/java/edu/illinois/library/cantaloupe/image/Metadata.java b/src/main/java/edu/illinois/library/cantaloupe/image/Metadata.java index 02c9bd5c0..4c5809bce 100644 --- a/src/main/java/edu/illinois/library/cantaloupe/image/Metadata.java +++ b/src/main/java/edu/illinois/library/cantaloupe/image/Metadata.java @@ -141,6 +141,8 @@ private void readOrientationFromEXIF() { // According to spec the orientation must be an unsigned short (16 bit) // However, we have seen exif data in the wild with LONG and SLONG types // Thus to be lenient we accept either and convert to int (github issue #548) + // It could also happen that 'value' is in fact a Java Integer even if the + // exif data type is LONG or SLONG, so we need to check for that as well. if (value instanceof Long) { orientation = Orientation.forEXIFOrientation(Math.toIntExact((long) value)); } else if (value instanceof Integer) {