Don't try to output really long URLs HTML5Audio exception handler.

If we catch an IOException in HTML5Audio.setDataSource, do not try
and output the URL if it's really long as this will likely lead to
an OOM exception being thrown.

Bug: 3486963
Change-Id: If10a489b03ec215e078490a81910b02d68190612
This commit is contained in:
Ben Murdoch
2011-02-28 16:15:33 +00:00
parent d2e91d1dc7
commit 35381518d0

View File

@@ -173,7 +173,8 @@ class HTML5Audio extends Handler
mState = INITIALIZED;
mMediaPlayer.prepareAsync();
} catch (IOException e) {
Log.e(LOGTAG, "couldn't load the resource: " + url + " exc: " + e);
String debugUrl = url.length() > 128 ? url.substring(0, 128) + "..." : url;
Log.e(LOGTAG, "couldn't load the resource: "+ debugUrl +" exc: " + e);
resetMediaPlayer();
}
}