marcsaeg 2003/07/01 14:02:14
Modified: src/share/org/apache/tomcat/util Tag: tomcat_32
FileUtil.java
Log:
Performance improvments. Removed lots of calls to String.charAt() and
repeated calls to System.getProperty() for properties that will never
change.
Revision Changes Path
No revision
No revision
1.9.2.9 +8 -6
jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/FileUtil.java
Index: FileUtil.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/FileUtil.java,v
retrieving revision 1.9.2.8
retrieving revision 1.9.2.9
diff -u -r1.9.2.8 -r1.9.2.9
--- FileUtil.java 21 Mar 2001 22:23:06 -0000 1.9.2.8
+++ FileUtil.java 1 Jul 2003 21:02:13 -0000 1.9.2.9
@@ -84,6 +84,8 @@
public class FileUtil {
+ private static boolean isNetware =
System.getProperty("os.name").startsWith("NetWare");
+
public static File[] listFiles(File dir) {
String[] ss = dir.list();
@@ -244,7 +246,7 @@
patchPath.charAt(1) == ':') {
char[] ca = patchPath.replace('/', '\\').toCharArray();
char c;
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = new StringBuffer(ca.length);
for (int i = 0; i < ca.length; i++) {
if ((ca[i] != '\\') ||
@@ -268,7 +270,7 @@
}
// fix path on NetWare - all '/' become '\\' and remove duplicate '\\'
- if (System.getProperty("os.name").startsWith("NetWare") &&
+ if (isNetware &&
path.length() >=3 &&
path.indexOf(':') > 0) {
char ca[] = patchPath.replace('/', '\\').toCharArray();
@@ -297,7 +299,7 @@
return true;
// NetWare volume:
- if (System.getProperty("os.name").startsWith("NetWare") &&
+ if (isNetware &&
path.length() >=3 &&
path.indexOf(':') > 0)
return true;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]