You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2017/09/05 17:09:44 UTC

svn commit: r1807371 - /uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java

Author: schor
Date: Tue Sep  5 17:09:44 2017
New Revision: 1807371

URL: http://svn.apache.org/viewvc?rev=1807371&view=rev
Log:
[UIMA-5411] merge from v2 trunk from 4/27/17

Modified:
    uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java   (contents, props changed)

Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java?rev=1807371&r1=1807370&r2=1807371&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java Tue Sep  5 17:09:44 2017
@@ -137,10 +137,13 @@ public class Settings_impl implements Se
   }
 
   /**
-   * Load properties from the comma-separated list of files specified in the system property 
+   * Load properties from the comma-separated list of resources specified in the system property 
    *   UimaExternalOverrides
-   * Files are loaded in list order.  Duplicate properties are ignored so entries in a file override any in following files.
-   * The filesystem is searched first, and if not found and a relative name the datapath and classpath are searched.
+   * Resource names may be specified with a prefix of "file:" or "path:".
+   * If the prefix is "path:" the name must use the Java-style dotted format, similar to an import by name.
+   * The name is converted to a URL with a suffix of ".settings" and is looked up in the datapath and classpath.
+   * If the prefix is "file:" or is omitted the filesystem is searched.
+   * Resources are loaded in list order.  Duplicate properties are ignored so entries in a file override any in following files.
    * 
    * @throws ResourceConfigurationException wraps IOException
    */
@@ -152,20 +155,25 @@ public class Settings_impl implements Se
         UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(), "loadSystemDefaults",
                 LOG_RESOURCE_BUNDLE, "UIMA_external_overrides_load__CONFIG",
                 new Object[] { fname });
-        File f = new File(fname);
         try {
           InputStream is = null; 
-          if (f.exists()) {
-            is = new FileInputStream(fname);
-          } else if (f.isAbsolute()) {
-            throw new FileNotFoundException(fname + " - not in filesystem.");
-          } else {  // Look in datapath & classpath if a relative entry not in the filesystem
-            URL relativeUrl = new URL("file", "", fname);
+          if (fname.startsWith("path:")) {  // Convert to a url and search the datapath & classpath
+            URL relativeUrl = new URL("file", "", fname.substring(5).replace('.', '/')+".settings");
             URL relPath = relativePathResolver.resolveRelativePath(relativeUrl);
             if (relPath != null) {
               is = relPath.openStream();
             } else {
-              throw new FileNotFoundException(fname + " - not found in directory " + System.getProperty("user.dir") + " or in the datapath or classpath.");
+              throw new FileNotFoundException(fname + " - not found in the datapath or classpath.");
+            }
+          } else {            // Files may have an optional "file:" prefix
+            if (fname.startsWith("file:")) {
+              fname = fname.substring(5);
+            }
+            File f = new File(fname);
+            if (f.exists()) {
+              is = new FileInputStream(fname);
+            } else {
+              throw new FileNotFoundException(fname + " - not in filesystem.");
             }
           }
           try {

Propchange: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep  5 17:09:44 2017
@@ -5,4 +5,4 @@
 /uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java:1436573-1462257
 /uima/uimaj/branches/mavenAlign/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java:933273-944396
 /uima/uimaj/branches/test-parent-pom-6/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java:1024030
-/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java:1690273-1779993,1782840
+/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/Settings_impl.java:1690273-1807370