Bug 782242 - Robocop: be more careful when using Java reflection; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Thu, 23 Aug 2012 10:47:55 -0600
changeset 103169 fcf13879b58754bac6f084d0cf340398113bc2f9
parent 103168 c0bf8f74341984843682b8c0eeb1518deebc540d
child 103170 5853a841672ebbdd4f45e8d05610af903a4353d1
push id13858
push usergbrown@mozilla.com
push dateThu, 23 Aug 2012 16:48:18 +0000
treeherdermozilla-inbound@fcf13879b587 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs782242
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 782242 - Robocop: be more careful when using Java reflection; r=jmaher
mobile/android/base/tests/ContentProviderTest.java.in
mobile/android/base/tests/testCheck2.java.in
mobile/android/base/tests/testCheck3.java.in
--- a/mobile/android/base/tests/ContentProviderTest.java.in
+++ b/mobile/android/base/tests/ContentProviderTest.java.in
@@ -227,23 +227,22 @@ abstract class ContentProviderTest exten
     }
 
     public void tearDown() throws Exception {
         if (Build.VERSION.SDK_INT >= 11) {
             mProvider.shutdown();
         }
 
         String databaseName = null;
-        try {
-            Method getDatabasePath =
-                    mProviderClass.getDeclaredMethod("getDatabasePath", String.class, boolean.class);
+        Method getDatabasePath =
+                mProviderClass.getDeclaredMethod("getDatabasePath", String.class, boolean.class);
 
-            String defaultProfile = "default";
-            databaseName = (String) getDatabasePath.invoke(mProvider, defaultProfile, true /* is test */);
-        } catch (Exception e) {}
+        String defaultProfile = "default";
+        ContentProvider targetProvider = (ContentProvider) mProviderClass.newInstance();
+        databaseName = (String) getDatabasePath.invoke(targetProvider, defaultProfile, true /* is test */);
 
         if (databaseName != null)
             mProviderContext.deleteDatabase(databaseName);
 
         super.tearDown();
     }
 
     public AssetManager getAssetManager()  {
--- a/mobile/android/base/tests/testCheck2.java.in
+++ b/mobile/android/base/tests/testCheck2.java.in
@@ -36,17 +36,17 @@ public class testCheck2 extends PixelTes
         mDriver.startCheckerboardRecording();
         // replay the events
         try {
             mer.replayEvents(getAsset("testcheck2-motionevents"));
             // give it some time to draw any final frames
             Thread.sleep(1000);
             completeness = mDriver.stopCheckerboardRecording();
         } catch (Exception e) {
-            mAsserter.dumpLog("Exception while replaying events", e);
+            mAsserter.ok(false, "Exception while replaying events", e.toString());
         }
 
         mAsserter.dumpLog("__start_report" + completeness + "__end_report");
         System.out.println("Completeness score: " + completeness);
         long msecs = System.currentTimeMillis();
         mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp");
     }
 }
--- a/mobile/android/base/tests/testCheck3.java.in
+++ b/mobile/android/base/tests/testCheck3.java.in
@@ -47,17 +47,17 @@ public class testCheck3 extends PixelTes
         mDriver.startCheckerboardRecording();
         // replay the events
         try {
             mer.replayEvents(getAsset("testcheck2-motionevents"));
             // give it some time to draw any final frames
             Thread.sleep(1000);
             completeness = mDriver.stopCheckerboardRecording();
         } catch (Exception e) {
-            mAsserter.dumpLog("Exception while replaying events", e);
+            mAsserter.ok(false, "Exception while replaying events", e.toString());
         }
 
         mAsserter.dumpLog("__start_report" + completeness + "__end_report");
         System.out.println("Completeness score: " + completeness);
         long msecs = System.currentTimeMillis();
         mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp");
     }