]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
OI Safe: catch a couple of NPEs
authorrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Wed, 23 Sep 2009 03:55:36 +0000 (03:55 +0000)
committerrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Wed, 23 Sep 2009 03:55:36 +0000 (03:55 +0000)
git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2307 72b678ce-9140-0410-bee8-679b907dd61a

src/org/openintents/safe/PassList.java
src/org/openintents/safe/Passwords.java
tests/test-procedure.html [new file with mode: 0644]

index f4b9956e3f6f9a84c28d50bc6f9dcc352f1cf306..e3cadb40a23a87a5b419a4ec401785cff5544f22 100644 (file)
@@ -290,10 +290,12 @@ public class PassList extends ListActivity {
                        public void run(){
                                rows=Passwords.getPassEntries(CategoryId, true, true);
                                passDescriptions.clear();
-                               Iterator<PassEntry> passIter=rows.iterator();
-                               while (passIter.hasNext()) {
-                                       PassEntry passEntry=passIter.next();
-                                       passDescriptions.add(passEntry.plainDescription);
+                               if (rows!=null) {
+                                       Iterator<PassEntry> passIter=rows.iterator();
+                                       while (passIter.hasNext()) {
+                                               PassEntry passEntry=passIter.next();
+                                               passDescriptions.add(passEntry.plainDescription);
+                                       }
                                }
 //                             dismissDialog(DECRYPT_PROGRESS_KEY);
                                // forced to removeDialog(), without it
index 231317e0de748bf8089232266bbd41f3f3296f3e..fbd2a770b77ef2c7571b6bcb10f22a5508abe777 100644 (file)
@@ -303,6 +303,9 @@ public class Passwords {
        
        public static PassEntry getPassEntry(Long id, boolean decrypt, boolean descriptionOnly) {
                if (debug) Log.d(TAG,"getPassEntry("+id+")");
+               if ((id==null) || (passEntries==null)) {
+                       return null;
+               }
                PassEntry passEntry=passEntries.get(id);
                if (passEntry==null) {
                        return null;
diff --git a/tests/test-procedure.html b/tests/test-procedure.html
new file mode 100644 (file)
index 0000000..7b3b037
--- /dev/null
@@ -0,0 +1,68 @@
+<html>
+<body>
+<h1>Test Procedure</h1>
+
+<!--
+       This is just my first stab at an enumerated list of things to test for.
+       Randy
+-->
+<ol>
+<li>Uninstall OI Safe from emulator or device:
+<pre>
+adb uninstall org.openintents.safe
+</pre>
+<p>You may want to Backup the database first with Menu->Backup</p>
+</li>
+
+<li>Install OI Safe and launch.
+<p>In Eclipse: right-click project OI Safe -> Run As -> Android Application</p>
+<p>Or if build-private.properties is configured: project OI Safe -> (right-click)
+build.xml -> Run As -> Ant Build</p>
+</li>
+
+<li>
+<p>Launch OI Safe. Should be presented with EULA.  Hit Cancel.  Application should quit.</p>
+</li>
+
+<li>
+<p>Launch OI Safe.  At EULA, hit Accept.  Should be presented with
+AskPassword activity asking to create Master Password.
+Leave fields empty.</p>
+</li>
+
+<li>Hit Continue.  Toast should remind user to provide at
+least 4 characters of password.</li>
+
+<li>Type password in Master Password, leave Confirm empty.  Hit Continue.
+Toast should tell user that passwords do not match.</li>
+
+<li>Type correct password into Continue field.  Hit Continue.
+CategoryList should activiate with a dialog letting user know that
+they should backup.   Hit OK.
+</li>
+
+<li>At CategoryList, hit Menu->Add.  CategoryEdit should launch.</li>
+
+<li>Leave blank and hit Save.  Toast should complain about being empty.
+Provide a name and hit Save.  Should fall back to CategoryList with the new
+category in the list.</li>
+
+<li>Long-click the newly created category and hit Delete.   Because it's empty
+it should disappear from the list.</li>
+
+
+<li>Uninstall OI Safe and reinstall.  Launch.   Instead of providing a new Master
+Password, hit Restore.  Restore Activity should launch.
+</li>
+
+<li>Provide wrong password for oisafe.xml.  Hit Restore.  Toast should indicate bad password.
+</li>
+
+<li>Provide correct password for oisafe.xml.  Hit Restore.  Dialog should prompt to overwrite
+existing data.  Hit No.  Should drop back.  Hit Restore and hit Yes.  CategoryList 
+should launch with restored data.</li>
+
+</ol>
+
+</body>
+</html>