Loading core/java/android/content/res/Resources.java +77 −59 Original line number Diff line number Diff line Loading @@ -2421,6 +2421,7 @@ public class Resources { @Nullable Drawable loadDrawable(TypedValue value, int id, Theme theme) throws NotFoundException { try { if (TRACE_FOR_PRELOAD) { // Log only framework resources if ((id >>> 24) == 0x1) { Loading Loading @@ -2490,6 +2491,23 @@ public class Resources { } return dr; } catch (Exception e) { String name; try { name = getResourceName(id); } catch (NotFoundException e2) { name = "(missing name)"; } // The target drawable might fail to load for any number of // reasons, but we always want to include the resource name. // Since the client already expects this method to throw a // NotFoundException, just throw one of those. final NotFoundException nfe = new NotFoundException("Drawable " + name + " with resource ID #0x" + Integer.toHexString(id), e); nfe.setStackTrace(new StackTraceElement[0]); throw nfe; } } private void cacheDrawable(TypedValue value, boolean isColorDrawable, DrawableCache caches, Loading graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ public class AnimatedRotateDrawable extends DrawableWrapper implements Animatabl updateStateFromTypedArray(a); verifyRequiredAttributes(a); } catch (XmlPullParserException e) { throw new RuntimeException(e); rethrowAsRuntimeException(e); } finally { a.recycle(); } Loading graphics/java/android/graphics/drawable/BitmapDrawable.java +1 −1 Original line number Diff line number Diff line Loading @@ -829,7 +829,7 @@ public class BitmapDrawable extends Drawable { try { updateStateFromTypedArray(a); } catch (XmlPullParserException e) { throw new RuntimeException(e); rethrowAsRuntimeException(e); } finally { a.recycle(); } Loading graphics/java/android/graphics/drawable/ClipDrawable.java +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ public class ClipDrawable extends DrawableWrapper { updateStateFromTypedArray(a); verifyRequiredAttributes(a); } catch (XmlPullParserException e) { throw new RuntimeException(e); rethrowAsRuntimeException(e); } finally { a.recycle(); } Loading graphics/java/android/graphics/drawable/Drawable.java +14 −0 Original line number Diff line number Diff line Loading @@ -1429,6 +1429,20 @@ public abstract class Drawable { return densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } /** * Re-throws an exception as a {@link RuntimeException} with an empty stack * trace to avoid cluttering the log. The original exception's stack trace * will still be included. * * @param cause the exception to re-throw * @throws RuntimeException */ static void rethrowAsRuntimeException(Exception cause) throws RuntimeException { final RuntimeException e = new RuntimeException(cause); e.setStackTrace(new StackTraceElement[0]); throw e; } /** * Parses a {@link android.graphics.PorterDuff.Mode} from a tintMode * attribute's enum value. Loading Loading
core/java/android/content/res/Resources.java +77 −59 Original line number Diff line number Diff line Loading @@ -2421,6 +2421,7 @@ public class Resources { @Nullable Drawable loadDrawable(TypedValue value, int id, Theme theme) throws NotFoundException { try { if (TRACE_FOR_PRELOAD) { // Log only framework resources if ((id >>> 24) == 0x1) { Loading Loading @@ -2490,6 +2491,23 @@ public class Resources { } return dr; } catch (Exception e) { String name; try { name = getResourceName(id); } catch (NotFoundException e2) { name = "(missing name)"; } // The target drawable might fail to load for any number of // reasons, but we always want to include the resource name. // Since the client already expects this method to throw a // NotFoundException, just throw one of those. final NotFoundException nfe = new NotFoundException("Drawable " + name + " with resource ID #0x" + Integer.toHexString(id), e); nfe.setStackTrace(new StackTraceElement[0]); throw nfe; } } private void cacheDrawable(TypedValue value, boolean isColorDrawable, DrawableCache caches, Loading
graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ public class AnimatedRotateDrawable extends DrawableWrapper implements Animatabl updateStateFromTypedArray(a); verifyRequiredAttributes(a); } catch (XmlPullParserException e) { throw new RuntimeException(e); rethrowAsRuntimeException(e); } finally { a.recycle(); } Loading
graphics/java/android/graphics/drawable/BitmapDrawable.java +1 −1 Original line number Diff line number Diff line Loading @@ -829,7 +829,7 @@ public class BitmapDrawable extends Drawable { try { updateStateFromTypedArray(a); } catch (XmlPullParserException e) { throw new RuntimeException(e); rethrowAsRuntimeException(e); } finally { a.recycle(); } Loading
graphics/java/android/graphics/drawable/ClipDrawable.java +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ public class ClipDrawable extends DrawableWrapper { updateStateFromTypedArray(a); verifyRequiredAttributes(a); } catch (XmlPullParserException e) { throw new RuntimeException(e); rethrowAsRuntimeException(e); } finally { a.recycle(); } Loading
graphics/java/android/graphics/drawable/Drawable.java +14 −0 Original line number Diff line number Diff line Loading @@ -1429,6 +1429,20 @@ public abstract class Drawable { return densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } /** * Re-throws an exception as a {@link RuntimeException} with an empty stack * trace to avoid cluttering the log. The original exception's stack trace * will still be included. * * @param cause the exception to re-throw * @throws RuntimeException */ static void rethrowAsRuntimeException(Exception cause) throws RuntimeException { final RuntimeException e = new RuntimeException(cause); e.setStackTrace(new StackTraceElement[0]); throw e; } /** * Parses a {@link android.graphics.PorterDuff.Mode} from a tintMode * attribute's enum value. Loading