[
https://issues.apache.org/jira/browse/OFBIZ-9799?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dennis Balkir updated OFBIZ-9799:
---------------------------------
Attachment:
OFBIZ-9799_org.apache.ofbiz.shipment.thirdparty.fedex_bugfixes.patch
- Line 365: changed the {{catch (Exception e)}} to a multicatch to fix this
bug, since there is no need to catch RuntimeException
- Line 1020: added a standardcharset via {{UtilIo}} to {{getBytes}}
> [FB] Package org.apache.ofbiz.shipment.thirdparty.fedex
> -------------------------------------------------------
>
> Key: OFBIZ-9799
> URL: https://issues.apache.org/jira/browse/OFBIZ-9799
> Project: OFBiz
> Issue Type: Sub-task
> Components: framework
> Affects Versions: Trunk
> Reporter: Dennis Balkir
> Priority: Minor
> Attachments:
> OFBIZ-9799_org.apache.ofbiz.shipment.thirdparty.fedex_bugfixes.patch
>
>
> --- FedexServices.java:364, REC_CATCH_EXCEPTION
> REC: Exception is caught when Exception is not thrown in
> org.apache.ofbiz.shipment.thirdparty.fedex.FedexServices.fedexSubscriptionRequest(DispatchContext,
> Map)
> This method uses a try-catch block that catches Exception objects, but
> Exception is not thrown within the try block, and RuntimeException is not
> explicitly caught. It is a common bug pattern to say try { ... } catch
> (Exception e) { something } as a shorthand for catching a number of types of
> exception each of whose catch blocks is identical, but this construct also
> accidentally catches RuntimeException as well, masking potential bugs.
> A better approach is to either explicitly catch the specific exceptions that
> are thrown, or to explicitly catch RuntimeException exception, rethrow it,
> and then catch all non-Runtime Exceptions, as shown below:
> try {
> ...
> } catch (RuntimeException e) {
> throw e;
> } catch (Exception e) {
> ... deal with all non-runtime exceptions ...
> }
> --- FedexServices.java:1018, DM_DEFAULT_ENCODING
> Dm: Found reliance on default encoding in
> org.apache.ofbiz.shipment.thirdparty.fedex.FedexServices.handleFedexShipReply(String,
> GenericValue, List, Locale): String.getBytes()
> Found a call to a method which will perform a byte to String (or String to
> byte) conversion, and will assume that the default platform encoding is
> suitable. This will cause the application behaviour to vary between
> platforms. Use an alternative API and specify a charset name or Charset
> object explicitly.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)