[jira] [Created] (OFBIZ-9724) [FB] Package org.apache.ofbiz.widget

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (OFBIZ-9724) [FB] Package org.apache.ofbiz.widget

Nicolas Malin (Jira)
Dennis Balkir created OFBIZ-9724:
------------------------------------

             Summary: [FB] Package org.apache.ofbiz.widget
                 Key: OFBIZ-9724
                 URL: https://issues.apache.org/jira/browse/OFBIZ-9724
             Project: OFBiz
          Issue Type: Sub-task
          Components: framework
    Affects Versions: Trunk
            Reporter: Dennis Balkir
            Priority: Minor


- WidgetFactory.java:102, REC_CATCH_EXCEPTION
REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.widget.WidgetFactory.loadStandardWidgets()

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 ...
  }

- WidgetFactory.java:102, DE_MIGHT_IGNORE
DE: org.apache.ofbiz.widget.WidgetFactory.loadStandardWidgets() might ignore java.lang.Exception

This method might ignore an exception.  In general, exceptions should be handled or reported in some way, or they should be thrown out of the method.

- WidgetWorker.java:89, DB_DUPLICATE_BRANCHES
DB: org.apache.ofbiz.widget.WidgetWorker.buildHyperlinkUrl(Appendable, String, String, Map, String, boolean, boolean, boolean, HttpServletRequest, HttpServletResponse, Map) uses the same code for two branches

This method uses the same code to implement two branches of a conditional branch. Check to ensure that this isn't a coding mistake.

- WidgetWorker.java:166, NP_NULL_PARAM_DEREF
NP: Null passed for nonnull parameter of makeHiddenFormLinkForm(Appendable, String, String, String, Map, ModelFormField, HttpServletRequest, HttpServletResponse, Map) in org.apache.ofbiz.widget.WidgetWorker.makeHyperlinkByType(Appendable, String, String, String, String, Map, String, String, String, ModelFormField, HttpServletRequest, HttpServletResponse, Map)

This method call passes a null value for a non-null method parameter. Either the parameter is annotated as a parameter that should always be non-null, or analysis has shown that it will always be dereferenced.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)