(@Nullable Object o)
| 301 | } |
| 302 | |
| 303 | @SuppressWarnings("CatchingUnchecked") // sneaky checked exception |
| 304 | private static String lenientToString(@Nullable Object o) { |
| 305 | if (o == null) { |
| 306 | return "null"; |
| 307 | } |
| 308 | try { |
| 309 | return o.toString(); |
| 310 | } catch (Exception e) { // sneaky checked exception |
| 311 | // Default toString() behavior - see Object.toString() |
| 312 | String objectToString = |
| 313 | o.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(o)); |
| 314 | // Logger is created inline with fixed name to avoid forcing Proguard to create another class. |
| 315 | Logger.getLogger("com.google.common.base.Strings") |
| 316 | .log(WARNING, "Exception during lenientFormat for " + objectToString, e); |
| 317 | return "<" + objectToString + " threw " + e.getClass().getName() + ">"; |
| 318 | } |
| 319 | } |
| 320 | } |
no test coverage detected