diff options
author | Alan Viverette <alanv@google.com> | 2015-03-09 22:53:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-09 22:53:55 +0000 |
commit | f44b94c2adefae7b54bb60cce72a73e9a95a55cf (patch) | |
tree | 1020461fdb59615b3e417ecf54ab48405d5c7852 /core | |
parent | 488caeb70293b7c70e9ce128fc002a0666340fb0 (diff) | |
parent | 93795053da04b0f16dadb6e56f6056bd2dd37875 (diff) | |
download | frameworks_base-f44b94c2adefae7b54bb60cce72a73e9a95a55cf.zip frameworks_base-f44b94c2adefae7b54bb60cce72a73e9a95a55cf.tar.gz frameworks_base-f44b94c2adefae7b54bb60cce72a73e9a95a55cf.tar.bz2 |
Merge "Make TypedArray and LayoutInflater exceptions more useful"
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/content/res/TypedArray.java | 32 | ||||
-rw-r--r-- | core/java/android/view/LayoutInflater.java | 4 |
2 files changed, 25 insertions, 11 deletions
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java index 410849a..1fca920 100644 --- a/core/java/android/content/res/TypedArray.java +++ b/core/java/android/content/res/TypedArray.java @@ -444,8 +444,10 @@ public class TypedArray { } return defValue; } else if (type == TypedValue.TYPE_ATTRIBUTE) { + final TypedValue value = mValue; + getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value); 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" @@ -480,7 +482,7 @@ public class TypedArray { if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) { if (value.type == TypedValue.TYPE_ATTRIBUTE) { 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); } @@ -516,8 +518,10 @@ public class TypedArray { && type <= TypedValue.TYPE_LAST_INT) { return data[index+AssetManager.STYLE_DATA]; } else if (type == TypedValue.TYPE_ATTRIBUTE) { + final TypedValue value = mValue; + getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value); 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" @@ -560,8 +564,10 @@ public class TypedArray { return TypedValue.complexToDimension( data[index + AssetManager.STYLE_DATA], mMetrics); } else if (type == TypedValue.TYPE_ATTRIBUTE) { + final TypedValue value = mValue; + getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value); 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" @@ -605,8 +611,10 @@ public class TypedArray { return TypedValue.complexToDimensionPixelOffset( data[index + AssetManager.STYLE_DATA], mMetrics); } else if (type == TypedValue.TYPE_ATTRIBUTE) { + final TypedValue value = mValue; + getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value); 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" @@ -651,8 +659,10 @@ public class TypedArray { return TypedValue.complexToDimensionPixelSize( data[index+AssetManager.STYLE_DATA], mMetrics); } else if (type == TypedValue.TYPE_ATTRIBUTE) { + final TypedValue value = mValue; + getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value); 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" @@ -692,8 +702,10 @@ public class TypedArray { return TypedValue.complexToDimensionPixelSize( data[index+AssetManager.STYLE_DATA], mMetrics); } else if (type == TypedValue.TYPE_ATTRIBUTE) { + final TypedValue value = mValue; + getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value); throw new UnsupportedOperationException( - "Failed to resolve attribute at index " + index); + "Failed to resolve attribute at index " + index + ": " + value); } throw new UnsupportedOperationException(getPositionDescription() @@ -765,8 +777,10 @@ public class TypedArray { return TypedValue.complexToFraction( data[index+AssetManager.STYLE_DATA], base, pbase); } else if (type == TypedValue.TYPE_ATTRIBUTE) { + final TypedValue value = mValue; + getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value); 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" @@ -853,7 +867,7 @@ public class TypedArray { if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) { if (value.type == TypedValue.TYPE_ATTRIBUTE) { 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); } diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java index 1014573..1a07aee 100644 --- a/core/java/android/view/LayoutInflater.java +++ b/core/java/android/view/LayoutInflater.java @@ -532,10 +532,10 @@ public abstract class LayoutInflater { InflateException ex = new InflateException(e.getMessage()); ex.initCause(e); throw ex; - } catch (IOException e) { + } catch (Exception e) { InflateException ex = new InflateException( parser.getPositionDescription() - + ": " + e.getMessage()); + + ": " + e.getMessage()); ex.initCause(e); throw ex; } finally { |