Przeglądaj źródła

Fix Exception Handling - still not working

anthony.moreno 7 lat temu
rodzic
commit
e60864ef27

+ 9 - 2
GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/thirdparty/helper/InitializerBean.java

@@ -76,8 +76,15 @@ public class InitializerBean {
             return auth.runCallable(new BeanCaller(prop,jndi,Arrays.asList(params)));
         } catch (Exception e) {
             log.error(key,e);
-            if(e.getCause().getClass().getSimpleName().equals("IllegalArgumentException")) {
-                return e.getCause().getMessage();
+            IllegalArgumentException ex = null;
+            if (e instanceof IllegalArgumentException) {
+                ex = (IllegalArgumentException) e;
+            }
+            if (e.getCause() instanceof IllegalArgumentException) {
+                ex = (IllegalArgumentException) e.getCause();
+            }
+            if (ex != null) {
+                return ex.getMessage();
             }
             return "System busy. Please try again later.";
         }

+ 0 - 4
GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/thirdparty/helper/MobileAppThirdPartyHelper.java

@@ -3,13 +3,10 @@ package com.psi.gabontel.mobileapp.thirdparty.helper;
 import java.nio.charset.StandardCharsets;
 import java.util.Map;
 
-import javax.ejb.ApplicationException;
 import javax.ejb.Remote;
 import javax.ejb.Stateless;
 
 import org.jboss.logging.Logger;
-import org.json.JSONArray;
-import org.json.JSONObject;
 
 import com.psi.applicationmanager.AppManagerFunction;
 import com.psi.applicationmanager.AppMessage;
@@ -19,7 +16,6 @@ import com.psi.common.transactions.MessageId;
 import com.psi.common.transactions.Messanger;
 import com.psi.common.transactions.TransactionHelper;
 import com.psi.common.util.StringUtil;
-import com.psi.common.util.SystemUtil;
 
 @Stateless
 @Remote(AppManagerFunction.class)