Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-1452

Document that DefaultExecution#pop() can throw an exception

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 10.6
    • Fix Version/s: 10.9
    • Component/s: Context
    • Labels:
      None
    • Environment:
      Ubuntu 16.04.4 LTS, and McOs High Sierra-10.13.5
      Junit-4.12
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      The attached test suites for org.xwiki.context.internal.DefaultExecution.java and org.xwiki.logging.Message.java come from a prototype I have been working on which combines static analysis and automated test generation.

      The prototype analyses a specified dependency of a project to identify risky API calls which may potentially lead to runtime exceptions. Runtime exceptions may occur either because

      1. an API lacks sufficient documentation,or
      2. usage of the API does not conform to the specification, or
      3. API wrapper does not indicate the API specification as part of its own specification.

      The prototype then automatically generates test cases which show how such exceptions may be triggered.

      Observation:

      For xwiki-commons, {{JDK API}}s were analyzed. It seems that the failing methods do not handle the potential runtime exceptions declared for the {{JDK API}}s they invoke.

      Possible fixes:

      1. The failing methods under test could add internal checks on the values they forward to the {{JDK API}}s.
      2. The failing methods could handle the exceptions by adding relevant try/catch blocks.
      3. The failing methods under test could specify the potential exceptions by adding @throws in their documentation/method signatures.

        Attachments

          Activity

            People

            • Assignee:
              vmassol Vincent Massol
              Reporter:
              Mozhan Mozhan Soltani
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: