Uploaded image for project: 'OODT (Retired)'
  1. OODT (Retired)
  2. OODT-741

Should the elementMap, subToSuperMap and productTypeElementMap fields in XMLValidationLayer be non-static?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.7
    • 0.7
    • file manager
    • Don't Know (Unsure) - The default level

    Description

      The TestXMLValidationLayer#testGetElements test currently fails when doing a full build/test of the File Manager component, with the following result:

      Results :

      Failed tests:
      testGetElements(org.apache.oodt.cas.filemgr.validation.TestXMLValidationLayer): There aren't exactly 4 elements in the test samples! expected:<4> but was:<11>

      This happens because the elementMap field in the XMLValidationLayer class is static (i.e. a class variable), so any data assigned to it persists between objects. When new data is written to the elementMap it is added or overwritten depending on the value of the String key, but data isn't removed from it when new XMLValidationLayer objects are created.

      The way that the test is written would imply that each XMLValidationLayer object should have its own elementMap. So I've experimented by removing the 'static' modifier from the elementMap, subToSuperMap and productTypeElementMap fields. This causes all TestXMLValidationLayer tests to pass and does not seem to affect any other File Manager tests (all other tests pass).

      Would this be an acceptable change or will it prevent other things from working?

      Attachments

        Activity

          People

            rlaidlaw Ross Laidlaw
            rlaidlaw Ross Laidlaw
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: