Merge pull request #137 from misaochan/fix-filenotfound

Fix crash if FileNotFound exception thrown
This commit is contained in:
Nicolas Raoul 2016-06-19 22:45:19 +09:00 committed by GitHub
commit 158e300e6f
2 changed files with 5 additions and 2 deletions

View file

@ -163,6 +163,7 @@ public class UploadService extends HandlerService<Contribution> {
return START_REDELIVER_INTENT;
}
private void uploadContribution(Contribution contribution) {
MWApi api = app.getApi();
@ -171,11 +172,12 @@ public class UploadService extends HandlerService<Contribution> {
String notificationTag = contribution.getLocalUri().toString();
try {
file = this.getContentResolver().openInputStream(contribution.getLocalUri());
} catch(FileNotFoundException e) {
throw new RuntimeException(e);
Log.d("Exception", "File not found");
Toast fileNotFound = Toast.makeText(this, R.string.upload_failed, Toast.LENGTH_LONG);
fileNotFound.show();
}
Log.d("Commons", "Before execution!");

View file

@ -10,6 +10,7 @@
<string name="logging_in_message">Please wait...</string>
<string name="login_success">Login success!</string>
<string name="login_failed">Login failed!</string>
<string name="upload_failed">File not found, please try another file</string>
<string name="authentication_failed">Authentication failed!</string>
<string name="uploading_started">Upload started!</string>