From b87407a9324e310dc7c811c920c74cc2f1d52303 Mon Sep 17 00:00:00 2001 From: javmarina Date: Sat, 10 Nov 2018 23:52:10 +0100 Subject: [PATCH 1/2] Include thrown exception in onError() callback Until now, it was not possible to know the reason of an error during RSS parsing because exceptions where ignored. Now, the onError() method includes the exception that was thrown so that the developer can investigate further. Note that this is a breaking change, althought it shouldn't be difficult to adapt. --- .../java/com/prof/rssparser/example/MainActivity.java | 2 +- rssparser/src/main/java/com/prof/rssparser/Parser.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/prof/rssparser/example/MainActivity.java b/app/src/main/java/com/prof/rssparser/example/MainActivity.java index c200af49..0c07aa2e 100644 --- a/app/src/main/java/com/prof/rssparser/example/MainActivity.java +++ b/app/src/main/java/com/prof/rssparser/example/MainActivity.java @@ -129,7 +129,7 @@ public void onTaskCompleted(ArrayList
list) { //what to do in case of error @Override - public void onError() { + public void onError(Exception exception) { runOnUiThread(new Runnable() { @Override diff --git a/rssparser/src/main/java/com/prof/rssparser/Parser.java b/rssparser/src/main/java/com/prof/rssparser/Parser.java index 22ac1b35..8ac788b0 100644 --- a/rssparser/src/main/java/com/prof/rssparser/Parser.java +++ b/rssparser/src/main/java/com/prof/rssparser/Parser.java @@ -47,7 +47,7 @@ public Parser() { public interface OnTaskCompleted { void onTaskCompleted(ArrayList
list); - void onError(); + void onError(Exception exception); } public void onFinish(OnTaskCompleted onComplete) { @@ -69,7 +69,7 @@ protected String doInBackground(String... ulr) { return response.body().string(); } catch (IOException e) { e.printStackTrace(); - onComplete.onError(); + onComplete.onError(e); } return null; } @@ -83,10 +83,10 @@ protected void onPostExecute(String result) { Log.i("RSS Parser ", "RSS parsed correctly!"); } catch (Exception e) { e.printStackTrace(); - onComplete.onError(); + onComplete.onError(e); } } else - onComplete.onError(); + onComplete.onError(new Exception("RSS parse operation returned null")); } @Override From 8436da8939c1de9cffe5d613f2edd7f61d5f0189 Mon Sep 17 00:00:00 2001 From: Marco Gomiero Date: Sat, 8 Dec 2018 17:00:16 +0100 Subject: [PATCH 2/2] New release, with PR #22 (includes thrown exception in onError() callback) --- app/build.gradle | 6 +++--- rssparser/build.gradle | 4 ++-- rssparser/publish.gradle | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e6f99ab0..f9b7655e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.prof.rssparser.example" minSdkVersion 14 targetSdkVersion 27 - versionCode 5 - versionName "1.2.2" + versionCode 6 + versionName "1.2.3" } buildTypes { release { @@ -22,7 +22,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation 'junit:junit:4.12' implementation project(":rssparser") -// implementation 'com.prof.rssparser:rssparser:1.4.4' +// implementation 'com.prof.rssparser:rssparser:1.4.5' implementation 'com.android.support:appcompat-v7:27.1.0' implementation 'com.android.support:design:27.1.0' implementation 'com.android.support:recyclerview-v7:27.1.0' diff --git a/rssparser/build.gradle b/rssparser/build.gradle index 4404bac5..e5441e56 100644 --- a/rssparser/build.gradle +++ b/rssparser/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 27 - versionCode 8 - versionName "1.4.4" + versionCode 9 + versionName "1.4.5" } buildTypes { diff --git a/rssparser/publish.gradle b/rssparser/publish.gradle index 5409cdbd..629541b2 100644 --- a/rssparser/publish.gradle +++ b/rssparser/publish.gradle @@ -1,7 +1,7 @@ apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' -version '1.4.4' +version '1.4.5' group 'com.prof.rssparser' publishing {