Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3728

Fix error handling in PrivilegedFileOpsForTests

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.5.1.1
    • Fix Version/s: 10.5.1.1
    • Component/s: Test
    • Labels:
      None

      Description

      The exception handling in this utility class is unclear and can in some cases cause ClassCastException to be thrown.
      Note that SecurityException is a runtime exception.

      Potential issues to be fixed:
      1) Avoid possibility of ClassCastException in 'getFileInputStream'
      2) Don't include SecurityException in the signature (throws clause)
      3) Document SecurityException in JavaDoc.

      Points 2 and 3 leads to the option of not catching SecurityException, which allows the code to be written more concisely and we can use PrivilegedAction instead of PrivilegedExceptionAction in some cases.

      There is also a missing character in the class name in the header, and an invalid JavaDoc tag in the class JavaDoc.

        Attachments

        1. derby-3728-1a.diff
          6 kB
          Kristian Waagan

          Activity

            People

            • Assignee:
              kristwaa Kristian Waagan
              Reporter:
              kristwaa Kristian Waagan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: