Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions app/src/main/org/runnerup/export/RunKeeperSynchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -462,29 +462,30 @@ public Status upload(SQLiteDatabase db, final long mID) {
conn.addRequestProperty(
"Content-type", "application/vnd.com.runkeeper.NewFitnessActivity+json");
RunKeeper rk = new RunKeeper(db, simplifier);
BufferedWriter w = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
rk.export(mID, w);
w.flush();

int responseCode = conn.getResponseCode();
String amsg = conn.getResponseMessage();
String externalId = noNullStr(conn.getHeaderField("Location"));
conn.disconnect();
conn = null;

if (responseCode >= HttpURLConnection.HTTP_OK
&& responseCode < HttpURLConnection.HTTP_MULT_CHOICE) {
s.activityId = mID;
if (!TextUtils.isEmpty(externalId)) {
s.externalId = externalId;
s.externalIdStatus = ExternalIdStatus.OK;
}
return s;
try (BufferedWriter w = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()))) {
rk.export(mID, w);
w.flush();

int responseCode = conn.getResponseCode();
String amsg = conn.getResponseMessage();
String externalId = noNullStr(conn.getHeaderField("Location"));
conn.disconnect();
conn = null;

if (responseCode >= HttpURLConnection.HTTP_OK
&& responseCode < HttpURLConnection.HTTP_MULT_CHOICE) {
s.activityId = mID;
if (!TextUtils.isEmpty(externalId)) {
s.externalId = externalId;
s.externalIdStatus = ExternalIdStatus.OK;
}
return s;
}
Log.e(getName(), "Error code: " + responseCode + ", amsg: " + amsg);
ex = new Exception(amsg);
} catch (Exception e) {
ex = e;
}
Comment on lines +465 to 488
Log.e(getName(), "Error code: " + responseCode + ", amsg: " + amsg);
ex = new Exception(amsg);
} catch (Exception e) {
ex = e;
}

Log.e(getName(), "Failed to upload: " + ex.getMessage());
Expand Down
Loading