Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-6393

Circular imports break resource manager cache

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.3.0SDK
    • UIMA
    • None

    Description

      When a set of descriptors (e.g. TypeSystemDescription}}s) import each other, this can break the import cache in the {{ResourceManager.

      Consider the case of two type systems, each defining exactly one type:

      • Circular1.xml imports Circular2.xml
      • Circular2.xml imports Circular1.xml

      Then run the following code:

        @Test
        public void thatCircularImportsDoNotConfuseResourceManagerCache() throws Exception {
          ResourceManager resMgr = newDefaultResourceManager();
          File descriptor = getFile("TypeSystemDescriptionImplTest/Circular1.xml");
          TypeSystemDescription ts = xmlParser.parseTypeSystemDescription(new XMLInputSource(descriptor));
          ts.resolveImports(resMgr);
          TypeSystemDescription tsd = (TypeSystemDescription) resMgr.getImportCache().values().iterator()
                  .next();
          assertThat(ts.getTypes()).hasSize(2);
          
          TypeSystemDescription cachedTsd = (TypeSystemDescription) resMgr.getImportCache().values().iterator()
                  .next();
          assertThat(cachedTsd.getTypes()).hasSize(2);
        }
      

      This code loads the first type system and resolves its imports. The resolved type system Circular1 contains two types at the end - fine.

      However, Circular2 is cached in the resource manager - and if we fetch it from there, then we get it back without any imports and only containing a single type. The type it should have imported from Circular1 is not there.

      Attachments

        Activity

          People

            rec Richard Eckart de Castilho
            rec Richard Eckart de Castilho
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: