[jboss-svn-commits] JBoss Common SVN: r4911 - in common-core/trunk: 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:26:45 EST 2012


Author: bmaxwell
Date: 2012-03-06 14:26:44 -0500 (Tue, 06 Mar 2012)
New Revision: 4911

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


Property changes on: common-core/trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /common-core/branches/2.2.16.GA_JBPAPP-6542:4894
   + /common-core/branches/2.2.16.GA_JBPAPP-6542:4894
/common-core/branches/2.2.18.GA_JBPAPP-8068:4910

Modified: common-core/trunk/src/main/java/org/jboss/net/protocol/file/FileURLConnection.java
===================================================================
--- common-core/trunk/src/main/java/org/jboss/net/protocol/file/FileURLConnection.java	2012-03-06 19:22:50 UTC (rev 4910)
+++ common-core/trunk/src/main/java/org/jboss/net/protocol/file/FileURLConnection.java	2012-03-06 19:26:44 UTC (rev 4911)
@@ -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