Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f44b94c2 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Make TypedArray and LayoutInflater exceptions more useful"

parents 488caeb7 93795053
Loading
Loading
Loading
Loading
+23 −9
Original line number Original line Diff line number Diff line
@@ -444,8 +444,10 @@ public class TypedArray {
            }
            }
            return defValue;
            return defValue;
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
            final TypedValue value = mValue;
            getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value);
            throw new UnsupportedOperationException(
            throw new UnsupportedOperationException(
                    "Failed to resolve attribute at index " + index);
                    "Failed to resolve attribute at index " + index + ": " + value);
        }
        }


        throw new UnsupportedOperationException("Can't convert to color: type=0x"
        throw new UnsupportedOperationException("Can't convert to color: type=0x"
@@ -480,7 +482,7 @@ public class TypedArray {
        if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) {
        if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) {
            if (value.type == TypedValue.TYPE_ATTRIBUTE) {
            if (value.type == TypedValue.TYPE_ATTRIBUTE) {
                throw new UnsupportedOperationException(
                throw new UnsupportedOperationException(
                        "Failed to resolve attribute at index " + index);
                        "Failed to resolve attribute at index " + index + ": " + value);
            }
            }
            return mResources.loadColorStateList(value, value.resourceId, mTheme);
            return mResources.loadColorStateList(value, value.resourceId, mTheme);
        }
        }
@@ -516,8 +518,10 @@ public class TypedArray {
                && type <= TypedValue.TYPE_LAST_INT) {
                && type <= TypedValue.TYPE_LAST_INT) {
            return data[index+AssetManager.STYLE_DATA];
            return data[index+AssetManager.STYLE_DATA];
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
            final TypedValue value = mValue;
            getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value);
            throw new UnsupportedOperationException(
            throw new UnsupportedOperationException(
                    "Failed to resolve attribute at index " + index);
                    "Failed to resolve attribute at index " + index + ": " + value);
        }
        }


        throw new UnsupportedOperationException("Can't convert to integer: type=0x"
        throw new UnsupportedOperationException("Can't convert to integer: type=0x"
@@ -560,8 +564,10 @@ public class TypedArray {
            return TypedValue.complexToDimension(
            return TypedValue.complexToDimension(
                    data[index + AssetManager.STYLE_DATA], mMetrics);
                    data[index + AssetManager.STYLE_DATA], mMetrics);
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
            final TypedValue value = mValue;
            getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value);
            throw new UnsupportedOperationException(
            throw new UnsupportedOperationException(
                    "Failed to resolve attribute at index " + index);
                    "Failed to resolve attribute at index " + index + ": " + value);
        }
        }


        throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
        throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
@@ -605,8 +611,10 @@ public class TypedArray {
            return TypedValue.complexToDimensionPixelOffset(
            return TypedValue.complexToDimensionPixelOffset(
                    data[index + AssetManager.STYLE_DATA], mMetrics);
                    data[index + AssetManager.STYLE_DATA], mMetrics);
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
            final TypedValue value = mValue;
            getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value);
            throw new UnsupportedOperationException(
            throw new UnsupportedOperationException(
                    "Failed to resolve attribute at index " + index);
                    "Failed to resolve attribute at index " + index + ": " + value);
        }
        }


        throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
        throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
@@ -651,8 +659,10 @@ public class TypedArray {
            return TypedValue.complexToDimensionPixelSize(
            return TypedValue.complexToDimensionPixelSize(
                data[index+AssetManager.STYLE_DATA], mMetrics);
                data[index+AssetManager.STYLE_DATA], mMetrics);
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
            final TypedValue value = mValue;
            getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value);
            throw new UnsupportedOperationException(
            throw new UnsupportedOperationException(
                    "Failed to resolve attribute at index " + index);
                    "Failed to resolve attribute at index " + index + ": " + value);
        }
        }


        throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
        throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
@@ -692,8 +702,10 @@ public class TypedArray {
            return TypedValue.complexToDimensionPixelSize(
            return TypedValue.complexToDimensionPixelSize(
                data[index+AssetManager.STYLE_DATA], mMetrics);
                data[index+AssetManager.STYLE_DATA], mMetrics);
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
            final TypedValue value = mValue;
            getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value);
            throw new UnsupportedOperationException(
            throw new UnsupportedOperationException(
                    "Failed to resolve attribute at index " + index);
                    "Failed to resolve attribute at index " + index + ": " + value);
        }
        }


        throw new UnsupportedOperationException(getPositionDescription()
        throw new UnsupportedOperationException(getPositionDescription()
@@ -765,8 +777,10 @@ public class TypedArray {
            return TypedValue.complexToFraction(
            return TypedValue.complexToFraction(
                data[index+AssetManager.STYLE_DATA], base, pbase);
                data[index+AssetManager.STYLE_DATA], base, pbase);
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
        } else if (type == TypedValue.TYPE_ATTRIBUTE) {
            final TypedValue value = mValue;
            getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value);
            throw new UnsupportedOperationException(
            throw new UnsupportedOperationException(
                    "Failed to resolve attribute at index " + index);
                    "Failed to resolve attribute at index " + index + ": " + value);
        }
        }


        throw new UnsupportedOperationException("Can't convert to fraction: type=0x"
        throw new UnsupportedOperationException("Can't convert to fraction: type=0x"
@@ -853,7 +867,7 @@ public class TypedArray {
        if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) {
        if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) {
            if (value.type == TypedValue.TYPE_ATTRIBUTE) {
            if (value.type == TypedValue.TYPE_ATTRIBUTE) {
                throw new UnsupportedOperationException(
                throw new UnsupportedOperationException(
                        "Failed to resolve attribute at index " + index);
                        "Failed to resolve attribute at index " + index + ": " + value);
            }
            }
            return mResources.loadDrawable(value, value.resourceId, mTheme);
            return mResources.loadDrawable(value, value.resourceId, mTheme);
        }
        }
+2 −2
Original line number Original line Diff line number Diff line
@@ -532,7 +532,7 @@ public abstract class LayoutInflater {
                InflateException ex = new InflateException(e.getMessage());
                InflateException ex = new InflateException(e.getMessage());
                ex.initCause(e);
                ex.initCause(e);
                throw ex;
                throw ex;
            } catch (IOException e) {
            } catch (Exception e) {
                InflateException ex = new InflateException(
                InflateException ex = new InflateException(
                        parser.getPositionDescription()
                        parser.getPositionDescription()
                                + ": " + e.getMessage());
                                + ": " + e.getMessage());