Merge "Change warning logs to debug logs" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e827932a9c
@@ -82,7 +82,7 @@ import java.util.regex.Pattern;
|
|||||||
*/
|
*/
|
||||||
public class ExifInterface {
|
public class ExifInterface {
|
||||||
private static final String TAG = "ExifInterface";
|
private static final String TAG = "ExifInterface";
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||||
|
|
||||||
// The Exif tag names. See Tiff 6.0 Section 3 and Section 8.
|
// The Exif tag names. See Tiff 6.0 Section 3 and Section 8.
|
||||||
/** Type is String. */
|
/** Type is String. */
|
||||||
@@ -1605,12 +1605,15 @@ public class ExifInterface {
|
|||||||
|| exifTag.primaryFormat == IFD_FORMAT_STRING) {
|
|| exifTag.primaryFormat == IFD_FORMAT_STRING) {
|
||||||
dataFormat = exifTag.primaryFormat;
|
dataFormat = exifTag.primaryFormat;
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Given tag (" + tag + ") value didn't match with one of expected "
|
if (DEBUG) {
|
||||||
+ "formats: " + IFD_FORMAT_NAMES[exifTag.primaryFormat]
|
Log.d(TAG, "Given tag (" + tag
|
||||||
+ (exifTag.secondaryFormat == -1 ? "" : ", "
|
+ ") value didn't match with one of expected "
|
||||||
+ IFD_FORMAT_NAMES[exifTag.secondaryFormat]) + " (guess: "
|
+ "formats: " + IFD_FORMAT_NAMES[exifTag.primaryFormat]
|
||||||
+ IFD_FORMAT_NAMES[guess.first] + (guess.second == -1 ? "" : ", "
|
+ (exifTag.secondaryFormat == -1 ? "" : ", "
|
||||||
+ IFD_FORMAT_NAMES[guess.second]) + ")");
|
+ IFD_FORMAT_NAMES[exifTag.secondaryFormat]) + " (guess: "
|
||||||
|
+ IFD_FORMAT_NAMES[guess.first] + (guess.second == -1 ? "" : ", "
|
||||||
|
+ IFD_FORMAT_NAMES[guess.second]) + ")");
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (dataFormat) {
|
switch (dataFormat) {
|
||||||
@@ -1688,7 +1691,9 @@ public class ExifInterface {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
Log.w(TAG, "Data format isn't one of expected formats: " + dataFormat);
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Data format isn't one of expected formats: " + dataFormat);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1790,7 +1795,7 @@ public class ExifInterface {
|
|||||||
// ExifInterface.
|
// ExifInterface.
|
||||||
mIsSupportedFile = false;
|
mIsSupportedFile = false;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.w(TAG, "Invalid image: ExifInterface got an unsupported image format file"
|
Log.d(TAG, "Invalid image: ExifInterface got an unsupported image format file"
|
||||||
+ "(ExifInterface supports JPEG and some RAW image formats only) "
|
+ "(ExifInterface supports JPEG and some RAW image formats only) "
|
||||||
+ "or a corrupted JPEG file to ExifInterface.", e);
|
+ "or a corrupted JPEG file to ExifInterface.", e);
|
||||||
}
|
}
|
||||||
@@ -3183,14 +3188,20 @@ public class ExifInterface {
|
|||||||
long byteCount = 0;
|
long byteCount = 0;
|
||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
Log.w(TAG, "Skip the tag entry since tag number is not defined: " + tagNumber);
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Skip the tag entry since tag number is not defined: " + tagNumber);
|
||||||
|
}
|
||||||
} else if (dataFormat <= 0 || dataFormat >= IFD_FORMAT_BYTES_PER_FORMAT.length) {
|
} else if (dataFormat <= 0 || dataFormat >= IFD_FORMAT_BYTES_PER_FORMAT.length) {
|
||||||
Log.w(TAG, "Skip the tag entry since data format is invalid: " + dataFormat);
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Skip the tag entry since data format is invalid: " + dataFormat);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
byteCount = (long) numberOfComponents * IFD_FORMAT_BYTES_PER_FORMAT[dataFormat];
|
byteCount = (long) numberOfComponents * IFD_FORMAT_BYTES_PER_FORMAT[dataFormat];
|
||||||
if (byteCount < 0 || byteCount > Integer.MAX_VALUE) {
|
if (byteCount < 0 || byteCount > Integer.MAX_VALUE) {
|
||||||
Log.w(TAG, "Skip the tag entry since the number of components is invalid: "
|
if (DEBUG) {
|
||||||
+ numberOfComponents);
|
Log.d(TAG, "Skip the tag entry since the number of components is invalid: "
|
||||||
|
+ numberOfComponents);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
@@ -3239,7 +3250,9 @@ public class ExifInterface {
|
|||||||
dataInputStream.seek(offset);
|
dataInputStream.seek(offset);
|
||||||
} else {
|
} else {
|
||||||
// Skip if invalid data offset.
|
// Skip if invalid data offset.
|
||||||
Log.w(TAG, "Skip the tag entry since data offset is invalid: " + offset);
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Skip the tag entry since data offset is invalid: " + offset);
|
||||||
|
}
|
||||||
dataInputStream.seek(nextEntryOffset);
|
dataInputStream.seek(nextEntryOffset);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -3289,11 +3302,15 @@ public class ExifInterface {
|
|||||||
dataInputStream.seek(offset);
|
dataInputStream.seek(offset);
|
||||||
readImageFileDirectory(dataInputStream, nextIfdType);
|
readImageFileDirectory(dataInputStream, nextIfdType);
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Skip jump into the IFD since it has already been read: "
|
if (DEBUG) {
|
||||||
+ "IfdType " + nextIfdType + " (at " + offset + ")");
|
Log.d(TAG, "Skip jump into the IFD since it has already been read: "
|
||||||
|
+ "IfdType " + nextIfdType + " (at " + offset + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Skip jump into the IFD since its offset is invalid: " + offset);
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Skip jump into the IFD since its offset is invalid: " + offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dataInputStream.seek(nextEntryOffset);
|
dataInputStream.seek(nextEntryOffset);
|
||||||
@@ -3348,12 +3365,16 @@ public class ExifInterface {
|
|||||||
readImageFileDirectory(dataInputStream, IFD_TYPE_PREVIEW);
|
readImageFileDirectory(dataInputStream, IFD_TYPE_PREVIEW);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Stop reading file since re-reading an IFD may cause an "
|
if (DEBUG) {
|
||||||
+ "infinite loop: " + nextIfdOffset);
|
Log.d(TAG, "Stop reading file since re-reading an IFD may cause an "
|
||||||
|
+ "infinite loop: " + nextIfdOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Stop reading file since a wrong offset may cause an infinite loop: "
|
if (DEBUG) {
|
||||||
+ nextIfdOffset);
|
Log.d(TAG, "Stop reading file since a wrong offset may cause an infinite loop: "
|
||||||
|
+ nextIfdOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user