Merge "Document that Log can quietly swallow UnknownHostExceptions." am: 9d01845696

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1873073

Change-Id: Ie844b6702567a50388f4ff62e9bc28dbebdd4e81
This commit is contained in:
Jonathan Lepage
2021-11-16 00:39:41 +00:00
committed by Automerger Merge Worker

View File

@@ -62,6 +62,10 @@ import java.net.UnknownHostException;
* another buffer allocation and copy, and even more pressure on the gc. * another buffer allocation and copy, and even more pressure on the gc.
* That means that if your log message is filtered out, you might be doing * That means that if your log message is filtered out, you might be doing
* significant work and incurring significant overhead. * significant work and incurring significant overhead.
*
* <p>When calling the log methods that take a Throwable parameter,
* if any of the throwables in the cause chain is an <code>UnknownHostException</code>,
* then the stack trace is not logged.
*/ */
public final class Log { public final class Log {
/** @hide */ /** @hide */
@@ -341,6 +345,9 @@ public final class Log {
/** /**
* Handy function to get a loggable stack trace from a Throwable * Handy function to get a loggable stack trace from a Throwable
* <p>If any of the throwables in the cause chain is an <code>UnknownHostException</code>,
* this returns an empty string.
* @param tr An exception to log * @param tr An exception to log
*/ */
@NonNull @NonNull