Loading core/java/android/view/LayoutInflater.java +28 −13 Original line number Diff line number Diff line Loading @@ -714,7 +714,8 @@ public abstract class LayoutInflater { ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; } catch (Exception e) { final InflateException ie = new InflateException(parser.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(inflaterContext, attrs) + ": " + e.getMessage(), e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; Loading @@ -730,6 +731,16 @@ public abstract class LayoutInflater { } } private static String getParserStateDescription(Context context, AttributeSet attrs) { int sourceResId = Resources.getAttributeSetSourceResId(attrs); if (sourceResId == Resources.ID_NULL) { return attrs.getPositionDescription(); } else { return attrs.getPositionDescription() + " in " + context.getResources().getResourceName(sourceResId); } } private static final ClassLoader BOOT_CLASS_LOADER = LayoutInflater.class.getClassLoader(); private final boolean verifyClassLoader(Constructor<? extends View> constructor) { Loading Loading @@ -818,7 +829,7 @@ public abstract class LayoutInflater { if (mFilter != null && clazz != null) { boolean allowed = mFilter.onLoadClass(clazz); if (!allowed) { failNotAllowed(name, prefix, attrs); failNotAllowed(name, prefix, viewContext, attrs); } } constructor = clazz.getConstructor(mConstructorSignature); Loading @@ -837,10 +848,10 @@ public abstract class LayoutInflater { boolean allowed = clazz != null && mFilter.onLoadClass(clazz); mFilterMap.put(name, allowed); if (!allowed) { failNotAllowed(name, prefix, attrs); failNotAllowed(name, prefix, viewContext, attrs); } } else if (allowedState.equals(Boolean.FALSE)) { failNotAllowed(name, prefix, attrs); failNotAllowed(name, prefix, viewContext, attrs); } } } Loading @@ -862,14 +873,16 @@ public abstract class LayoutInflater { mConstructorArgs[0] = lastContext; } } catch (NoSuchMethodException e) { final InflateException ie = new InflateException(attrs.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(viewContext, attrs) + ": Error inflating class " + (prefix != null ? (prefix + name) : name), e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; } catch (ClassCastException e) { // If loaded class is not a View subclass final InflateException ie = new InflateException(attrs.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(viewContext, attrs) + ": Class is not a View " + (prefix != null ? (prefix + name) : name), e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; Loading @@ -878,7 +891,7 @@ public abstract class LayoutInflater { throw e; } catch (Exception e) { final InflateException ie = new InflateException( attrs.getPositionDescription() + ": Error inflating class " getParserStateDescription(viewContext, attrs) + ": Error inflating class " + (clazz == null ? "<unknown>" : clazz.getName()), e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; Loading @@ -890,8 +903,8 @@ public abstract class LayoutInflater { /** * Throw an exception because the specified class is not allowed to be inflated. */ private void failNotAllowed(String name, String prefix, AttributeSet attrs) { throw new InflateException(attrs.getPositionDescription() private void failNotAllowed(String name, String prefix, Context context, AttributeSet attrs) { throw new InflateException(getParserStateDescription(context, attrs) + ": Class not allowed to be inflated "+ (prefix != null ? (prefix + name) : name)); } Loading Loading @@ -1013,13 +1026,15 @@ public abstract class LayoutInflater { throw e; } catch (ClassNotFoundException e) { final InflateException ie = new InflateException(attrs.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(context, attrs) + ": Error inflating class " + name, e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; } catch (Exception e) { final InflateException ie = new InflateException(attrs.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(context, attrs) + ": Error inflating class " + name, e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; Loading Loading @@ -1215,8 +1230,8 @@ public abstract class LayoutInflater { } if (type != XmlPullParser.START_TAG) { throw new InflateException(childParser.getPositionDescription() + ": No start tag found!"); throw new InflateException(getParserStateDescription(context, childAttrs) + ": No start tag found!"); } final String childName = childParser.getName(); Loading Loading
core/java/android/view/LayoutInflater.java +28 −13 Original line number Diff line number Diff line Loading @@ -714,7 +714,8 @@ public abstract class LayoutInflater { ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; } catch (Exception e) { final InflateException ie = new InflateException(parser.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(inflaterContext, attrs) + ": " + e.getMessage(), e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; Loading @@ -730,6 +731,16 @@ public abstract class LayoutInflater { } } private static String getParserStateDescription(Context context, AttributeSet attrs) { int sourceResId = Resources.getAttributeSetSourceResId(attrs); if (sourceResId == Resources.ID_NULL) { return attrs.getPositionDescription(); } else { return attrs.getPositionDescription() + " in " + context.getResources().getResourceName(sourceResId); } } private static final ClassLoader BOOT_CLASS_LOADER = LayoutInflater.class.getClassLoader(); private final boolean verifyClassLoader(Constructor<? extends View> constructor) { Loading Loading @@ -818,7 +829,7 @@ public abstract class LayoutInflater { if (mFilter != null && clazz != null) { boolean allowed = mFilter.onLoadClass(clazz); if (!allowed) { failNotAllowed(name, prefix, attrs); failNotAllowed(name, prefix, viewContext, attrs); } } constructor = clazz.getConstructor(mConstructorSignature); Loading @@ -837,10 +848,10 @@ public abstract class LayoutInflater { boolean allowed = clazz != null && mFilter.onLoadClass(clazz); mFilterMap.put(name, allowed); if (!allowed) { failNotAllowed(name, prefix, attrs); failNotAllowed(name, prefix, viewContext, attrs); } } else if (allowedState.equals(Boolean.FALSE)) { failNotAllowed(name, prefix, attrs); failNotAllowed(name, prefix, viewContext, attrs); } } } Loading @@ -862,14 +873,16 @@ public abstract class LayoutInflater { mConstructorArgs[0] = lastContext; } } catch (NoSuchMethodException e) { final InflateException ie = new InflateException(attrs.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(viewContext, attrs) + ": Error inflating class " + (prefix != null ? (prefix + name) : name), e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; } catch (ClassCastException e) { // If loaded class is not a View subclass final InflateException ie = new InflateException(attrs.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(viewContext, attrs) + ": Class is not a View " + (prefix != null ? (prefix + name) : name), e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; Loading @@ -878,7 +891,7 @@ public abstract class LayoutInflater { throw e; } catch (Exception e) { final InflateException ie = new InflateException( attrs.getPositionDescription() + ": Error inflating class " getParserStateDescription(viewContext, attrs) + ": Error inflating class " + (clazz == null ? "<unknown>" : clazz.getName()), e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; Loading @@ -890,8 +903,8 @@ public abstract class LayoutInflater { /** * Throw an exception because the specified class is not allowed to be inflated. */ private void failNotAllowed(String name, String prefix, AttributeSet attrs) { throw new InflateException(attrs.getPositionDescription() private void failNotAllowed(String name, String prefix, Context context, AttributeSet attrs) { throw new InflateException(getParserStateDescription(context, attrs) + ": Class not allowed to be inflated "+ (prefix != null ? (prefix + name) : name)); } Loading Loading @@ -1013,13 +1026,15 @@ public abstract class LayoutInflater { throw e; } catch (ClassNotFoundException e) { final InflateException ie = new InflateException(attrs.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(context, attrs) + ": Error inflating class " + name, e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; } catch (Exception e) { final InflateException ie = new InflateException(attrs.getPositionDescription() final InflateException ie = new InflateException( getParserStateDescription(context, attrs) + ": Error inflating class " + name, e); ie.setStackTrace(EMPTY_STACK_TRACE); throw ie; Loading Loading @@ -1215,8 +1230,8 @@ public abstract class LayoutInflater { } if (type != XmlPullParser.START_TAG) { throw new InflateException(childParser.getPositionDescription() + ": No start tag found!"); throw new InflateException(getParserStateDescription(context, childAttrs) + ": No start tag found!"); } final String childName = childParser.getName(); Loading