aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wong <wongma7@outlook.com>2016-07-29 20:59:31 -0400
committerMatthew Wong <wongma7@outlook.com>2016-07-29 20:59:31 -0400
commitdda1e99a08327b863bd6b4b7e7e2b3aab77bc8cb (patch)
treef5949032a43a90b6501d7b1ac7143b1f6701f8cb
parent33cebc8a497f14e72c52b18545380dfbcd2e788a (diff)
Catch IOException
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java
index e608b5fc..14b6ac59 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java
@@ -495,16 +495,12 @@ public class GitActivity extends AppCompatActivity {
//This is what happens when jgit fails :(
//TODO Handle the diffent cases of exceptions
e.printStackTrace();
- new AlertDialog.Builder(GitActivity.this).
- setMessage(e.getMessage()).
- show();
+ new AlertDialog.Builder(GitActivity.this).setMessage(e.getMessage()).show();
}
} catch (IOException e) {
//TODO Handle the exception correctly if we are unable to delete the directory...
e.printStackTrace();
- new AlertDialog.Builder(GitActivity.this).
- setMessage(e.getMessage()).
- show();
+ new AlertDialog.Builder(GitActivity.this).setMessage(e.getMessage()).show();
}
dialog.cancel();
@@ -523,7 +519,12 @@ public class GitActivity extends AppCompatActivity {
try {
// Silently delete & replace the lone .git folder if it exists
if (localDir.listFiles().length == 1 && localDir.listFiles()[0].getName().equals(".git")) {
- FileUtils.deleteDirectory(localDir);
+ try {
+ FileUtils.deleteDirectory(localDir);
+ } catch (IOException e) {
+ e.printStackTrace();
+ new AlertDialog.Builder(GitActivity.this).setMessage(e.getMessage()).show();
+ }
}
new CloneOperation(localDir, activity)
.setCommand(hostname)
@@ -532,9 +533,7 @@ public class GitActivity extends AppCompatActivity {
//This is what happens when jgit fails :(
//TODO Handle the diffent cases of exceptions
e.printStackTrace();
- new AlertDialog.Builder(this).
- setMessage(e.getMessage()).
- show();
+ new AlertDialog.Builder(this).setMessage(e.getMessage()).show();
}
}
}