You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by pa...@apache.org on 2020/06/27 05:53:39 UTC
[ofbiz-framework] branch trunk updated: Improved: Merge identical
catch blocks in single catch block(OFBIZ-11827)
This is an automated email from the ASF dual-hosted git repository.
pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new f0af289 Improved: Merge identical catch blocks in single catch block(OFBIZ-11827)
f0af289 is described below
commit f0af2894e5915c2ffaa87b0ad6b52818267ac202
Author: Pawan Verma <pa...@hotwaxsystems.com>
AuthorDate: Sat Jun 27 11:23:12 2020 +0530
Improved: Merge identical catch blocks in single catch block(OFBIZ-11827)
In Java SE 7 and later, a single catch block can handle more than one type of exception. This feature can reduce code duplication and lessen the temptation to catch an overly broad exception.
Thanks: Jacques for the review.
---
.../accounting/payment/PaymentGatewayServices.java | 4 -
.../accounting/thirdparty/paypal/PayPalEvents.java | 5 +-
.../thirdparty/valuelink/ValueLinkApi.java | 36 ++------
.../ofbiz/content/ContentManagementEvents.java | 5 +-
.../ofbiz/content/ContentManagementServices.java | 40 ++-------
.../apache/ofbiz/content/blog/BlogRssServices.java | 4 +-
.../ofbiz/content/content/ContentKeywordIndex.java | 4 +-
.../ofbiz/content/content/ContentMapFacade.java | 10 +--
.../ofbiz/content/content/ContentServices.java | 10 +--
.../content/content/ContentServicesComplex.java | 4 +-
.../ofbiz/content/content/ContentUrlFilter.java | 2 -
.../ofbiz/content/content/ContentWorker.java | 8 +-
.../ofbiz/content/data/DataResourceWorker.java | 2 -
.../apache/ofbiz/content/data/DataServices.java | 5 +-
.../apache/ofbiz/content/layout/LayoutEvents.java | 10 +--
.../webapp/ftl/WrapSubContentCacheTransform.java | 5 +-
.../apache/ofbiz/manufacturing/bom/BOMHelper.java | 5 +-
.../ofbiz/manufacturing/bom/BOMServices.java | 14 ++--
.../manufacturing/jobshopmgt/ProductionRun.java | 4 +-
.../jobshopmgt/ProductionRunServices.java | 72 ++++------------
.../ofbiz/manufacturing/mrp/MrpServices.java | 10 +--
.../apache/ofbiz/order/order/OrderServices.java | 36 ++------
.../apache/ofbiz/order/quote/QuoteServices.java | 3 -
.../order/requirement/RequirementServices.java | 12 +--
.../order/shoppinglist/ShoppingListServices.java | 2 -
.../apache/ofbiz/order/test/OrderTestServices.java | 4 -
.../communication/CommunicationEventServices.java | 7 +-
.../ofbiz/party/content/PartyContentWrapper.java | 14 +---
.../product/category/CategoryContentWrapper.java | 5 +-
.../ofbiz/product/category/SeoConfigUtil.java | 8 +-
.../ofbiz/shipment/packing/PackingSession.java | 4 +-
.../ofbiz/shipment/shipment/ShipmentServices.java | 23 +----
.../ofbiz/shipment/thirdparty/dhl/DhlServices.java | 47 +----------
.../shipment/thirdparty/fedex/FedexServices.java | 7 +-
.../ofbiz/shipment/thirdparty/ups/UpsServices.java | 98 ++--------------------
.../securityext/cert/CertificateServices.java | 4 +-
.../content/WorkEffortContentWrapper.java | 6 +-
.../org/apache/ofbiz/entity/util/EntityCrypto.java | 4 +-
.../ofbiz/entityext/eca/DelegatorEcaHandler.java | 4 +-
.../synchronization/EntitySyncServices.java | 17 ++--
.../ofbiz/service/engine/GenericAsyncEngine.java | 6 +-
.../ofbiz/service/mail/MimeMessageWrapper.java | 5 +-
.../ofbiz/service/rmi/ExampleRemoteClient.java | 6 +-
.../xmlrpc/AliasSupportedTransportFactory.java | 4 +-
.../apache/ofbiz/testtools/SimpleMethodTest.java | 4 +-
.../org/apache/ofbiz/webapp/event/CoreEvents.java | 3 -
.../apache/ofbiz/webapp/webdav/WebDavServlet.java | 4 +-
.../apache/ofbiz/webtools/WebToolsServices.java | 8 +-
.../webtools/artifactinfo/ArtifactInfoFactory.java | 4 +-
.../artifactinfo/FormWidgetArtifactInfo.java | 6 +-
.../artifactinfo/ScreenWidgetArtifactInfo.java | 8 +-
.../webtools/artifactinfo/ServiceArtifactInfo.java | 6 --
52 files changed, 110 insertions(+), 518 deletions(-)
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
index 71b72c6..9ac5e16 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
@@ -2867,8 +2867,6 @@ public class PaymentGatewayServices {
delegator.create(pgr);
} catch (GenericEntityException | GenericServiceException ge) {
Debug.logError(ge, MODULE);
- } catch (Exception e) {
- Debug.logError(e, MODULE);
}
}
@@ -2885,8 +2883,6 @@ public class PaymentGatewayServices {
}
} catch (GenericEntityException | GenericServiceException ge) {
Debug.logError(ge, MODULE);
- } catch (Exception e) {
- Debug.logError(e, MODULE);
}
}
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
index 27ae059..46da5ed 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
@@ -424,10 +424,7 @@ public class PayPalEvents {
java.sql.Timestamp authDate = null;
try {
authDate = new java.sql.Timestamp(sdf.parse(paymentDate).getTime());
- } catch (ParseException e) {
- Debug.logError(e, "Cannot parse date string: " + paymentDate, MODULE);
- authDate = UtilDateTime.nowTimestamp();
- } catch (NullPointerException e) {
+ } catch (ParseException | NullPointerException e) {
Debug.logError(e, "Cannot parse date string: " + paymentDate, MODULE);
authDate = UtilDateTime.nowTimestamp();
}
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
index f5c06e6..bb7178d 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
@@ -182,11 +182,7 @@ public class ValueLinkApi {
try {
byte[] encryptedEan = mwkCipher.doFinal(eanBlock);
encryptedEanHex = StringUtil.toHexString(encryptedEan);
- } catch (IllegalStateException e) {
- Debug.logError(e, MODULE);
- } catch (IllegalBlockSizeException e) {
- Debug.logError(e, MODULE);
- } catch (BadPaddingException e) {
+ } catch (IllegalStateException | BadPaddingException | IllegalBlockSizeException e) {
Debug.logError(e, MODULE);
}
@@ -212,11 +208,7 @@ public class ValueLinkApi {
byte[] decryptedEan = mwkCipher.doFinal(StringUtil.fromHexString(pin));
byte[] decryptedPin = getByteRange(decryptedEan, 8, 8);
decryptedPinString = new String(decryptedPin, StandardCharsets.UTF_8);
- } catch (IllegalStateException e) {
- Debug.logError(e, MODULE);
- } catch (IllegalBlockSizeException e) {
- Debug.logError(e, MODULE);
- } catch (BadPaddingException e) {
+ } catch (IllegalStateException | BadPaddingException | IllegalBlockSizeException e) {
Debug.logError(e, MODULE);
}
@@ -294,11 +286,7 @@ public class ValueLinkApi {
KeyPair keyPair = null;
try {
keyPair = this.createKeys();
- } catch (NoSuchAlgorithmException e) {
- Debug.logError(e, MODULE);
- } catch (InvalidAlgorithmParameterException e) {
- Debug.logError(e, MODULE);
- } catch (InvalidKeySpecException e) {
+ } catch (NoSuchAlgorithmException | InvalidKeySpecException | InvalidAlgorithmParameterException e) {
Debug.logError(e, MODULE);
}
@@ -327,11 +315,7 @@ public class ValueLinkApi {
byte[] kekBytes = null;
try {
kekBytes = this.generateKek(privateKey);
- } catch (NoSuchAlgorithmException e) {
- Debug.logError(e, MODULE);
- } catch (InvalidKeySpecException e) {
- Debug.logError(e, MODULE);
- } catch (InvalidKeyException e) {
+ } catch (NoSuchAlgorithmException | InvalidKeyException | InvalidKeySpecException e) {
Debug.logError(e, MODULE);
}
@@ -589,11 +573,7 @@ public class ValueLinkApi {
byte[] encryptedZeros = new byte[0];
try {
encryptedZeros = cipher.doFinal(zeros);
- } catch (IllegalStateException e) {
- Debug.logError(e, MODULE);
- } catch (IllegalBlockSizeException e) {
- Debug.logError(e, MODULE);
- } catch (BadPaddingException e) {
+ } catch (IllegalStateException | BadPaddingException | IllegalBlockSizeException e) {
Debug.logError(e, MODULE);
}
@@ -779,11 +759,7 @@ public class ValueLinkApi {
byte[] dec = new byte[0];
try {
dec = cipher.doFinal(content);
- } catch (IllegalStateException e) {
- Debug.logError(e, MODULE);
- } catch (IllegalBlockSizeException e) {
- Debug.logError(e, MODULE);
- } catch (BadPaddingException e) {
+ } catch (IllegalStateException | BadPaddingException | IllegalBlockSizeException e) {
Debug.logError(e, MODULE);
}
return dec;
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java
index 2b1d6d4..bada581 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java
@@ -190,12 +190,9 @@ public class ContentManagementEvents {
// TODO: this needs to be given author userLogin
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", authorId).cache().queryOne();
origPublishedLinkList = ContentManagementWorker.getPublishedLinks(delegator, targContentId, webSiteId, userLogin, security, permittedAction, permittedOperations, roles);
- } catch (GenericEntityException e) {
+ } catch (GeneralException e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
return "error";
- } catch (GeneralException e2) {
- request.setAttribute("_ERROR_MESSAGE_", e2.getMessage());
- return "error";
}
// make a map of the values that are passed in using the top subSite as the key.
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
index ee2d49e..ef2a232 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
@@ -235,13 +235,7 @@ public class ContentManagementServices {
Map<String, Object> dataResourceResult;
try {
dataResourceResult = persistDataResourceAndDataMethod(dctx, context);
- } catch (GenericServiceException e) {
- Debug.logError(e, e.toString(), MODULE);
- return ServiceUtil.returnError(e.toString());
- } catch (GenericEntityException e) {
- Debug.logError(e, e.toString(), MODULE);
- return ServiceUtil.returnError(e.toString());
- } catch (Exception e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, e.toString(), MODULE);
return ServiceUtil.returnError(e.toString());
}
@@ -380,10 +374,8 @@ public class ContentManagementServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
}
- } catch (GenericEntityException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
throw new GenericServiceException(e.toString());
- } catch (Exception e2) {
- throw new GenericServiceException(e2.toString());
}
String errMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errMsg)) {
@@ -459,13 +451,10 @@ public class ContentManagementServices {
permResults = dispatcher.runSync("createContentRole", serviceContext);
if (ServiceUtil.isError(permResults)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults));
- }
+ }
} catch (GenericServiceException e) {
Debug.logError(e, e.toString(), MODULE);
return ServiceUtil.returnError(e.toString());
- } catch (Exception e2) {
- Debug.logError(e2, e2.toString(), MODULE);
- return ServiceUtil.returnError(e2.toString());
}
}
} else {
@@ -485,9 +474,6 @@ public class ContentManagementServices {
} catch (GenericServiceException e) {
Debug.logError(e, e.toString(), MODULE);
return ServiceUtil.returnError(e.toString());
- } catch (Exception e2) {
- Debug.logError(e2, e2.toString(), MODULE);
- return ServiceUtil.returnError(e2.toString());
}
}
}
@@ -513,13 +499,7 @@ public class ContentManagementServices {
else {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentNoAccessToUploadImage", locale));
}
- } catch (GenericServiceException e) {
- Debug.logError(e, e.toString(), MODULE);
- return ServiceUtil.returnError(e.toString());
- } catch (GenericEntityException e) {
- Debug.logError(e, e.toString(), MODULE);
- return ServiceUtil.returnError(e.toString());
- } catch (Exception e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, e.toString(), MODULE);
return ServiceUtil.returnError(e.toString());
}
@@ -530,7 +510,7 @@ public class ContentManagementServices {
return result;
}
- public static Map<String, Object> persistDataResourceAndDataMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException, GenericEntityException, Exception {
+ public static Map<String, Object> persistDataResourceAndDataMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException, GenericEntityException {
Delegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
@@ -587,7 +567,7 @@ public class ContentManagementServices {
if (!dataResourceExists) { // Create
Map<String, Object> thisResult = dispatcher.runSync("createDataResource", newDrContext);
if (ServiceUtil.isError(thisResult)) {
- throw(new Exception(ServiceUtil.getErrorMessage(thisResult)));
+ throw(new GenericServiceException(ServiceUtil.getErrorMessage(thisResult)));
}
dataResourceId = (String)thisResult.get("dataResourceId");
if (Debug.infoOn()) {
@@ -735,10 +715,8 @@ public class ContentManagementServices {
if (ServiceUtil.isError(thisResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, e.toString(), MODULE);
- } catch (Exception e2) {
- Debug.logError(e2, e2.toString(), MODULE);
}
}
} else {
@@ -757,8 +735,6 @@ public class ContentManagementServices {
}
} catch (GenericServiceException e) {
Debug.logError(e, e.toString(), MODULE);
- } catch (Exception e2) {
- Debug.logError(e2, e2.toString(), MODULE);
}
}
}
@@ -867,7 +843,7 @@ public class ContentManagementServices {
prevValue.store();
contentAssoc.put("sequenceNum", prevSeqNum);
contentAssoc.store();
- } catch (Exception e) {
+ } catch (GenericEntityException e) {
return ServiceUtil.returnError(e.toString());
}
}
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java
index 0e1bd6a..09cddfe 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java
@@ -118,9 +118,7 @@ public class BlogRssServices {
try {
Map<String, Object> dummy = new HashMap<>();
sub = ContentWorker.renderSubContentAsText(dispatcher, v.getString("contentId"), mapKey, dummy, locale, mimeTypeId, true);
- } catch (GeneralException e) {
- Debug.logError(e, MODULE);
- } catch (IOException e) {
+ } catch (GeneralException | IOException e) {
Debug.logError(e, MODULE);
}
if (sub != null) {
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java
index 7bdb160..e96ba9a 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java
@@ -213,9 +213,7 @@ public class ContentKeywordIndex {
for (int i = 0; i < weight; i++) {
strings.add(contentText);
}
- } catch (IOException e1) {
- Debug.logError(e1, "Error getting content text to index", MODULE);
- } catch (GeneralException e1) {
+ } catch (IOException | GeneralException e1) {
Debug.logError(e1, "Error getting content text to index", MODULE);
}
}
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java
index 5e9cde4..df06b95 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java
@@ -351,10 +351,7 @@ public class ContentMapFacade implements Map<Object, Object> {
try {
return ContentWorker.renderContentAsText(dispatcher, contentId, renderCtx, locale, mimeType, cache);
- } catch (GeneralException e) {
- Debug.logError(e, MODULE);
- return e.toString();
- } catch (IOException e) {
+ } catch (GeneralException | IOException e) {
Debug.logError(e, MODULE);
return e.toString();
}
@@ -553,10 +550,7 @@ public class ContentMapFacade implements Map<Object, Object> {
// render just the dataresource
try {
return DataResourceWorker.renderDataResourceAsText(dispatcher, delegator, value.getString("dataResourceId"), context, locale, mimeType, cache);
- } catch (GeneralException e) {
- Debug.logError(e, MODULE);
- return e.toString();
- } catch (IOException e) {
+ } catch (GeneralException | IOException e) {
Debug.logError(e, MODULE);
return e.toString();
}
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java
index a8b8de1..108c912 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java
@@ -415,10 +415,7 @@ public class ContentServices {
ContentWorker.renderSubContentAsText(dispatcher, contentId, outWriter, mapKey, templateContext, locale, mimeTypeId, true);
out.write(outWriter.toString());
results.put("textData", outWriter.toString());
- } catch (GeneralException e) {
- Debug.logError(e, "Error rendering sub-content text", MODULE);
- return ServiceUtil.returnError(e.toString());
- } catch (IOException e) {
+ } catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering sub-content text", MODULE);
return ServiceUtil.returnError(e.toString());
}
@@ -464,10 +461,7 @@ public class ContentServices {
ContentWorker.renderContentAsText(dispatcher, contentId, outWriter, templateContext, locale, mimeTypeId, null, null, true);
if (out != null) out.write(outWriter.toString());
results.put("textData", outWriter.toString());
- } catch (GeneralException e) {
- Debug.logError(e, "Error rendering sub-content text", MODULE);
- return ServiceUtil.returnError(e.toString());
- } catch (IOException e) {
+ } catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering sub-content text", MODULE);
return ServiceUtil.returnError(e.toString());
}
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java
index 3a57d1c..c42d0d3 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java
@@ -186,10 +186,8 @@ public class ContentServicesComplex {
Map<String, Object> results = null;
try {
results = getAssocAndContentAndDataResourceCacheMethod(delegator, contentId, mapKey, direction, fromDate, fromDateStr, assocTypes, contentTypes, nullThruDatesOnly, contentAssocPredicateId, null);
- } catch (GenericEntityException e) {
+ } catch (GenericEntityException | MiniLangException e) {
return ServiceUtil.returnError(e.getMessage());
- } catch (MiniLangException e2) {
- return ServiceUtil.returnError(e2.getMessage());
}
return results;
}
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentUrlFilter.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentUrlFilter.java
index fdf7ea2..902a506 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentUrlFilter.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentUrlFilter.java
@@ -76,8 +76,6 @@ public class ContentUrlFilter implements Filter {
}
} catch (GenericEntityException gee) {
Debug.logWarning(gee.getMessage(), MODULE);
- } catch (Exception e) {
- Debug.logWarning(e.getMessage(), MODULE);
}
}
if (UtilValidate.isNotEmpty(urlContentId)) {
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java
index 7e69048..51b6f14 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java
@@ -311,10 +311,8 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor
try {
NodeModel nodeModel = NodeModel.parse(new InputSource(sr));
templateContext.put("doc", nodeModel) ;
- } catch (SAXException e) {
+ } catch (SAXException | ParserConfigurationException e) {
throw new GeneralException(e.getMessage());
- } catch (ParserConfigurationException e2) {
- throw new GeneralException(e2.getMessage());
}
} else {
templateContext.put("docFile", DataResourceWorker.getContentFile(dataResource.getString("dataResourceTypeId"), dataResource.getString("objectInfo"), (String) templateContext.get("contextRoot")).getAbsoluteFile().toString());
@@ -711,10 +709,8 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor
Map<String, Object> results = null;
try {
results = ContentServicesComplex.getAssocAndContentAndDataResourceCacheMethod(delegator, parentContentId, mapKey, direction, null, null, assocTypeList, contentTypeList, nullThruDatesOnly, contentAssocPredicateId, null);
- } catch (GenericEntityException e) {
+ } catch (GenericEntityException | MiniLangException e) {
throw new RuntimeException(e.getMessage());
- } catch (MiniLangException e2) {
- throw new RuntimeException(e2.getMessage());
}
List<GenericValue> relatedViews = UtilGenerics.cast(results.get("entityList"));
for (GenericValue assocValue : relatedViews) {
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
index 254317e..4a29303 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
@@ -808,8 +808,6 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data
MacroFormRenderer renderer = new MacroFormRenderer(formrenderer, request, response);
FormRenderer formRenderer = new FormRenderer(modelForm, renderer);
formRenderer.render(out, context);
- } catch (SAXException | ParserConfigurationException e) {
- throw new GeneralException("Error rendering Screen template", e);
} catch (TemplateException e) {
throw new GeneralException("Error creating Screen renderer", e);
} catch (Exception e) {
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
index ecbabe8..9db2293 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
@@ -643,12 +643,9 @@ public class DataServices {
}
try {
file = DataResourceWorker.getContentFile(dataResourceTypeId, objectInfo, rootDir);
- } catch (FileNotFoundException e) {
+ } catch (FileNotFoundException | GeneralException e) {
Debug.logWarning(e, MODULE);
throw new GenericServiceException(e.getMessage());
- } catch (GeneralException e2) {
- Debug.logWarning(e2, MODULE);
- throw new GenericServiceException(e2.getMessage());
}
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, file:" + file, MODULE);
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java
index cf4dd1f..12be1aa 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java
@@ -161,12 +161,9 @@ public class LayoutEvents {
imageDataResource.set("imageData", byteWrap.array());
imageDataResource.store();
}
- } catch (GenericEntityException e3) {
+ } catch (GenericEntityException | GenericServiceException e3) {
request.setAttribute("_ERROR_MESSAGE_", e3.getMessage());
return "error";
- } catch (GenericServiceException e) {
- request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
- return "error";
}
return "success";
}
@@ -400,10 +397,7 @@ public class LayoutEvents {
}
try {
SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocIn", view, serviceIn, errorMessages, locale);
- } catch (IllegalArgumentException e) {
- request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
- return "error";
- } catch (MiniLangException e) {
+ } catch (IllegalArgumentException | MiniLangException e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
return "error";
}
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java
index 8f920e9..92d9ce2 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java
@@ -180,12 +180,9 @@ public class WrapSubContentCacheTransform implements TemplateTransformModel {
try {
ContentWorker.renderContentAsText(dispatcher, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, true);
- } catch (IOException e) {
+ } catch (IOException | GeneralException e) {
Debug.logError(e, "Error rendering content" + e.getMessage(), MODULE);
throw new IOException("Error rendering content" + e.toString());
- } catch (GeneralException e2) {
- Debug.logError(e2, "Error rendering content" + e2.getMessage(), MODULE);
- throw new IOException("Error rendering content" + e2.toString());
}
FreeMarkerWorker.reloadValues(templateCtx, savedValuesUp, env);
}
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java
index c7f4e02..ebe6845 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java
@@ -162,11 +162,8 @@ public final class BOMHelper {
return "error";
}
}
- } catch (GenericEntityException|GenericServiceException ge) {
+ } catch (GenericEntityException | GenericServiceException ge) {
Debug.logWarning(ge, MODULE);
- } catch (Exception e) {
- // if there is an exception for either, the other probably wont work
- Debug.logWarning(e, MODULE);
}
return "success";
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
index b1f0995..a559df3 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
@@ -198,10 +198,9 @@ public class BOMServices {
variantProduct.store();
}
}
- } catch (GenericEntityException|GenericServiceException ge) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", ge.getMessage()), locale));
- } catch (Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale));
+ } catch (GenericEntityException | GenericServiceException ge) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningUpdateLowLevelCode"
+ , UtilMisc.toMap("errorString", ge.getMessage()), locale));
}
result.put("lowLevelCode", llc);
return result;
@@ -237,15 +236,14 @@ public class BOMServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(depthResult));
}
Debug.logInfo("Product [" + product.getString("productId") + "] Low Level Code [" + depthResult.get("lowLevelCode") + "]", MODULE);
- } catch (Exception exc) {
+ } catch (GenericServiceException exc) {
Debug.logWarning(exc.getMessage(), MODULE);
}
}
// FIXME: also all the variants llc should be updated?
} catch (GenericEntityException e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningInitLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale));
- } catch (Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningInitLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale));
+ return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningInitLowLevelCode"
+ , UtilMisc.toMap("errorString", e.getMessage()), locale));
}
return result;
}
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
index 4f1a9b1..9ed5c37 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
@@ -429,9 +429,7 @@ public class ProductionRun {
}
totalTaskTime = ((BigDecimal)serviceResult.get("totalTime")).doubleValue();
}
- } catch (GenericServiceException exc) {
- Debug.logError(exc, "Problem calling the customMethod service " + serviceName);
- } catch (Exception exc) {
+ } catch (GenericEntityException | GenericServiceException exc) {
Debug.logError(exc, "Problem calling the customMethod service " + serviceName);
}
}
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
index e812a56..d4387a7 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
@@ -155,15 +155,9 @@ public class ProductionRunServices {
}
}
}
- } catch (GenericEntityException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, "Problem accessing WorkEffortGoodStandard entity", MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
- } catch (GenericServiceException e) {
- Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
- } catch (Exception e) {
- Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
}
result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale));
return result;
@@ -920,11 +914,7 @@ public class ProductionRunServices {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
}
}
- } catch (GenericServiceException e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
- } catch (Exception e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
}
}
@@ -1055,10 +1045,9 @@ public class ProductionRunServices {
}
}
}
- } catch(GenericServiceException gse) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindOverheadCosts", UtilMisc.toMap("errorString", gse.getMessage()), locale));
- } catch(Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindOverheadCosts", UtilMisc.toMap("errorString", e.getMessage()), locale));
+ } catch(GenericEntityException | GenericServiceException gse) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindOverheadCosts"
+ , UtilMisc.toMap("errorString", gse.getMessage()), locale));
}
}
@@ -1137,11 +1126,7 @@ public class ProductionRunServices {
totalCost = totalCost.add(taskCost);
}
result.put("totalCost", totalCost);
- } catch (GenericEntityException exc) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage());
- } catch (GenericServiceException exc) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage());
- } catch (Exception exc) {
+ } catch (GenericEntityException | GenericServiceException exc) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage());
}
return result;
@@ -1266,10 +1251,9 @@ public class ProductionRunServices {
}
}
}
- } catch (GenericEntityException|GenericServiceException ge) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale));
- } catch (Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale));
+ } catch (GenericEntityException | GenericServiceException ge) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateRoutingCosts"
+ , UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale));
}
// materials costs: these are the costs derived from the materials used by the production run task
try {
@@ -1301,10 +1285,9 @@ public class ProductionRunServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
}
}
- } catch (GenericEntityException|GenericServiceException ge) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale));
- } catch (Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale));
+ } catch (GenericEntityException | GenericServiceException ge) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateMaterialsCosts"
+ , UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale));
}
return ServiceUtil.returnSuccess();
}
@@ -1785,10 +1768,7 @@ public class ProductionRunServices {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingLotNotExists", locale));
}
}
- } catch (GenericEntityException e) {
- Debug.logWarning(e.getMessage(), MODULE);
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logWarning(e.getMessage(), MODULE);
return ServiceUtil.returnError(e.getMessage());
}
@@ -1865,12 +1845,9 @@ public class ProductionRunServices {
}
}
- } catch (GenericServiceException gse) {
+ } catch (GenericEntityException | GenericServiceException gse) {
Debug.logWarning(gse.getMessage(), MODULE);
return ServiceUtil.returnError(gse.getMessage());
- } catch (Exception e) {
- Debug.logWarning(e.getMessage(), MODULE);
- return ServiceUtil.returnError(e.getMessage());
}
if ("SERIALIZED_INV_ITEM".equals(inventoryItemTypeId)) {
@@ -1926,8 +1903,6 @@ public class ProductionRunServices {
}
} catch (GenericServiceException exc) {
return ServiceUtil.returnError(exc.getMessage());
- } catch (Exception exc) {
- return ServiceUtil.returnError(exc.getMessage());
}
} else {
try {
@@ -1983,8 +1958,6 @@ public class ProductionRunServices {
}
} catch (GenericServiceException exc) {
return ServiceUtil.returnError(exc.getMessage());
- } catch (Exception exc) {
- return ServiceUtil.returnError(exc.getMessage());
}
}
// Now the production run's quantityProduced is updated
@@ -2162,8 +2135,6 @@ public class ProductionRunServices {
}
} catch (GenericServiceException exc) {
return ServiceUtil.returnError(exc.getMessage());
- } catch (Exception exc) {
- return ServiceUtil.returnError(exc.getMessage());
}
} else {
try {
@@ -2216,8 +2187,6 @@ public class ProductionRunServices {
}
} catch (GenericServiceException exc) {
return ServiceUtil.returnError(exc.getMessage());
- } catch (Exception exc) {
- return ServiceUtil.returnError(exc.getMessage());
}
}
result.put("inventoryItemIds", inventoryItemIds);
@@ -2450,8 +2419,6 @@ public class ProductionRunServices {
}
} catch (GenericServiceException exc) {
return ServiceUtil.returnError(exc.getMessage());
- } catch (Exception exc) {
- return ServiceUtil.returnError(exc.getMessage());
}
return result;
@@ -3089,9 +3056,6 @@ public class ProductionRunServices {
} catch (GenericServiceException e) {
Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
- } catch (Exception e) {
- Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale));
}
return result;
}
@@ -3350,9 +3314,6 @@ public class ProductionRunServices {
} catch (GenericServiceException e) {
Debug.logError(e, "Problem calling the checkDecomposeInventoryItem service", MODULE);
return ServiceUtil.returnError(e.getMessage());
- } catch (Exception e) {
- Debug.logError(e, "Problem calling the checkDecomposeInventoryItem service", MODULE);
- return ServiceUtil.returnError(e.getMessage());
}
return ServiceUtil.returnSuccess();
}
@@ -3470,10 +3431,7 @@ public class ProductionRunServices {
inventoryItemIds.addAll(newInventoryItemIds);
}
// the components are put in warehouse
- } catch (GenericEntityException e) {
- Debug.logError(e, "Problem calling the createWorkEffort service", MODULE);
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, "Problem calling the createWorkEffort service", MODULE);
return ServiceUtil.returnError(e.getMessage());
}
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java
index 5b4ae31..dad6660 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java
@@ -743,9 +743,8 @@ public class MrpServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResponse));
}
} catch (GenericServiceException e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale));
- } catch (Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale));
+ return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct"
+ , UtilMisc.toMap("productId", product.getString("productId")), locale));
}
components = UtilGenerics.cast(serviceResponse.get("components"));
if (UtilValidate.isNotEmpty(components)) {
@@ -780,9 +779,8 @@ public class MrpServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResponse));
}
} catch (GenericServiceException e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale));
- } catch (Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale));
+ return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct"
+ , UtilMisc.toMap("productId", product.getString("productId")), locale));
}
components = UtilGenerics.cast(serviceResponse.get("components"));
String routingId = (String)serviceResponse.get("workEffortId");
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
index 4223295..7f911ba 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
@@ -6592,9 +6592,7 @@ public class OrderServices {
//Enter the values in productPlanMap
productPlanMap.put(productId, planId);
}
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
serviceResult.clear();
@@ -6660,9 +6658,7 @@ public class OrderServices {
}
}
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
return ServiceUtil.returnSuccess();
@@ -6699,9 +6695,7 @@ public class OrderServices {
}
serviceCtx.clear();
}
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
return ServiceUtil.returnSuccess();
@@ -6749,9 +6743,7 @@ public class OrderServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
}
}
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
serviceResult.clear();
@@ -6802,9 +6794,7 @@ public class OrderServices {
if (ServiceUtil.isError(serviceResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
}
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
serviceResult.clear();
@@ -6872,9 +6862,7 @@ public class OrderServices {
serviceResult.clear();
}
}
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
return ServiceUtil.returnSuccess();
@@ -6940,9 +6928,7 @@ public class OrderServices {
serviceResult.clear();
}
}
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
return ServiceUtil.returnSuccess();
@@ -6988,9 +6974,7 @@ public class OrderServices {
}
}
}
- } catch (GenericEntityException e) {
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
return ServiceUtil.returnSuccess();
@@ -7183,10 +7167,8 @@ public class OrderServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
}
}
- } catch (GenericServiceException gse) {
+ } catch (GenericServiceException | GenericEntityException gse) {
return ServiceUtil.returnError(gse.getMessage());
- } catch (GenericEntityException gee) {
- return ServiceUtil.returnError(gee.getMessage());
}
return ServiceUtil.returnSuccess();
}
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java
index 85713b5..44c0e86 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java
@@ -132,9 +132,6 @@ public class QuoteServices {
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderServiceExceptionSeeLogs",locale));
- } catch (Exception e) {
- Debug.logError(e, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderServiceExceptionSeeLogs",locale));
}
// check for errors
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java
index 4531e82..30c18c8 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java
@@ -249,9 +249,7 @@ public class RequirementServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(results));
}
}
- } catch (GenericEntityException e) {
- Debug.logError(e, MODULE);
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, MODULE);
}
return ServiceUtil.returnSuccess();
@@ -345,9 +343,7 @@ public class RequirementServices {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(results));
}
}
- } catch (GenericEntityException e) {
- Debug.logError(e, MODULE);
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, MODULE);
}
return ServiceUtil.returnSuccess();
@@ -375,9 +371,7 @@ public class RequirementServices {
}
}
}
- } catch(GenericEntityException e){
- Debug.logError(e, MODULE);
- } catch(GenericServiceException e){
+ } catch(GenericEntityException | GenericServiceException e){
Debug.logError(e, MODULE);
}
return ServiceUtil.returnSuccess();
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
index 138caae..0373e5c 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
@@ -570,8 +570,6 @@ public class ShoppingListServices {
}
} catch (GenericEntityException gee) {
Debug.logInfo("updateShoppingListQuantitiesFromOrder error:"+gee.getMessage(), MODULE);
- } catch (Exception e) {
- Debug.logInfo("updateShoppingListQuantitiesFromOrder error:"+e.getMessage(), MODULE);
}
return result;
}
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java
index 0c0c781..5148be3 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java
@@ -112,8 +112,6 @@ public class OrderTestServices {
}
} catch (GenericServiceException gse) {
return ServiceUtil.returnError(gse.getMessage());
- } catch (Exception e) {
- return ServiceUtil.returnError(e.getMessage());
}
if (productsList.size() == 0) {
return ServiceUtil.returnError(UtilProperties.getMessage("OrderUiLabels",
@@ -172,8 +170,6 @@ public class OrderTestServices {
Debug.logInfo("Test sales order with id [" + orderId + "] has been shipped", MODULE);
} catch (GenericServiceException gse) {
Debug.logWarning("Unable to quick ship test sales order with id [" + orderId + "] with error: " + gse.getMessage(), MODULE);
- } catch (Exception exc) {
- Debug.logWarning("Unable to quick ship test sales order with id [" + orderId + "] with error: " + exc.getMessage(), MODULE);
}
}
diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
index b99f5c1..6b2e2f4 100644
--- a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
+++ b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
@@ -620,12 +620,9 @@ public class CommunicationEventServices {
delegator.store(contactListCommStatusRecord);
// Don't return a service error just because of failure for one address - just log the error and continue
- } catch (GenericEntityException nonFatalGEE) {
+ } catch (GenericEntityException | GenericServiceException nonFatalGEE) {
Debug.logError(nonFatalGEE, errorInSendEmailToContactListService, MODULE);
errorMessages.add(errorInSendEmailToContactListService + ": " + nonFatalGEE.getMessage());
- } catch (GenericServiceException nonFatalGSE) {
- Debug.logError(nonFatalGSE, errorInSendEmailToContactListService, MODULE);
- errorMessages.add(errorInSendEmailToContactListService + ": " + nonFatalGSE.getMessage());
}
}
} catch (GenericEntityException fatalGEE) {
@@ -1614,8 +1611,6 @@ public class CommunicationEventServices {
try (InputStream imageStream = imageUrl.openStream()) {
UtilHttp.streamContentToBrowser(response, imageStream, 43, "image/gif", null);
}
- } catch (MalformedURLException e) {
- Debug.logError(e, MODULE);
} catch (IOException e) {
Debug.logError(e, MODULE);
}
diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java b/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java
index 7fe2277..2235ce9 100644
--- a/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java
+++ b/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java
@@ -100,15 +100,9 @@ public class PartyContentWrapper implements ContentWrapper {
public List<String> getList(String contentTypeId) {
try {
return getPartyContentTextList(party, contentTypeId, locale, mimeTypeId, party.getDelegator(), dispatcher);
- } catch (GeneralException ge) {
- Debug.logError(ge, MODULE);
- return null;
- } catch (IOException ioe) {
+ } catch (GeneralException | IOException ioe) {
Debug.logError(ioe, MODULE);
return null;
- } catch (Exception e) {
- Debug.logError(e, MODULE);
- return null;
}
}
@@ -174,11 +168,7 @@ public class PartyContentWrapper implements ContentWrapper {
partyContentCache.put(cacheKey, outString);
}
return outString;
- } catch (GeneralException e) {
- Debug.logError(e, "Error rendering PartyContent, inserting empty String", MODULE);
- String candidateOut = party.getModelEntity().isField(candidateFieldName) ? party.getString(candidateFieldName): "";
- return candidateOut == null? "" : encoder.sanitize(candidateOut, null);
- } catch (IOException e) {
+ } catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering PartyContent, inserting empty String", MODULE);
String candidateOut = party.getModelEntity().isField(candidateFieldName) ? party.getString(candidateFieldName): "";
return candidateOut == null? "" : encoder.sanitize(candidateOut, null);
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java
index 59dcecf..435ebd5 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java
@@ -113,10 +113,7 @@ public class CategoryContentWrapper implements ContentWrapper {
outString = encoder.sanitize(outString, null);
categoryContentCache.put(cacheKey, outString);
return outString;
- } catch (GeneralException e) {
- Debug.logError(e, "Error rendering CategoryContent, inserting empty String", MODULE);
- return productCategory.getString(candidateFieldName);
- } catch (IOException e) {
+ } catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering CategoryContent, inserting empty String", MODULE);
return productCategory.getString(candidateFieldName);
}
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java
index a530b05..e0ddea5 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java
@@ -311,13 +311,7 @@ public final class SeoConfigUtil {
// no "char-filters" element
Debug.logWarning("No " + ELEMENT_CHAR_FILTER + " element found in " + seoConfigFilename.toString(), MODULE);
}
- } catch (SAXException e) {
- result = "error";
- Debug.logError(e, MODULE);
- } catch (ParserConfigurationException e) {
- result = "error";
- Debug.logError(e, MODULE);
- } catch (IOException e) {
+ } catch (SAXException | IOException | ParserConfigurationException e) {
result = "error";
Debug.logError(e, MODULE);
}
diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java
index 4e499dc..8e881b5 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java
@@ -994,9 +994,7 @@ public class PackingSession implements java.io.Serializable {
return shipmentCostEstimate;
}
- } catch (GenericEntityException e) {
- Debug.logError(e, MODULE);
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, MODULE);
}
diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java
index 423a1cc..f0841a8 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java
@@ -863,12 +863,9 @@ public class ShipmentServices {
if (ServiceUtil.isError(serviceResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
}
- } catch (GenericEntityException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException se) {
- Debug.logError(se, MODULE);
- return ServiceUtil.returnError(se.getMessage());
}
return ServiceUtil.returnSuccess();
}
@@ -909,9 +906,7 @@ public class ShipmentServices {
results.put("newShipmentRouteSegmentId", tmpResult.get("shipmentRouteSegmentId"));
return results;
}
- } catch (GenericEntityException ex) {
- return ServiceUtil.returnError(ex.getMessage());
- } catch (GenericServiceException ex) {
+ } catch (GenericEntityException | GenericServiceException ex) {
return ServiceUtil.returnError(ex.getMessage());
}
}
@@ -1030,10 +1025,7 @@ public class ShipmentServices {
packageTotalValue = packageTotalValue.add(packageContentValue);
}
- } catch (GenericEntityException e) {
- Debug.logError(e, MODULE);
- return ServiceUtil.returnError(e.getMessage());
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(e.getMessage());
}
@@ -1121,9 +1113,6 @@ public class ShipmentServices {
} catch (GenericServiceException gse) {
Debug.logError(gse, "Problem sending mail", MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemSendingEmail", localePar));
- } catch (Exception e) {
- Debug.logError(e, "Problem sending mail", MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemSendingEmail", localePar));
}
// check for errors
if (sendResp != null && ServiceUtil.isError(sendResp)) {
@@ -1176,12 +1165,8 @@ public class ShipmentServices {
}
} catch (GenericEntityException gee) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE,
- "FacilityShipmentGatewayConfigFromShipmentError",
+ "FacilityShipmentGatewayConfigFromShipmentError",
UtilMisc.toMap("errorString", gee.getMessage()), locale));
- } catch (Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE,
- "FacilityShipmentGatewayConfigFromShipmentError",
- UtilMisc.toMap("errorString", e.getMessage()), locale));
}
return shipmentGatewayConfig;
}
diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java
index e7f1544..8dc6385 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java
@@ -292,21 +292,7 @@ public class DhlServices {
rateResponseDocument = UtilXml.readXmlDocument(rateResponseString, false);
return handleDhlRateResponse(rateResponseDocument, locale);
}
- catch (SAXException e2) {
- String excErrMsg = "Error parsing the RatingServiceResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "FacilityShipmentFedexShipmentTemplateParsingError",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- }
- catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the RatingServiceResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "FacilityShipmentFedexShipmentTemplateParsingError",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- }
- catch (IOException e2) {
+ catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the RatingServiceResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -444,19 +430,7 @@ public class DhlServices {
registerResponseDocument = UtilXml.readXmlDocument(registerResponseString, false);
result = handleDhlRegisterResponse(registerResponseDocument, locale);
Debug.logInfo("DHL response for DHL Register Account:" + registerResponseString, MODULE);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the RegisterAccountServiceSelectionResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "FacilityShipmentDhlErrorParsingRegisterAccountResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the RegisterAccountServiceSelectionResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "FacilityShipmentDhlErrorParsingRegisterAccountResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the RegisterAccountServiceSelectionResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -788,12 +762,7 @@ public class DhlServices {
}
// pass to handler method
return handleDhlShipmentConfirmResponse(responseString, shipmentRouteSegment, shipmentPackageRouteSegs, locale);
- } catch (GenericEntityException e) {
- Debug.logError(e, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "FacilityShipmentFedexRateTemplateReadingError",
- UtilMisc.toMap("errorString", e.toString()), locale));
- } catch (GenericServiceException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
"FacilityShipmentFedexRateTemplateReadingError",
@@ -811,18 +780,10 @@ public class DhlServices {
Document rateResponseDocument = null;
try {
rateResponseDocument = UtilXml.readXmlDocument(rateResponseString, false);
- } catch (SAXException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
// TODO: VOID
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- // TODO VOID
- } catch (IOException e2) {
- String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- // TODO VOID
}
// tracking number: Shipment/ShipmentDetail/AirbillNbr
diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java
index ebe9e3a..53b3a24 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java
@@ -959,16 +959,11 @@ public class FedexServices {
// Pass the reply to the handler method
return handleFedexShipReply(fDXShipReplyString, shipmentRouteSegment, shipmentPackageRouteSegs, locale);
- } catch (GenericEntityException e) {
+ } catch (GenericEntityException | GenericServiceException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
"FacilityShipmentFedexShipmentTemplateServiceError",
UtilMisc.toMap("errorString", e.toString()), locale));
- } catch (GenericServiceException se) {
- Debug.logError(se, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "FacilityShipmentFedexShipmentTemplateServiceError",
- UtilMisc.toMap("errorString", se.toString()), locale));
}
}
diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
index ded7bdc..3a4b841 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
@@ -662,17 +662,7 @@ public class UpsServices {
Document shipmentConfirmResponseDocument = null;
try {
shipmentConfirmResponseDocument = UtilXml.readXmlDocument(shipmentConfirmResponseString, false);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the ShipmentConfirmResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentConfirm",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the ShipmentConfirmResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentConfirm",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the ShipmentConfirmResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentConfirm",
@@ -935,17 +925,7 @@ public class UpsServices {
Document shipmentAcceptResponseDocument = null;
try {
shipmentAcceptResponseDocument = UtilXml.readXmlDocument(shipmentAcceptResponseString, false);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the ShipmentAcceptResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentAcceptResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the ShipmentAcceptResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentAcceptResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the ShipmentAcceptResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentAcceptResponse",
@@ -1317,17 +1297,7 @@ public class UpsServices {
Document voidShipmentResponseDocument = null;
try {
voidShipmentResponseDocument = UtilXml.readXmlDocument(voidShipmentResponseString, false);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the VoidShipmentResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingVoidShipmentResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the VoidShipmentResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingVoidShipmentResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the VoidShipmentResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingVoidShipmentResponse",
@@ -1513,17 +1483,7 @@ public class UpsServices {
Document trackResponseDocument = null;
try {
trackResponseDocument = UtilXml.readXmlDocument(trackResponseString, false);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the TrackResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingTrackResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the TrackResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingTrackResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the TrackResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingTrackResponse",
@@ -2099,17 +2059,7 @@ public class UpsServices {
Document rateResponseDocument = null;
try {
rateResponseDocument = UtilXml.readXmlDocument(rateResponseString, false);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingRatingServiceSelectionResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingRatingServiceSelectionResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingRatingServiceSelectionResponse",
@@ -2205,19 +2155,7 @@ public class UpsServices {
Document avResponseDocument = null;
try {
avResponseDocument = UtilXml.readXmlDocument(avResponseString, false);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the UPS response: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "FacilityShipmentUpsErrorParsingAddressVerificationResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the UPS response: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "FacilityShipmentUpsErrorParsingAddressVerificationResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the UPS response: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -2551,17 +2489,7 @@ public class UpsServices {
Document shipmentConfirmResponseDocument = null;
try {
shipmentConfirmResponseDocument = UtilXml.readXmlDocument(shipmentConfirmResponseString, false);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the ShipmentConfirmResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentConfirm",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the ShipmentConfirmResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentConfirm",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the ShipmentConfirmResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingShipmentConfirm",
@@ -2961,17 +2889,7 @@ public class UpsServices {
Document rateResponseDocument = null;
try {
rateResponseDocument = UtilXml.readXmlDocument(rateResponseString, false);
- } catch (SAXException e2) {
- String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingRatingServiceSelectionResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (ParserConfigurationException e2) {
- String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
- Debug.logError(e2, excErrMsg, MODULE);
- return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingRatingServiceSelectionResponse",
- UtilMisc.toMap("errorString", e2.toString()), locale));
- } catch (IOException e2) {
+ } catch (SAXException | IOException | ParserConfigurationException e2) {
String excErrMsg = "Error parsing the RatingServiceSelectionResponse: " + e2.toString();
Debug.logError(e2, excErrMsg, MODULE);
return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorParsingRatingServiceSelectionResponse",
diff --git a/applications/securityext/src/main/java/org/apache/ofbiz/securityext/cert/CertificateServices.java b/applications/securityext/src/main/java/org/apache/ofbiz/securityext/cert/CertificateServices.java
index 3ee6a56..d9ed4e6 100644
--- a/applications/securityext/src/main/java/org/apache/ofbiz/securityext/cert/CertificateServices.java
+++ b/applications/securityext/src/main/java/org/apache/ofbiz/securityext/cert/CertificateServices.java
@@ -59,10 +59,8 @@ public class CertificateServices {
X509Certificate cert;
try {
cert = (X509Certificate) KeyStoreUtil.pemToCert(certString);
- } catch (CertificateException e) {
+ } catch (CertificateException | IOException e) {
return ServiceUtil.returnError(e.getMessage());
- } catch (IOException e) {
- return ServiceUtil.returnError(e.getMessage());
}
// store the cert
diff --git a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/content/WorkEffortContentWrapper.java b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/content/WorkEffortContentWrapper.java
index bd2f307..f60d9f9 100644
--- a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/content/WorkEffortContentWrapper.java
+++ b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/content/WorkEffortContentWrapper.java
@@ -262,11 +262,7 @@ public class WorkEffortContentWrapper implements ContentWrapper {
workEffortContentCache.put(cacheKey, outString);
}
return outString;
- } catch (GeneralException e) {
- Debug.logError(e, "Error rendering WorkEffortContent, inserting empty String", MODULE);
- String candidateOut = workEffort.getModelEntity().isField(candidateFieldName) ? workEffort.getString(candidateFieldName): "";
- return candidateOut == null? "" : encoder.sanitize(candidateOut, null);
- } catch (IOException e) {
+ } catch (GeneralException | IOException e) {
Debug.logError(e, "Error rendering WorkEffortContent, inserting empty String", MODULE);
String candidateOut = workEffort.getModelEntity().isField(candidateFieldName) ? workEffort.getString(candidateFieldName): "";
return candidateOut == null? "" : encoder.sanitize(candidateOut, null);
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
index 9bbfa76..1ee2e91 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
@@ -152,9 +152,7 @@ public final class EntityCrypto {
byte[] decryptedBytes = handler.decryptValue(key, encryptMethod, encryptedString);
try {
return UtilObject.getObjectException(decryptedBytes);
- } catch (ClassNotFoundException e) {
- throw new GeneralException(e);
- } catch (IOException e) {
+ } catch (ClassNotFoundException | IOException e) {
throw new GeneralException(e);
}
}
diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java
index ea4a7c9..d1e1996 100644
--- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java
+++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java
@@ -74,9 +74,7 @@ public class DelegatorEcaHandler implements EntityEcaHandler<EntityEcaRule> {
Future<DispatchContext> future = this.dctx.get();
try {
return future != null ? future.get() : null;
- } catch (ExecutionException e) {
- throw (GenericEntityException) new GenericEntityException(e.getMessage()).initCause(e);
- } catch (InterruptedException e) {
+ } catch (ExecutionException | InterruptedException e) {
throw (GenericEntityException) new GenericEntityException(e.getMessage()).initCause(e);
}
}
diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java
index 9d55f6b..923be16 100644
--- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java
+++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java
@@ -501,8 +501,6 @@ public class EntitySyncServices {
// write the XML file
try {
UtilXml.writeXmlDocument(fileName, mainDoc);
- } catch (java.io.FileNotFoundException e) {
- throw new EntitySyncContext.SyncOtherErrorException(e);
} catch (java.io.IOException e) {
throw new EntitySyncContext.SyncOtherErrorException(e);
}
@@ -533,11 +531,7 @@ public class EntitySyncServices {
Document xmlSyncDoc = null;
try {
xmlSyncDoc = UtilXml.readXmlDocument(xmlFile, false);
- } catch (SAXException e) {
- Debug.logError(e, MODULE);
- } catch (ParserConfigurationException e) {
- Debug.logError(e, MODULE);
- } catch (IOException e) {
+ } catch (SAXException | IOException | ParserConfigurationException e) {
Debug.logError(e, MODULE);
}
if (xmlSyncDoc == null) {
@@ -566,14 +560,13 @@ public class EntitySyncServices {
// store the value(s)
Map<String, Object> storeResult = dispatcher.runSync("storeEntitySyncData", storeContext);
if (ServiceUtil.isError(storeResult)) {
- throw new Exception(ServiceUtil.getErrorMessage(storeResult));
+ throw new GenericServiceException(ServiceUtil.getErrorMessage(storeResult));
}
// TODO create a response document to send back to the initial sync machine
- } catch (GenericServiceException gse) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityExtUnableToLoadXMLDocument", UtilMisc.toMap("entitySyncId", entitySyncId, "startTime", startTime, "errorString", gse.getMessage()), locale));
- } catch (Exception e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityExtUnableToLoadXMLDocument", UtilMisc.toMap("entitySyncId", entitySyncId, "startTime", startTime, "errorString", e.getMessage()), locale));
+ } catch (GenericServiceException | IOException | ParserConfigurationException | SAXException | SerializeException gse) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityExtUnableToLoadXMLDocument",
+ UtilMisc.toMap("entitySyncId", entitySyncId, "startTime", startTime, "errorString", gse.getMessage()), locale));
}
}
}
diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/engine/GenericAsyncEngine.java b/framework/service/src/main/java/org/apache/ofbiz/service/engine/GenericAsyncEngine.java
index 21d9913..dbec976 100644
--- a/framework/service/src/main/java/org/apache/ofbiz/service/engine/GenericAsyncEngine.java
+++ b/framework/service/src/main/java/org/apache/ofbiz/service/engine/GenericAsyncEngine.java
@@ -114,13 +114,9 @@ public abstract class GenericAsyncEngine extends AbstractEngine {
jobV.create();
} catch (GenericEntityException e) {
throw new GenericServiceException("Unable to create persisted job", e);
- } catch (SerializeException e) {
- throw new GenericServiceException("Problem serializing service attributes", e);
} catch (FileNotFoundException e) {
throw new GenericServiceException("Problem serializing service attributes", e);
- } catch (IOException e) {
- throw new GenericServiceException("Problem serializing service attributes", e);
- } catch (GenericConfigException e) {
+ } catch (SerializeException | GenericConfigException | IOException e) {
throw new GenericServiceException("Problem serializing service attributes", e);
}
diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java b/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java
index 23dfc2e..9c192f3 100644
--- a/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java
+++ b/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java
@@ -439,10 +439,7 @@ public class MimeMessageWrapper implements java.io.Serializable {
mainIndex = Integer.parseInt(indexSplit[0]);
subIndex = Integer.parseInt(indexSplit[1]);
}
- } catch (NumberFormatException e) {
- Debug.logError(e, "Illegal index string format. Should be part 'dot' subpart: " + indexStr, MODULE);
- return null;
- } catch (ArrayIndexOutOfBoundsException e) {
+ } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
Debug.logError(e, "Illegal index string format. Should be part 'dot' subpart: " + indexStr, MODULE);
return null;
}
diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/ExampleRemoteClient.java b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/ExampleRemoteClient.java
index 168c856..cd037aa 100644
--- a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/ExampleRemoteClient.java
+++ b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/ExampleRemoteClient.java
@@ -55,11 +55,7 @@ public class ExampleRemoteClient {
public ExampleRemoteClient() {
try {
rd = (RemoteDispatcher) Naming.lookup(RMI_URL);
- } catch (NotBoundException e) {
- e.printStackTrace();
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (RemoteException e) {
+ } catch (NotBoundException | RemoteException | MalformedURLException e) {
e.printStackTrace();
}
}
diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/xmlrpc/AliasSupportedTransportFactory.java b/framework/service/src/main/java/org/apache/ofbiz/service/xmlrpc/AliasSupportedTransportFactory.java
index f00a140..614b220 100644
--- a/framework/service/src/main/java/org/apache/ofbiz/service/xmlrpc/AliasSupportedTransportFactory.java
+++ b/framework/service/src/main/java/org/apache/ofbiz/service/xmlrpc/AliasSupportedTransportFactory.java
@@ -99,9 +99,7 @@ public class AliasSupportedTransportFactory extends XmlRpcTransportFactoryImpl {
try {
scon.setSSLSocketFactory(SSLUtil.getSSLSocketFactory(ks, password, alias));
scon.setHostnameVerifier(SSLUtil.getHostnameVerifier(SSLUtil.getHostCertMinCheck()));
- } catch (GeneralException e) {
- throw new IOException(e.getMessage());
- } catch (GeneralSecurityException e) {
+ } catch (GeneralException | GeneralSecurityException e) {
throw new IOException(e.getMessage());
}
}
diff --git a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/SimpleMethodTest.java b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/SimpleMethodTest.java
index 7c3f455..147d138 100644
--- a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/SimpleMethodTest.java
+++ b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/SimpleMethodTest.java
@@ -107,9 +107,7 @@ public class SimpleMethodTest extends OFBizTestCase {
}
}
- } catch (MiniLangException e) {
- result.addError(this, e);
- } catch (SecurityConfigurationException e) {
+ } catch (MiniLangException | SecurityConfigurationException e) {
result.addError(this, e);
}
diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java
index 678f224..7888130 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java
@@ -498,9 +498,6 @@ public class CoreEvents {
FileInputStream fis = new FileInputStream(file);
UtilHttp.streamContentToBrowser(response, fis, length, null);
fis.close();
- } catch (FileNotFoundException e) {
- Debug.logError(e, MODULE);
- return "error";
} catch (IOException e) {
Debug.logError(e, MODULE);
return "error";
diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java
index 31a3e52..95c461a 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java
@@ -94,9 +94,7 @@ public class WebDavServlet extends GenericServlet {
RequestHandler handler = this.handlerFactory.getHandler(httpRequest.getMethod());
try {
handler.handleRequest(httpRequest, (HttpServletResponse) response, this.getServletContext());
- } catch (IOException e) {
- throw e;
- } catch (ServletException e) {
+ } catch (IOException | ServletException e) {
throw e;
} catch (Exception e) {
throw new ServletException(e);
diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
index a3d10f5..70f41f6 100644
--- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
+++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
@@ -198,8 +198,6 @@ public class WebToolsServices {
}
} catch (GenericServiceException gsex) {
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportParsingError", UtilMisc.toMap("errorString", gsex.getMessage()), locale));
- } catch (Exception ex) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportParsingError", UtilMisc.toMap("errorString", ex.getMessage()), locale));
}
} else {
messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportNoXmlFileSpecified", locale));
@@ -387,11 +385,7 @@ public class WebToolsServices {
try {
errorMessages.add("Checking data in [" + dataUrl.toExternalForm() + "]");
rowsChanged = EntityDataAssert.assertData(dataUrl, delegator, errorMessages);
- } catch (SAXException e) {
- errorMessages.add("Error checking data in [" + dataUrl.toExternalForm() + "]: " + e.toString());
- } catch (ParserConfigurationException e) {
- errorMessages.add("Error checking data in [" + dataUrl.toExternalForm() + "]: " + e.toString());
- } catch (IOException e) {
+ } catch (SAXException | IOException | ParserConfigurationException e) {
errorMessages.add("Error checking data in [" + dataUrl.toExternalForm() + "]: " + e.toString());
}
} else {
diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
index 1f4a6ce..7ac52a0 100644
--- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
+++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
@@ -321,9 +321,7 @@ public class ArtifactInfoFactory {
} else if ("view".equals(type)) {
return this.getControllerViewArtifactInfo(new URL(artifactLocation), artifactName);
}
- } catch (GeneralException e) {
- Debug.logError(e, "Error getting artifact info: " + e.toString(), MODULE);
- } catch (MalformedURLException e) {
+ } catch (GeneralException | MalformedURLException e) {
Debug.logError(e, "Error getting artifact info: " + e.toString(), MODULE);
}
return null;
diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
index 49e52e0..d4ac8c3 100644
--- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
+++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
@@ -61,11 +61,7 @@ public class FormWidgetArtifactInfo extends ArtifactInfoBase {
this.formLocation = formLocation;
try {
this.modelForm = aif.getModelForm(formName, formLocation);
- } catch (ParserConfigurationException e) {
- throw new GeneralException(e);
- } catch (SAXException e) {
- throw new GeneralException(e);
- } catch (IOException e) {
+ } catch (ParserConfigurationException | IOException | SAXException e) {
throw new GeneralException(e);
}
}
diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
index e60dc43..33220a1 100644
--- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
+++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
@@ -59,13 +59,7 @@ public class ScreenWidgetArtifactInfo extends ArtifactInfoBase {
this.screenLocation = screenLocation;
try {
this.modelScreen = aif.getModelScreen(screenName, screenLocation);
- } catch (IllegalArgumentException e) {
- throw new GeneralException(e);
- } catch (ParserConfigurationException e) {
- throw new GeneralException(e);
- } catch (SAXException e) {
- throw new GeneralException(e);
- } catch (IOException e) {
+ } catch (IllegalArgumentException | IOException | SAXException | ParserConfigurationException e) {
throw new GeneralException(e);
}
diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
index 4b44550..0d0c88c 100644
--- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
+++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
@@ -104,9 +104,6 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
String javaFile = null;
try {
javaFile = FileUtil.readTextFile(fullClassPathAndFile, true).toString();
- } catch (FileNotFoundException e) {
- Debug.logWarning("Error reading java file [" + fullClassPathAndFile + "] for service implementation: " + e.toString(), MODULE);
- return;
} catch (IOException e) {
Debug.logWarning("Error reading java file [" + fullClassPathAndFile + "] for service implementation: " + e.toString(), MODULE);
return;
@@ -166,9 +163,6 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
String javaFile = null;
try {
javaFile = FileUtil.readTextFile(fullClassPathAndFile, true).toString();
- } catch (FileNotFoundException e) {
- Debug.logWarning("Error reading java file [" + fullClassPathAndFile + "] for service implementation: " + e.toString(), MODULE);
- return;
} catch (IOException e) {
Debug.logWarning("Error reading java file [" + fullClassPathAndFile + "] for service implementation: " + e.toString(), MODULE);
return;