commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r661646 - in /commons/proper/io/trunk/src: java/org/apache/commons/io/FileSystemUtils.java test/org/apache/commons/io/FileSystemUtilsTestCase.java
Date Fri, 30 May 2008 11:06:07 GMT
Author: niallp
Date: Fri May 30 04:06:07 2008
New Revision: 661646

URL: http://svn.apache.org/viewvc?rev=661646&view=rev
Log:
IO-167 Fix case-insensitive string handling - thanks to Benjamin Bentmann for the patch

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
    commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java?rev=661646&r1=661645&r2=661646&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java Fri May 30
04:06:07 2008
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 /**
@@ -76,7 +77,7 @@
             if (osName == null) {
                 throw new IOException("os.name not found");
             }
-            osName = osName.toLowerCase();
+            osName = osName.toLowerCase(Locale.ENGLISH);
             // match
             if (osName.indexOf("windows") != -1) {
                 os = WINDOWS;
@@ -417,7 +418,7 @@
             inr = new BufferedReader(new InputStreamReader(in));
             String line = inr.readLine();
             while (line != null && lines.size() < max) {
-                line = line.toLowerCase().trim();
+                line = line.toLowerCase(Locale.ENGLISH).trim();
                 lines.add(line);
                 line = inr.readLine();
             }

Modified: commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java?rev=661646&r1=661645&r2=661646&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/org/apache/commons/io/FileSystemUtilsTestCase.java Fri
May 30 04:06:07 2008
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.util.Locale;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -68,7 +69,7 @@
             // have to figure out unix block size
             String[] cmd = null;
             String osName = System.getProperty("os.name");
-            osName = osName.toLowerCase();
+            osName = osName.toLowerCase(Locale.ENGLISH);
 
             if (osName.indexOf("hp-ux") >= 0 || osName.indexOf("aix") >= 0) {
                 cmd = new String[] {"df", "-P", "/"};
@@ -84,7 +85,7 @@
             try {
                 r = new BufferedReader(new InputStreamReader(proc.getInputStream()));
                 String line = r.readLine();
-                if (line.toLowerCase().indexOf("512") >= 0) {
+                if (line.indexOf("512") >= 0) {
                     kilobyteBlock = false;
                 }
             } finally {



Mime
View raw message