You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2018/08/01 22:57:39 UTC

[uima-uimafit] 01/01: [UIMA-2903] List resources in a ResourceManager / remove hack in uimaFIT

This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch feature/UIMA-2903-List-resources-in-a-ResourceManager
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit 0656f1977d53d10353aed28f77b70b77aa1e92dc
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Thu Aug 2 00:57:33 2018 +0200

    [UIMA-2903] List resources in a ResourceManager / remove hack in uimaFIT
    
    - Finally remove the hack in uimaFIT
---
 .../initialize/ExternalResourceInitializer.java    | 28 +---------------------
 1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/uimafit-core/src/main/java/org/apache/uima/fit/component/initialize/ExternalResourceInitializer.java b/uimafit-core/src/main/java/org/apache/uima/fit/component/initialize/ExternalResourceInitializer.java
index 2607cc3..ba0e4f0 100644
--- a/uimafit-core/src/main/java/org/apache/uima/fit/component/initialize/ExternalResourceInitializer.java
+++ b/uimafit-core/src/main/java/org/apache/uima/fit/component/initialize/ExternalResourceInitializer.java
@@ -226,32 +226,6 @@ public final class ExternalResourceInitializer {
               + resMgr.getClass() + "]");
     }
     
-    // UIMA-2903 - List resources in a ResourceManager / remove hack in uimaFIT
-    // This is how we do it after upgrading to UIMA 2.10.0
-    // return resMgr.getExternalResources();
-
-    // For UIMA 2.9.0 and before, we need to do this
-    Field resourceMapField = null;
-    try {
-      // Fetch the list of resources
-      resourceMapField = ReflectionUtil.getField(resMgr, "mResourceMap");
-      resourceMapField.setAccessible(true);
-      @SuppressWarnings("unchecked")
-      Map<String, Object> resources = (Map<String, Object>) resourceMapField.get(resMgr);
-
-      return resources.values();
-    } catch (SecurityException e) {
-      throw new ResourceInitializationException(e);
-    } catch (NoSuchFieldException e) {
-      throw new ResourceInitializationException(e);
-    } catch (IllegalArgumentException e) {
-      throw new ResourceInitializationException(e);
-    } catch (IllegalAccessException e) {
-      throw new ResourceInitializationException(e);
-    } finally {
-      if (resourceMapField != null) {
-        resourceMapField.setAccessible(false);
-      }
-    }
+    return resMgr.getExternalResources();
   }
 }