[jboss-svn-commits] JBoss Common SVN: r4910 - in common-core/branches/2.2.18.GA_JBPAPP-8068: src/main/java/org/jboss/net/protocol/file and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Mar 6 14:22:51 EST 2012


Author: bmaxwell
Date: 2012-03-06 14:22:50 -0500 (Tue, 06 Mar 2012)
New Revision: 4910

Modified:
   common-core/branches/2.2.18.GA_JBPAPP-8068/pom.xml
   common-core/branches/2.2.18.GA_JBPAPP-8068/src/main/java/org/jboss/net/protocol/file/FileURLConnection.java
Log:
[JBPAPP-8068] Fix Regression introduced by JBCOMMON-106 in EAP 5.1.2 set -Dorg.jboss.net.protocol.file.useURI=false

Modified: common-core/branches/2.2.18.GA_JBPAPP-8068/pom.xml
===================================================================
--- common-core/branches/2.2.18.GA_JBPAPP-8068/pom.xml	2012-02-15 15:56:51 UTC (rev 4909)
+++ common-core/branches/2.2.18.GA_JBPAPP-8068/pom.xml	2012-03-06 19:22:50 UTC (rev 4910)
@@ -8,7 +8,7 @@
   <groupId>org.jboss</groupId>   
   <artifactId>jboss-common-core</artifactId>
   <packaging>jar</packaging>
-  <version>2.2.18.GA</version>
+  <version>2.2.18.GA_JBPAPP-8068</version>
   <name>JBoss Common Classes</name>
   <url>http://www.jboss.org/jboss-common</url>
   <description>JBoss Common Core Utility classes</description>
@@ -135,4 +135,4 @@
     
   </dependencies>  
   
-</project>
\ No newline at end of file
+</project>

Modified: common-core/branches/2.2.18.GA_JBPAPP-8068/src/main/java/org/jboss/net/protocol/file/FileURLConnection.java
===================================================================
--- common-core/branches/2.2.18.GA_JBPAPP-8068/src/main/java/org/jboss/net/protocol/file/FileURLConnection.java	2012-02-15 15:56:51 UTC (rev 4909)
+++ common-core/branches/2.2.18.GA_JBPAPP-8068/src/main/java/org/jboss/net/protocol/file/FileURLConnection.java	2012-03-06 19:22:50 UTC (rev 4910)
@@ -51,6 +51,27 @@
  */
 public class FileURLConnection extends URLConnection
 {
+   static boolean decodeFilePaths = true;
+
+   // JBPAPP-8065 - regression introduced where fixing JBCOMMON-106 exposed bugs in some third party frameworks,  
+   //  setting this property false enables the previous behavior to allow it to continue to work
+   static boolean useURI = true;
+
+   static
+   {
+      String flag = System.getProperty("org.jboss.net.protocol.file.decodeFilePaths");
+      if (flag != null)
+      {
+         decodeFilePaths = Boolean.valueOf(flag).booleanValue();
+      }
+
+      flag = System.getProperty("org.jboss.net.protocol.file.useURI");
+      if (flag != null)
+      {
+         useURI = Boolean.valueOf(flag).booleanValue();
+      }
+   }
+
    /** The underlying file */
    protected final File file;
 
@@ -59,7 +80,21 @@
       super(url);
       try
       {
-         file = new File(url.toURI());
+         if (useURI) 
+         {
+            file = new File(url.toURI());
+         } 
+         else
+         {
+            String path = url.getPath();
+            if (decodeFilePaths) 
+            {
+               path = URLDecoder.decode(path, "UTF-8");
+            }
+
+            // Convert the url '/' to the os file separator
+            file = new File(path.replace('/', File.separatorChar).replace('|', ':'));
+         }
          super.doOutput = false;
       }
       catch (URISyntaxException e)



More information about the jboss-svn-commits mailing list