Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • Trunk
    • 17.12.01
    • framework
    • None

    Description

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

      Attachments

        Activity

          People

            mbrohl Michael Brohl
            Dennis Balkir Dennis Balkir
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: