mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Merge pull request #137 from misaochan/fix-filenotfound
Fix crash if FileNotFound exception thrown
This commit is contained in:
commit
158e300e6f
2 changed files with 5 additions and 2 deletions
|
|
@ -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!");
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue