From daf2061da683c20d8998b91158a3107ba639d331 Mon Sep 17 00:00:00 2001 From: Himanshu Agarwal Date: Tue, 13 Feb 2018 22:14:37 +0530 Subject: [PATCH] Fix :issue #791 - Invalid Toast Message --- .../GenerateCollectionSheetFragment.java | 3 +++ .../src/main/java/com/mifos/utils/MFErrorParser.java | 4 +++- mifosng-android/src/main/res/values/strings.xml | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetFragment.java b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetFragment.java index af2f7da8caf..0c5002c3abf 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetFragment.java +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/generatecollectionsheet/GenerateCollectionSheetFragment.java @@ -266,6 +266,9 @@ public void onItemSelected(AdapterView adapterView, View view, int i, long l) case R.id.sp_groups: groupId = groupNameIdHashMap.get(groupNames.get(i)); + if (groupId == -1) { + Toaster.show(rootView, getString(R.string.error_select_group)); + } break; } diff --git a/mifosng-android/src/main/java/com/mifos/utils/MFErrorParser.java b/mifosng-android/src/main/java/com/mifos/utils/MFErrorParser.java index 7a381a1c5c3..429d597aaa3 100755 --- a/mifosng-android/src/main/java/com/mifos/utils/MFErrorParser.java +++ b/mifosng-android/src/main/java/com/mifos/utils/MFErrorParser.java @@ -27,8 +27,10 @@ public static String errorMessage(Throwable throwableError) { try { if (throwableError instanceof HttpException) { errorMessage = ((HttpException) throwableError).response().errorBody().string(); - errorMessage = MFErrorParser.parseError(errorMessage).getErrors() + errorMessage = MFErrorParser.parseError(errorMessage).getErrors() .get(0).getDefaultUserMessage(); + } else { + errorMessage = throwableError.toString(); } } catch (Throwable throwable) { RxJavaPlugins.getInstance().getErrorHandler().handleError(throwable); diff --git a/mifosng-android/src/main/res/values/strings.xml b/mifosng-android/src/main/res/values/strings.xml index bbbe750eef2..5fac59ab5cc 100755 --- a/mifosng-android/src/main/res/values/strings.xml +++ b/mifosng-android/src/main/res/values/strings.xml @@ -440,6 +440,7 @@ Group List Invalid Amount Entered Please Select an Office + Please Select a Group Please Select Payment Type Please Select Fund Please Select Interest Calculation Period