Skip to content
This repository has been archived by the owner on May 2, 2021. It is now read-only.

Commit

Permalink
don't attempt to upload if log file is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
tjanson committed Mar 15, 2015
1 parent cd9c1f7 commit 0c4c6d1
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions app/src/main/java/com/tomjanson/wifilocationlogger/Uploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,28 @@ public static void upload(final MainActivity m, String pathToFile) {
RequestParams params = new RequestParams();
try {
params.put(targetFilename, file);

post(m.uploadUrlET.getText().toString(), params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Toast.makeText(m, m.getString(R.string.upload_successful), Toast.LENGTH_LONG).show();
m.log.info("Upload success, statusCode: " + statusCode);
//m.onUploadSuccess(statusCode, headers, responseBody);
}

@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Toast.makeText(m, m.getString(R.string.upload_failed), Toast.LENGTH_LONG).show();
m.log.warn("Upload failure, statusCode: " + statusCode);
if (error != null) {
m.log.error("Throwable error = {}", error);
}
//m.onUploadFailure(statusCode, headers, responseBody, error);
}
});
} catch(FileNotFoundException e) {
Toast.makeText(m, m.getString(R.string.upload_file_not_found), Toast.LENGTH_LONG).show();
m.log.error("FileNotFoundException e = {}", e);
}

post(m.uploadUrlET.getText().toString(), params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Toast.makeText(m, m.getString(R.string.upload_successful), Toast.LENGTH_LONG).show();
m.log.info("Upload success, statusCode: " + statusCode);
//m.onUploadSuccess(statusCode, headers, responseBody);
}

@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Toast.makeText(m, m.getString(R.string.upload_failed), Toast.LENGTH_LONG).show();
m.log.warn("Upload failure, statusCode: " + statusCode);
if (error != null) {
m.log.error("Throwable error = {}", error);
}
//m.onUploadFailure(statusCode, headers, responseBody, error);
}
});
}
}

0 comments on commit 0c4c6d1

Please sign in to comment.