Index: base/android/java/src/org/chromium/base/ApkAssets.java |
diff --git a/base/android/java/src/org/chromium/base/ApkAssets.java b/base/android/java/src/org/chromium/base/ApkAssets.java |
index e00be9924b4e0da679581549f83feab7663063c5..f3c89f30e06200bad2e4f3c63ffe3d3d7a4fc56e 100644 |
--- a/base/android/java/src/org/chromium/base/ApkAssets.java |
+++ b/base/android/java/src/org/chromium/base/ApkAssets.java |
@@ -33,7 +33,19 @@ public class ApkAssets { |
afd.getStartOffset(), |
afd.getLength() }; |
} catch (IOException e) { |
- Log.e(LOGTAG, "Error while loading asset " + fileName + ": " + e); |
+ // As a general rule there's no point logging here because the caller should handle |
+ // receiving an fd of -1 sensibly, and the log message is either mirrored later, or |
+ // unwanted (in the case where a missing file is expected), or wanted but will be |
+ // ignored, as most non-fatal logs are. |
+ // It makes sense to log here when the file exists, but is unable to be opened as an fd |
+ // because (for example) it is unexpectedly compressed in an apk. In that case, the log |
+ // message might save someone some time working out what has gone wrong. |
+ // For that reason, we only suppress the message when the exception message doesn't look |
+ // informative (Android framework passes the filename as the message on actual file not |
+ // found, and the empty string also wouldn't give any useful information for debugging). |
+ if (!e.getMessage().equals("") && !e.getMessage().equals(fileName)) { |
+ Log.e(LOGTAG, "Error while loading asset " + fileName + ": " + e); |
+ } |
return new long[] {-1, -1, -1}; |
} finally { |
try { |