mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +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;
|
return START_REDELIVER_INTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void uploadContribution(Contribution contribution) {
|
private void uploadContribution(Contribution contribution) {
|
||||||
MWApi api = app.getApi();
|
MWApi api = app.getApi();
|
||||||
|
|
||||||
|
|
@ -171,11 +172,12 @@ public class UploadService extends HandlerService<Contribution> {
|
||||||
|
|
||||||
String notificationTag = contribution.getLocalUri().toString();
|
String notificationTag = contribution.getLocalUri().toString();
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
file = this.getContentResolver().openInputStream(contribution.getLocalUri());
|
file = this.getContentResolver().openInputStream(contribution.getLocalUri());
|
||||||
} catch(FileNotFoundException e) {
|
} 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!");
|
Log.d("Commons", "Before execution!");
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
<string name="logging_in_message">Please wait...</string>
|
<string name="logging_in_message">Please wait...</string>
|
||||||
<string name="login_success">Login success!</string>
|
<string name="login_success">Login success!</string>
|
||||||
<string name="login_failed">Login failed!</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="authentication_failed">Authentication failed!</string>
|
||||||
<string name="uploading_started">Upload started!</string>
|
<string name="uploading_started">Upload started!</string>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue