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 2022/08/29 13:49:47 UTC

[uima-uimaj] 01/01: #247 - RelativePathResolver should consider TCCL

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

rec pushed a commit to branch feature/247-RelativePathResolver-should-consider-TCCL
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit 4823155af9373ee5d903c93eac1eee7eefbc09d3
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Mon Aug 29 15:49:40 2022 +0200

    #247 - RelativePathResolver should consider TCCL
    
    - Consider the TCCL in the RelativePathResolver_impl
---
 jVinci/.gitignore                                     |  1 +
 uimaj-adapter-vinci/.gitignore                        |  1 +
 uimaj-core/.gitignore                                 |  1 +
 .../uima/resource/impl/RelativePathResolver_impl.java | 19 ++++++++++++-------
 uimaj-cpe/.gitignore                                  |  1 +
 uimaj-tools/.gitignore                                |  1 +
 6 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/jVinci/.gitignore b/jVinci/.gitignore
index 00d2ab71d..f837dacf9 100644
--- a/jVinci/.gitignore
+++ b/jVinci/.gitignore
@@ -1,2 +1,3 @@
 /.apt_generated/
 /.apt_generated_tests/
+/META-INF/
diff --git a/uimaj-adapter-vinci/.gitignore b/uimaj-adapter-vinci/.gitignore
index 00d2ab71d..f837dacf9 100644
--- a/uimaj-adapter-vinci/.gitignore
+++ b/uimaj-adapter-vinci/.gitignore
@@ -1,2 +1,3 @@
 /.apt_generated/
 /.apt_generated_tests/
+/META-INF/
diff --git a/uimaj-core/.gitignore b/uimaj-core/.gitignore
index 00d2ab71d..f837dacf9 100644
--- a/uimaj-core/.gitignore
+++ b/uimaj-core/.gitignore
@@ -1,2 +1,3 @@
 /.apt_generated/
 /.apt_generated_tests/
+/META-INF/
diff --git a/uimaj-core/src/main/java/org/apache/uima/resource/impl/RelativePathResolver_impl.java b/uimaj-core/src/main/java/org/apache/uima/resource/impl/RelativePathResolver_impl.java
index 789dd25f2..55131cf20 100644
--- a/uimaj-core/src/main/java/org/apache/uima/resource/impl/RelativePathResolver_impl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/resource/impl/RelativePathResolver_impl.java
@@ -189,17 +189,22 @@ public class RelativePathResolver_impl implements RelativePathResolver {
 
     // fallback on classloader
     String f = aRelativeUrl.getFile();
-    URL absURL;
+    URL absURL = null;
     if (mClassLoader != null) {
       absURL = mClassLoader.getResource(f);
-    } else {// if no ClassLoader specified (could be the bootstrap classloader), try the system
-      // classloader
+    } 
+    
+    // fallback on TCCL
+    if (absURL == null) {
+        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+        absURL = tccl.getResource(f);
+    }
 
-      // https://issues.apache.org/jira/browse/UIMA-5902
-      ClassLoader tccl = Thread.currentThread().getContextClassLoader();
-      absURL = (tccl != null) ? tccl.getResource(f)
-              : ClassLoader.getSystemClassLoader().getResource(f);
+    // if no ClassLoader specified (could be the bootstrap classloader), try the system classloader
+    if (absURL == null && mClassLoader == null) {
+        absURL = ClassLoader.getSystemClassLoader().getResource(f);
     }
+
     return absURL;
   }
 
diff --git a/uimaj-cpe/.gitignore b/uimaj-cpe/.gitignore
index ab858ca0e..5f75f4ef6 100644
--- a/uimaj-cpe/.gitignore
+++ b/uimaj-cpe/.gitignore
@@ -3,3 +3,4 @@ checkpoint_synchPoint.xml
 checkpoint_synchPoint.xml.prev
 /.apt_generated/
 /.apt_generated_tests/
+/META-INF/
diff --git a/uimaj-tools/.gitignore b/uimaj-tools/.gitignore
index 00d2ab71d..f837dacf9 100644
--- a/uimaj-tools/.gitignore
+++ b/uimaj-tools/.gitignore
@@ -1,2 +1,3 @@
 /.apt_generated/
 /.apt_generated_tests/
+/META-INF/