Thanks Marco and Jacques for this fix.
However let's consider this a quick fix that needs to be cleaned up: I see several formatting issues and also the name of the method could be enhanced (if we really need a new method...). Well... don't worry about it, I have already fixed the formal issues in rev. 682657

Jacopo


On Aug 5, 2008, at 11:36 AM, [EMAIL PROTECTED] wrote:

Author: jleroux
Date: Tue Aug  5 02:36:52 2008
New Revision: 682652

URL: http://svn.apache.org/viewvc?rev=682652&view=rev
Log:
A patch from Marco Ruocco solving an issue on Windows : File.separator in Windows system is "\", that is, also, the first character of an escape sequence. So the replaceAll method expects another char after that.

Modified:
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ FileUtil.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ FileUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/FileUtil.java?rev=682652&r1=682651&r2=682652&view=diff
= = = = = = = = ====================================================================== --- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ FileUtil.java (original) +++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ FileUtil.java Tue Aug 5 02:36:52 2008
@@ -46,12 +46,24 @@

    public static final String module = FileUtil.class.getName();

+    public static String escapeSeparator( String separator )
+    {
+      if( "\\".equals( separator ) )
+      {
+        return "\\" + separator;
+      }
+      else
+      {
+        return separator;
+      }
+    }
+
    public static File getFile(String path) {
-        return new File(path.replaceAll("/+|\\\\+", File.separator));
+ return new File(path.replaceAll("/+|\\\\+", escapeSeparator(File.separator)));
    }

    public static File getFile(File root, String path) {
- return new File(root, path.replaceAll("/+|\\\\+", File.separator)); + return new File(root, path.replaceAll("/+|\\\\+", escapeSeparator(File.separator)));
    }

public static void writeString(String fileName, String s) throws IOException {



Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to