Author: jleroux
Date: Tue Mar 28 05:50:16 2017 New Revision: 1789047 URL: http://svn.apache.org/viewvc?rev=1789047&view=rev Log: Fixed: Fix Default or Empty Catch block in Java files (OFBIZ-8341) In EbayStore services class, replaces forgotten e.printStackTrace() (I guess due to "TODO Auto-generated catch block") by returning service errors Uses the same pattern everywhere it's needed Replaces returnFailure by returnError, an exception is not a failure, it's a serious error Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java?rev=1789047&r1=1789046&r2=1789047&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java Tue Mar 28 05:50:16 2017 @@ -360,7 +360,7 @@ public class EbayStore { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EbayStoreRootCategoryNotFound", UtilMisc.toMap("prodCatalogId", context.get("prodCatalogId")), locale)); } } catch (GenericEntityException e) { - result = ServiceUtil.returnFailure(e.getMessage()); + result = ServiceUtil.returnError(e.getMessage()); } if (result.get("responseMessage") != null && result.get("responseMessage").equals("fail")) { result = ServiceUtil.returnError(result.get("errorMessage").toString()); @@ -413,13 +413,13 @@ public class EbayStore { } } } catch (ApiException e) { - result = ServiceUtil.returnFailure(e.getMessage()); + result = ServiceUtil.returnError("ApiException ".concat(e.getMessage())); } catch (SdkSoapException e) { - result = ServiceUtil.returnFailure(e.getMessage()); + result = ServiceUtil.returnError("SdkSoapException ".concat(e.getMessage())); } catch (SdkException e) { - result = ServiceUtil.returnFailure(e.getMessage()); + result = ServiceUtil.returnError("SdkException ".concat(e.getMessage())); } catch (GenericEntityException e) { - result = ServiceUtil.returnFailure(e.getMessage()); + result = ServiceUtil.returnError(e.getMessage()); } return result; } @@ -839,14 +839,11 @@ public class EbayStore { result.put(ModelService.ERROR_MESSAGE, resp.getAck().toString() +":"+ resp.getMessage()); } } catch (ApiException e) { - result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); - result.put(ModelService.ERROR_MESSAGE, e.getMessage()); + result = ServiceUtil.returnError("ApiException ".concat(e.getMessage())); } catch (SdkSoapException e) { - result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); - result.put(ModelService.ERROR_MESSAGE, e.getMessage()); + result = ServiceUtil.returnError("SdkSoapException ".concat(e.getMessage())); } catch (SdkException e) { - result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); - result.put(ModelService.ERROR_MESSAGE, e.getMessage()); + result = ServiceUtil.returnError("SdkException ".concat(e.getMessage())); } } return result; @@ -925,11 +922,11 @@ public class EbayStore { } } } catch (ApiException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("ApiException ".concat(e.getMessage())); } catch (SdkSoapException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkSoapException ".concat(e.getMessage())); } catch (SdkException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkException ".concat(e.getMessage())); } return result; } @@ -970,11 +967,11 @@ public class EbayStore { } } } catch (ApiException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("ApiException ".concat(e.getMessage())); } catch (SdkSoapException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkSoapException ".concat(e.getMessage())); } catch (SdkException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkException ".concat(e.getMessage())); } return result; } @@ -1022,11 +1019,11 @@ public class EbayStore { } } } catch (ApiException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("ApiException ".concat(e.getMessage())); } catch (SdkSoapException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkSoapException ".concat(e.getMessage())); } catch (SdkException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkException ".concat(e.getMessage())); } return result; } @@ -1080,11 +1077,11 @@ public class EbayStore { //this.returnedSubscriptionArray = resp.getSubscriptionArray(); } } catch (ApiException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("ApiException ".concat(e.getMessage())); } catch (SdkSoapException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkSoapException ".concat(e.getMessage())); } catch (SdkException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkException ".concat(e.getMessage())); } return result; } @@ -1208,11 +1205,11 @@ public class EbayStore { } } } catch (ApiException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("ApiException ".concat(e.getMessage())); } catch (SdkSoapException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkSoapException ".concat(e.getMessage())); } catch (SdkException e) { - e.printStackTrace(); + result = ServiceUtil.returnError("SdkException ".concat(e.getMessage())); } return result; } @@ -1322,13 +1319,14 @@ public class EbayStore { } } } catch (ApiException e) { - result = ServiceUtil.returnError(e.getMessage()); + result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); + result.put(ModelService.ERROR_MESSAGE, e.getMessage()); } catch (SdkSoapException e) { - result = ServiceUtil.returnError(e.getMessage()); + result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); + result.put(ModelService.ERROR_MESSAGE, e.getMessage()); } catch (SdkException e) { - result = ServiceUtil.returnError(e.getMessage()); - } catch (GenericServiceException e) { - result = ServiceUtil.returnError(e.getMessage()); + result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); + result.put(ModelService.ERROR_MESSAGE, e.getMessage()); } return result; } @@ -2729,7 +2727,7 @@ public class EbayStore { } } catch (Exception e) { - result = ServiceUtil.returnFailure(e.getMessage()); + result = ServiceUtil.returnError(e.getMessage()); } System.out.println(orderList); result.put("productStoreId", productStoreId); |
Free forum by Nabble | Edit this page |