You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (Jira)" <de...@uima.apache.org> on 2021/11/10 17:36:00 UTC

[jira] [Resolved] (UIMA-6393) Circular imports break resource manager cache

     [ https://issues.apache.org/jira/browse/UIMA-6393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Eckart de Castilho resolved UIMA-6393.
----------------------------------------------
    Resolution: Fixed

> Circular imports break resource manager cache
> ---------------------------------------------
>
>                 Key: UIMA-6393
>                 URL: https://issues.apache.org/jira/browse/UIMA-6393
>             Project: UIMA
>          Issue Type: Bug
>          Components: UIMA
>            Reporter: Richard Eckart de Castilho
>            Assignee: Richard Eckart de Castilho
>            Priority: Major
>             Fix For: 3.3.0SDK, 3.2.1SDK
>
>
> 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:
> {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);
>   }
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)