am f7ee988e: Merge "Better error logs for faulty ObjectAnimators" into jb-dev
* commit 'f7ee988e55c6f6934cbb9e47feea65e62a3a2f21': Better error logs for faulty ObjectAnimators
This commit is contained in:
@@ -384,8 +384,7 @@ public class PropertyValuesHolder implements Cloneable {
|
|||||||
try {
|
try {
|
||||||
returnVal = targetClass.getMethod(methodName, args);
|
returnVal = targetClass.getMethod(methodName, args);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
Log.e("PropertyValuesHolder",
|
// Swallow the error, log it later
|
||||||
"Couldn't find no-arg method for property " + mPropertyName + ": " + e);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
args = new Class[1];
|
args = new Class[1];
|
||||||
@@ -412,9 +411,12 @@ public class PropertyValuesHolder implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If we got here, then no appropriate function was found
|
// If we got here, then no appropriate function was found
|
||||||
Log.e("PropertyValuesHolder",
|
}
|
||||||
"Couldn't find setter/getter for property " + mPropertyName +
|
|
||||||
" with value type "+ mValueType);
|
if (returnVal == null) {
|
||||||
|
Log.w("PropertyValuesHolder", "Method " +
|
||||||
|
getMethodName(prefix, mPropertyName) + "() with type " + mValueType +
|
||||||
|
" not found on target class " + targetClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnVal;
|
return returnVal;
|
||||||
@@ -495,7 +497,7 @@ public class PropertyValuesHolder implements Cloneable {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
Log.e("PropertyValuesHolder","No such property (" + mProperty.getName() +
|
Log.w("PropertyValuesHolder","No such property (" + mProperty.getName() +
|
||||||
") on target object " + target + ". Trying reflection instead");
|
") on target object " + target + ". Trying reflection instead");
|
||||||
mProperty = null;
|
mProperty = null;
|
||||||
}
|
}
|
||||||
@@ -508,6 +510,10 @@ public class PropertyValuesHolder implements Cloneable {
|
|||||||
if (!kf.hasValue()) {
|
if (!kf.hasValue()) {
|
||||||
if (mGetter == null) {
|
if (mGetter == null) {
|
||||||
setupGetter(targetClass);
|
setupGetter(targetClass);
|
||||||
|
if (mGetter == null) {
|
||||||
|
// Already logged the error - just return to avoid NPE
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
kf.setValue(mGetter.invoke(target));
|
kf.setValue(mGetter.invoke(target));
|
||||||
@@ -535,6 +541,10 @@ public class PropertyValuesHolder implements Cloneable {
|
|||||||
if (mGetter == null) {
|
if (mGetter == null) {
|
||||||
Class targetClass = target.getClass();
|
Class targetClass = target.getClass();
|
||||||
setupGetter(targetClass);
|
setupGetter(targetClass);
|
||||||
|
if (mGetter == null) {
|
||||||
|
// Already logged the error - just return to avoid NPE
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
kf.setValue(mGetter.invoke(target));
|
kf.setValue(mGetter.invoke(target));
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
@@ -854,8 +864,9 @@ public class PropertyValuesHolder implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError e) {
|
||||||
Log.d("PropertyValuesHolder",
|
// Couldn't find it via JNI - try reflection next. Probably means the method
|
||||||
"Can't find native method using JNI, use reflection" + e);
|
// doesn't exist, or the type is wrong. An error will be logged later if
|
||||||
|
// reflection fails as well.
|
||||||
} finally {
|
} finally {
|
||||||
mPropertyMapLock.writeLock().unlock();
|
mPropertyMapLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
@@ -990,8 +1001,9 @@ public class PropertyValuesHolder implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError e) {
|
||||||
Log.d("PropertyValuesHolder",
|
// Couldn't find it via JNI - try reflection next. Probably means the method
|
||||||
"Can't find native method using JNI, use reflection" + e);
|
// doesn't exist, or the type is wrong. An error will be logged later if
|
||||||
|
// reflection fails as well.
|
||||||
} finally {
|
} finally {
|
||||||
mPropertyMapLock.writeLock().unlock();
|
mPropertyMapLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user