Author: jleroux
Date: Tue Mar 28 05:08:10 2017 New Revision: 1789043 URL: http://svn.apache.org/viewvc?rev=1789043&view=rev Log: Fixed: Fix Default or Empty Catch block in Java files (OFBIZ-8341) Fixes forgotten "TODO Auto-generated catch block" not using Debug.logError. Groups similar exceptions in multi-catches Removes an useless catch embedded in a same catch in EbayStore In catches in events, returns "error" and an error messages in requests I stop there in ebaystore, I'll hopefull continue later, it has been coded with feet and seems to contains a lot of such issues. Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java 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/EbayAccount.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java?rev=1789043&r1=1789042&r2=1789043&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java Tue Mar 28 05:08:10 2017 @@ -102,7 +102,6 @@ public class EbayAccount { result.put("registrationAddress", registrationAddress); result.put("status", status); } catch (Exception e) { - // TODO Auto-generated catch block return ServiceUtil.returnError(e.getMessage()); } return result; Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java?rev=1789043&r1=1789042&r2=1789043&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java Tue Mar 28 05:08:10 2017 @@ -190,11 +190,7 @@ public class EbayBestOfferAutoPref { } - } catch (GenericServiceException e) { - String errorMessage = UtilProperties.getMessage(resource, "EbayStoreBestOfferToEntityFailed", locale); - result = ServiceUtil.returnError(errorMessage); - return result; - } catch (GenericEntityException e) { + } catch (GenericServiceException | GenericEntityException e) { String errorMessage = UtilProperties.getMessage(resource, "EbayStoreBestOfferToEntityFailed", locale); result = ServiceUtil.returnError(errorMessage); return result; Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java?rev=1789043&r1=1789042&r2=1789043&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java Tue Mar 28 05:08:10 2017 @@ -575,12 +575,16 @@ public class EbayEvents { } } catch (GenericEntityException e) { Debug.logError(e.getMessage(), module); + return "error"; } catch (ApiException e) { - Debug.logError(e.getMessage(), module); + request.setAttribute("_ERROR_MESSAGE_","ApiException ".concat(e.getMessage())); + return "error"; } catch (SdkException e) { - Debug.logError(e.getMessage(), module); + request.setAttribute("_ERROR_MESSAGE_","SdkException ".concat(e.getMessage())); + return "error"; } catch (Exception e) { - Debug.logError(e.getMessage(), module); + request.setAttribute("_ERROR_MESSAGE_","Exception ".concat(e.getMessage())); + return "error"; } request.setAttribute("productStoreId", requestParams.get("productStoreId")); request.setAttribute("isProductId", productId); Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java?rev=1789043&r1=1789042&r2=1789043&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java Tue Mar 28 05:08:10 2017 @@ -18,6 +18,7 @@ */ package org.apache.ofbiz.ebaystore; +import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilDateTime; import org.apache.ofbiz.base.util.UtilProperties; import org.apache.ofbiz.base.util.UtilValidate; @@ -195,14 +196,14 @@ public class EbayFeedback { } } } catch (ApiException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + request.setAttribute("_ERROR_MESSAGE_","ApiException ".concat(e.getMessage())); + return "error"; } catch (SdkException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + request.setAttribute("_ERROR_MESSAGE_","SdkException ".concat(e.getMessage())); + return "error"; } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + request.setAttribute("_ERROR_MESSAGE_","Exception ".concat(e.getMessage())); + return "error"; } String successMsg = UtilProperties.getMessage(resource, "EbayLoadEbayFeedbackSuccessful", locale); result = ServiceUtil.returnSuccess(successMsg); @@ -376,14 +377,14 @@ public class EbayFeedback { leaveFeedbackCall.leaveFeedback(); } } catch (ApiException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + request.setAttribute("_ERROR_MESSAGE_","ApiException ".concat(e.getMessage())); + return "error"; } catch (SdkException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + request.setAttribute("_ERROR_MESSAGE_","SdkException ".concat(e.getMessage())); + return "error"; } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + request.setAttribute("_ERROR_MESSAGE_","Exception ".concat(e.getMessage())); + return "error"; } result = ServiceUtil.returnSuccess(); return result; 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=1789043&r1=1789042&r2=1789043&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:08:10 2017 @@ -451,10 +451,6 @@ public class EbayStore { UtilXml.addChildElementValue(itemElem, "Description", productStore.getString("title"), storeDocument); dataStoreXml.append(UtilXml.writeXmlDocument(storeDocument)); - } catch (Exception e) { - Debug.logError("Exception during building data items to eBay: " + e.getMessage(), module); - return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToEbay.exceptionDuringBuildingDataItemsToEbay", locale)); - } } catch (Exception e) { Debug.logError("Exception during building data items to eBay: " + e.getMessage(), module); return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToEbay.exceptionDuringBuildingDataItemsToEbay", locale)); @@ -608,7 +604,7 @@ public class EbayStore { } } } catch (Exception e) { - + return ServiceUtil.returnFailure(); } return result; } |
Free forum by Nabble | Edit this page |