From df92b179c75a5b2292fbbbb9f63a394b589aad7f Mon Sep 17 00:00:00 2001 From: Lode Hoste Date: Thu, 9 Apr 2015 20:14:14 +0200 Subject: [PATCH] Fix several lint warnings --- .../test/syncthing/RestApiTest.java | 22 ++++++------------- .../syncthingandroid/syncthing/GetTask.java | 4 +++- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/RestApiTest.java b/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/RestApiTest.java index 58b79a2a..193a21bb 100644 --- a/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/RestApiTest.java +++ b/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/RestApiTest.java @@ -17,35 +17,29 @@ import java.util.concurrent.TimeUnit; public class RestApiTest extends AndroidTestCase { - private SyncthingRunnable mSyncthing; - - private ConfigXml mConfig; - private RestApi mApi; - private String mHttpsCertPath; - @Override protected void setUp() throws Exception { super.setUp(); - mSyncthing = new SyncthingRunnable(new MockContext(null), + new SyncthingRunnable(new MockContext(null), getContext().getApplicationInfo().dataDir + "/" + SyncthingService.BINARY_NAME); - mConfig = new ConfigXml(new MockContext(getContext())); - mConfig.changeDefaultFolder(); + ConfigXml config = new ConfigXml(new MockContext(getContext())); + config.changeDefaultFolder(); - mHttpsCertPath = getContext().getFilesDir() + "/" + SyncthingService.HTTPS_CERT_FILE; + String httpsCertPath = getContext().getFilesDir() + "/" + SyncthingService.HTTPS_CERT_FILE; final CountDownLatch latch = new CountDownLatch(2); - new PollWebGuiAvailableTask(mHttpsCertPath) { + new PollWebGuiAvailableTask(httpsCertPath) { @Override protected void onPostExecute(Void aVoid) { mApi.onWebGuiAvailable(); latch.countDown(); } - }.execute(mConfig.getWebGuiUrl()); - mApi = new RestApi(getContext(), mConfig.getWebGuiUrl(), mConfig.getApiKey(), + }.execute(config.getWebGuiUrl()); + mApi = new RestApi(getContext(), config.getWebGuiUrl(), config.getApiKey(), new RestApi.OnApiAvailableListener() { @Override public void onApiAvailable() { @@ -58,8 +52,6 @@ public class RestApiTest extends AndroidTestCase { @Override protected void tearDown() throws Exception { super.tearDown(); - - final CountDownLatch latch = new CountDownLatch(1); SyncthingRunnable.killSyncthing(); ConfigXml.getConfigFile(new MockContext(getContext())).delete(); } diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java index cb7b8a9d..9f9f8f87 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java @@ -90,7 +90,9 @@ public class GetTask extends AsyncTask { try { // Don't push the API too hard Thread.sleep(500 * i); - } catch (InterruptedException e) { } + } catch (InterruptedException e) { + Log.w(TAG, e); + } Log.w(TAG, "Retrying GetTask Rest API call ("+i+")"); } return null;