You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Andre Gillet <An...@cerence.com.INVALID> on 2023/11/22 16:59:37 UTC
ClassCastException in ImportResolver.resolveImports() when using custom ResourceManager
Hello,
Found in 3.4.1 but issue still seems to exist. We have a custom ResourceManager which implements the ResourceManager interface. Following code assumes that aResourceManager will always be a ResourceManager_impl.
Method signature defines ResourceManager aResourceManager:
https://github.com/apache/uima-uimaj/blob/81587d2e6894655af3b07b347a976fd92d8f7bf0/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/ImportResolver.java#L142-L144
private void resolveImports(DescriptorAdapter<DESCRIPTOR, COLLECTIBLE> aWrapper,
Set<String> aAlreadyVisited, Map<Key, COLLECTIBLE> aAllCollectedObjects,
Deque<String> aStack, ResourceManager aResourceManager) throws InvalidXMLException {
Casting aResourceManager to ResourceManager_impl causes ClassCastException:
https://github.com/apache/uima-uimaj/blob/81587d2e6894655af3b07b347a976fd92d8f7bf0/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/ImportResolver.java#L160
Map<String, XMLizable> importCache = ((ResourceManager_impl) aResourceManager).getImportCache();
Thanks,
Andre
Re: ClassCastException in ImportResolver.resolveImports() when using custom ResourceManager
Posted by Richard Eckart de Castilho <re...@apache.org>.
Hi,
could you inherit from ResouceManager_impl?
If not, why not?
What would you suggest to do?
Cheers,
-- Richard
> On 22. Nov 2023, at 17:59, Andre Gillet <An...@cerence.com.INVALID> wrote:
>
> Hello,
>
> Found in 3.4.1 but issue still seems to exist. We have a custom ResourceManager which implements the ResourceManager interface. Following code assumes that aResourceManager will always be a ResourceManager_impl.
>
> Method signature defines ResourceManager aResourceManager:
>
> https://github.com/apache/uima-uimaj/blob/81587d2e6894655af3b07b347a976fd92d8f7bf0/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/ImportResolver.java#L142-L144
>
> private void resolveImports(DescriptorAdapter<DESCRIPTOR, COLLECTIBLE> aWrapper,
> Set<String> aAlreadyVisited, Map<Key, COLLECTIBLE> aAllCollectedObjects,
> Deque<String> aStack, ResourceManager aResourceManager) throws InvalidXMLException {
>
> Casting aResourceManager to ResourceManager_impl causes ClassCastException:
>
> https://github.com/apache/uima-uimaj/blob/81587d2e6894655af3b07b347a976fd92d8f7bf0/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/ImportResolver.java#L160
>
> Map<String, XMLizable> importCache = ((ResourceManager_impl) aResourceManager).getImportCache();
>
> Thanks,
>
> Andre
>