diff options
author | George Mount <mount@google.com> | 2016-02-18 14:33:37 -0800 |
---|---|---|
committer | George Mount <mount@google.com> | 2016-03-08 15:38:00 -0800 |
commit | bb4a033fcd5cd20e5be46ef8ead442dc7db2454d (patch) | |
tree | a6eebe0a848983d8dad5662f674959e7e76b2c80 /compilationTests | |
parent | b7eeedbfadec03792551014e9dfa2bd384fc21a3 (diff) | |
download | data-binding-bb4a033fcd5cd20e5be46ef8ead442dc7db2454d.tar.gz |
Have two-way binding use localized variables to prevent NPE.
Bug 26962999
Two-way binding was using the inverted expressions directly
without localizing variables. That meant that if there was
a variable set to null during evaluation, it may get a
NullPointerException even though it checked for null
on the value previously. This CL localizes the variables
so that cannot happen.
Change-Id: Ia55955ce0f1cb750e6a678e72e0cda03f0e3c9b6
Diffstat (limited to 'compilationTests')
-rw-r--r-- | compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java b/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java index 3525b3a8..68c34245 100644 --- a/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java +++ b/compilationTests/src/test/java/android/databinding/compilationTest/SimpleCompilationTest.java @@ -158,7 +158,7 @@ public class SimpleCompilationTest extends BaseCompilationTest { expectedErrorFile = "/app/src/main/res/layout/broken.xml"; } else if (errorFile.getCanonicalPath().equals(invalidSetter.getCanonicalPath())) { message = String.format(ErrorMessages.CANNOT_FIND_SETTER_CALL, "android:textx", - String.class.getCanonicalName()); + String.class.getCanonicalName(), "android.widget.TextView"); expectedErrorFile = "/app/src/main/res/layout/invalid_setter.xml"; } else { fail("unexpected exception " + exception.getBareMessage()); @@ -208,7 +208,7 @@ public class SimpleCompilationTest extends BaseCompilationTest { ScopedException ex = singleFileErrorTest("/layout/invalid_setter_binding.xml", "/app/src/main/res/layout/invalid_setter.xml", "myVariable", String.format(ErrorMessages.CANNOT_FIND_SETTER_CALL, "android:textx", - String.class.getCanonicalName())); + String.class.getCanonicalName(), "android.widget.TextView")); } @Test @@ -257,7 +257,7 @@ public class SimpleCompilationTest extends BaseCompilationTest { prepareProject(); ScopedException ex = singleFileErrorTest("/layout/invalid_variable_type.xml", "/app/src/main/res/layout/invalid_variable.xml", "myVariable", - String.format(ErrorMessages.CANNOT_RESOLVE_TYPE, "myVariable~")); + String.format(ErrorMessages.CANNOT_RESOLVE_TYPE, "myVariable")); } @Test |