Skip to content

Commit

Permalink
Merge pull request #303 from akvo/release/2.1.7
Browse files Browse the repository at this point in the history
Release/2.1.7
  • Loading branch information
ichinaski committed Jun 10, 2015
2 parents 79024f2 + de74976 commit 10f8fb9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 27 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.akvo.flow"
android:versionCode="1"
android:versionName="2.1.6" >
android:versionName="2.1.7" >

<uses-sdk
android:minSdkVersion="10"
Expand Down
10 changes: 1 addition & 9 deletions app/src/main/java/org/akvo/flow/service/DataSyncService.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,7 @@ private ZipFileData formZip(long surveyInstanceId) {
final String checksum = "" + checkedOutStream.getChecksum().getValue();
zos.close();
Log.i(TAG, "Closed zip output stream for file: " + fileName + ". Checksum: " + checksum);
} catch (IOException e) {
PersistentUncaughtExceptionHandler.recordException(e);
Log.e(TAG, e.getMessage());
zipFileData = null;
} catch (NoSuchAlgorithmException e) {
PersistentUncaughtExceptionHandler.recordException(e);
Log.e(TAG, e.getMessage());
zipFileData = null;
} catch (InvalidKeyException e) {
} catch (IOException | NoSuchAlgorithmException | InvalidKeyException e) {
PersistentUncaughtExceptionHandler.recordException(e);
Log.e(TAG, e.getMessage());
zipFileData = null;
Expand Down
9 changes: 3 additions & 6 deletions app/src/main/java/org/akvo/flow/service/LocationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.akvo.flow.service;

import java.io.IOException;
import java.net.URLEncoder;
import java.util.Timer;
import java.util.TimerTask;
Expand Down Expand Up @@ -105,17 +106,14 @@ public void run() {

public void onCreate() {
super.onCreate();
Thread.setDefaultUncaughtExceptionHandler(PersistentUncaughtExceptionHandler
.getInstance());
Thread.setDefaultUncaughtExceptionHandler(PersistentUncaughtExceptionHandler.getInstance());
locMgr = (LocationManager) getSystemService(LOCATION_SERVICE);
locationCriteria = new Criteria();
locationCriteria.setAccuracy(Criteria.NO_REQUIREMENT);
}

/**
* sends the location beacon to the server
*
* @param loc
*/
private void sendLocation(String serverBase, Location loc) {
if (serverBase != null) {
Expand All @@ -126,9 +124,8 @@ private void sendLocation(String serverBase, Location loc) {
}
url += OS_VERSION + URLEncoder.encode("Android " + android.os.Build.VERSION.RELEASE);
HttpUtil.httpGet(url);
} catch (Exception e) {
} catch (IOException e) {
Log.e(TAG, "Could not send location beacon", e);
PersistentUncaughtExceptionHandler.recordException(e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import org.akvo.flow.domain.Survey;
import org.akvo.flow.domain.SurveyGroup;
import org.akvo.flow.exception.PersistentUncaughtExceptionHandler;
import org.akvo.flow.exception.TransferException;
import org.akvo.flow.util.ConstantUtil;
import org.akvo.flow.util.FileUtil;
import org.akvo.flow.util.FileUtil.FileType;
Expand Down Expand Up @@ -134,13 +133,11 @@ private void checkAndDownload(String[] surveyIds) throws IOException {
databaseAdaptor.addLanguages(langs);
downloadResources(survey);
synced++;
} catch (Exception e) {
} catch (IOException e) {
failed++;
Log.e(TAG, "Error downloading survey: " + survey.getId(), e);
displayErrorNotification(ConstantUtil.NOTIFICATION_FORM_ERROR,
getString(R.string.error_form_download));
PersistentUncaughtExceptionHandler
.recordException(new TransferException(survey.getId(), null, e));
}
displayNotification(synced, failed, surveys.size());
}
Expand Down Expand Up @@ -293,10 +290,12 @@ private List<Survey> getSurveyHeaders(String serverBase, String[] surveyIds) {
surveys.addAll(new SurveyMetaParser().parseList(response, true));
}
} catch (IllegalArgumentException | IOException e) {
if (e instanceof IllegalArgumentException) {
PersistentUncaughtExceptionHandler.recordException(e);
}
Log.e(TAG, e.getMessage());
displayErrorNotification(ConstantUtil.NOTIFICATION_HEADER_ERROR,
String.format(getString(R.string.error_form_header), id));
PersistentUncaughtExceptionHandler.recordException(e);
}
}
return surveys;
Expand All @@ -318,10 +317,12 @@ private List<Survey> checkForSurveys(String serverBase) {
surveys = new SurveyMetaParser().parseList(response);
}
} catch (IllegalArgumentException | IOException e) {
if (e instanceof IllegalArgumentException) {
PersistentUncaughtExceptionHandler.recordException(e);
}
displayErrorNotification(ConstantUtil.NOTIFICATION_ASSIGNMENT_ERROR,
getString(R.string.error_assignment_read));
Log.e(TAG, e.getMessage());
PersistentUncaughtExceptionHandler.recordException(e);
}
return surveys;
}
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/org/akvo/flow/service/TimeCheckService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2014 Stichting Akvo (Akvo Foundation)
* Copyright (C) 2010-2015 Stichting Akvo (Akvo Foundation)
*
* This file is part of Akvo FLOW.
*
Expand All @@ -25,9 +25,12 @@
import org.akvo.flow.exception.PersistentUncaughtExceptionHandler;
import org.akvo.flow.util.HttpUtil;
import org.akvo.flow.util.StatusUtil;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

Expand All @@ -44,8 +47,7 @@ public TimeCheckService() {

@Override
protected void onHandleIntent(Intent intent) {
Thread.setDefaultUncaughtExceptionHandler(PersistentUncaughtExceptionHandler
.getInstance());
Thread.setDefaultUncaughtExceptionHandler(PersistentUncaughtExceptionHandler.getInstance());
checkTime();
}

Expand Down Expand Up @@ -82,9 +84,8 @@ private void checkTime() {
}
}
}
} catch (Exception e) {
} catch (IOException | JSONException | ParseException e) {
Log.e(TAG, "Error fetching time: ", e);
PersistentUncaughtExceptionHandler.recordException(e);
}
}

Expand Down

0 comments on commit 10f8fb9

Please sign in to comment.