Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-21519

NPE in StabilityServerSetupSnapshotRestoreTasks.tearDown() when setup assumptions fail

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • Test Suite
    • None
    • ---
    • ---

      The StabilityServerSetupSnapshotRestoreTasks class has a potential NullPointerException in its tearDown() method when JUnit assumptions fail during setup.

      The snapshot field is initialized to null (line 49), and is only assigned a value on line 82 via takeSnapshot(). However, the setup() method contains multiple Assume.assumeTrue() calls (lines 60-79) that can cause the test to be skipped before the snapshot is taken:

      • Line 60-62: Check if desired stability level is supported
      • Line 65-67: Check if reload-enhanced operation is available
      • Line 72: Check if reload-enhanced operation exists in target stability level
      • Line 79: Check if desired stability enables original stability

      When any of these assumptions fail, JUnit skips the test but still calls tearDown(). The unconditional snapshot.close() call on line 99 then throws a NullPointerException.

      When I reviewed the teardown impl I assumed that teardown is happening and introduced a regression when I switched the original snapshot restore task to this one.

              rhn-engineering-rhusar Radoslav Husar
              rhn-engineering-rhusar Radoslav Husar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: