commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1367517 - in /commons/proper/vfs/trunk: core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java src/changes/changes.xml
Date Tue, 31 Jul 2012 12:32:13 GMT
Author: ggregory
Date: Tue Jul 31 12:32:12 2012
New Revision: 1367517

URL: http://svn.apache.org/viewvc?rev=1367517&view=rev
Log:
[VFS-435] FileSystemConfigBuilder does not use prefix for some system property lookups.

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
    commons/proper/vfs/trunk/src/changes/changes.xml

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java?rev=1367517&r1=1367516&r2=1367517&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
Tue Jul 31 12:32:12 2012
@@ -86,6 +86,17 @@ public abstract class FileSystemConfigBu
         return opts.getOption(getConfigClass(), name);
     }
 
+    /**
+     * Gets the system property for the given name.
+     * 
+     * @param name The name to lookup combined with the prefix.
+     * @return a system property.
+     */
+    private String getProperty(String name)
+    {
+        return System.getProperty(toPropertyKey(name));
+    }
+
     protected boolean hasParam(FileSystemOptions opts, String name)
     {
         return opts != null && opts.hasOption(getConfigClass(), name);
@@ -94,7 +105,7 @@ public abstract class FileSystemConfigBu
     /** @since 2.0 */
     protected boolean hasObject(FileSystemOptions opts, String name)
     {
-        return hasParam(opts, name) || System.getProperties().containsKey(PREFIX + name);
+        return hasParam(opts, name) || System.getProperties().containsKey(toPropertyKey(name));
     }
 
     /** @since 2.0 */
@@ -115,7 +126,7 @@ public abstract class FileSystemConfigBu
         Boolean value = (Boolean) getParam(opts, name);
         if (value == null)
         {
-            String str = System.getProperty(PREFIX + name);
+            String str = getProperty(name);
             if (str == null)
             {
                 return defaultValue;
@@ -143,7 +154,7 @@ public abstract class FileSystemConfigBu
         Byte value = (Byte) getParam(opts, name);
         if (value == null)
         {
-            String str = System.getProperty(this.prefix + name);
+            String str = getProperty(name);
             if (str == null)
             {
                 return defaultValue;
@@ -171,7 +182,7 @@ public abstract class FileSystemConfigBu
         Character value = (Character) getParam(opts, name);
         if (value == null)
         {
-            String str = System.getProperty(this.prefix + name);
+            String str = getProperty(name);
             if (str == null || str.length() <= 0)
             {
                 return defaultValue;
@@ -199,7 +210,7 @@ public abstract class FileSystemConfigBu
         Double value = (Double) getParam(opts, name);
         if (value == null)
         {
-            String str = System.getProperty(this.prefix + name);
+            String str = getProperty(name);
             if (str == null || str.length() <= 0)
             {
                 return defaultValue;
@@ -227,7 +238,7 @@ public abstract class FileSystemConfigBu
         Float value = (Float) getParam(opts, name);
         if (value == null)
         {
-            String str = System.getProperty(this.prefix + name);
+            String str = getProperty(name);
             if (str == null || str.length() <= 0)
             {
                 return defaultValue;
@@ -255,7 +266,7 @@ public abstract class FileSystemConfigBu
         Integer value = (Integer) getParam(opts, name);
         if (value == null)
         {
-            String str = System.getProperty(this.prefix + name);
+            String str = getProperty(name);
             if (str == null)
             {
                 return defaultValue;
@@ -283,7 +294,7 @@ public abstract class FileSystemConfigBu
         Long value = (Long) getParam(opts, name);
         if (value == null)
         {
-            String str = System.getProperty(this.prefix + name);
+            String str = getProperty(name);
             if (str == null)
             {
                 return defaultValue;
@@ -311,7 +322,7 @@ public abstract class FileSystemConfigBu
         Short value = (Short) getParam(opts, name);
         if (value == null)
         {
-            String str = System.getProperty(this.prefix + name);
+            String str = getProperty(name);
             if (str == null)
             {
                 return defaultValue;
@@ -333,7 +344,7 @@ public abstract class FileSystemConfigBu
         String value = (String) getParam(opts, name);
         if (value == null)
         {
-            value = System.getProperty(this.prefix + name);
+            value = getProperty(name);
             if (value == null)
             {
                 return defaultValue;
@@ -343,4 +354,16 @@ public abstract class FileSystemConfigBu
     }
 
     protected abstract Class<? extends FileSystem> getConfigClass();
+
+    /**
+     * Converts the given name into a System property key for this builder.
+     * 
+     * @param name a name to combine with the builder prefix.
+     * @return a System property key for this builder.
+     */
+    private String toPropertyKey(String name)
+    {
+        return this.prefix + name;
+    }
+
 }

Modified: commons/proper/vfs/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1367517&r1=1367516&r2=1367517&view=diff
==============================================================================
--- commons/proper/vfs/trunk/src/changes/changes.xml (original)
+++ commons/proper/vfs/trunk/src/changes/changes.xml Tue Jul 31 12:32:12 2012
@@ -23,6 +23,9 @@
 
   <body>
     <release version="2.1" date="TBD" description="New features and bug fix release.">
+      <action issue="VFS-435" dev="ggregory" type="add" due-to="george scott">
+        FileSystemConfigBuilder does not use prefix for some system property lookups.
+      </action>
       <action issue="VFS-434" dev="ggregory" type="add" due-to="ggregory">
         FileSystemException should reuse IOException's chained exception.
       </action>



Mime
View raw message