Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-489

[tests] ProviderWriteTests#testListener does not fail cleanly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Labels:
      None

      Description

      When running ProviderTests against my new implementation the #testListener() test failed (expected). However the exception cause the listener to not be unregistered, which in turn leads to a (random) next test failing with unexpected events. A try/finally solves the problem.

      public void testListener() throws Exception
      {
      final FileObject baseFile = createScratchFolder();

      FileObject child = baseFile.resolveFile("newfile.txt");
      assertTrue(!child.exists());

      FileSystem fs = baseFile.getFileSystem();
      TestListener listener = new TestListener(child);
      fs.addListener(child, listener);
      + try
      +

      { // Create as a folder ... + }

      finally

      { fs.removeListener(child, listener); + }

      }

      The problem happens for me in 2.0, but trunk seems to have the same problem: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java?revision=1437556&view=markup (Line 629)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              b.eckenfels Bernd Eckenfels
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: