Author: markt
Date: Fri Dec 5 14:56:28 2014
New Revision: 1643310
URL: http://svn.apache.org/r1643310
Log:
Replace calls to System.getProperty("path.separator" with
File.pathSeperator
Modified:
tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java
tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
tomcat/trunk/java/org/apache/tomcat/jni/Library.java
tomcat/trunk/test/org/apache/juli/TestClassLoaderLogManager.java
Modified: tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java?rev=1643310&r1=1643309&r2=1643310&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java Fri Dec 5
14:56:28 2014
@@ -130,8 +130,6 @@ public class AntCompiler extends Compile
String javaFileName = ctxt.getServletJavaFileName();
String classpath = ctxt.getClassPath();
- String sep = System.getProperty("path.separator");
-
StringBuilder errorReport = new StringBuilder();
StringBuilder info=new StringBuilder();
@@ -149,7 +147,7 @@ public class AntCompiler extends Compile
Path path = new Path(project);
path.setPath(System.getProperty("java.class.path"));
info.append(" cp=" + System.getProperty("java.class.path") + "\n");
- StringTokenizer tokenizer = new StringTokenizer(classpath, sep);
+ StringTokenizer tokenizer = new StringTokenizer(classpath,
File.pathSeparator);
while (tokenizer.hasMoreElements()) {
String pathElement = tokenizer.nextToken();
File repository = new File(pathElement);
@@ -157,9 +155,10 @@ public class AntCompiler extends Compile
info.append(" cp=" + repository + "\n");
}
- if( log.isDebugEnabled() )
- log.debug( "Using classpath: " +
System.getProperty("java.class.path") + sep
- + classpath);
+ if (log.isDebugEnabled()) {
+ log.debug( "Using classpath: " +
System.getProperty("java.class.path") +
+ File.pathSeparator + classpath);
+ }
// Initializing sourcepath
Path srcPath = new Path(project);
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java?rev=1643310&r1=1643309&r2=1643310&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
(original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java Fri Dec
5 14:56:28 2014
@@ -398,7 +398,6 @@ public final class JspRuntimeContext {
private String initClassPath() {
StringBuilder cpath = new StringBuilder();
- String sep = System.getProperty("path.separator");
if (parentClassLoader instanceof URLClassLoader) {
URL [] urls = ((URLClassLoader)parentClassLoader).getURLs();
@@ -413,7 +412,7 @@ public final class JspRuntimeContext {
// Need to decode the URL, primarily to convert %20
// sequences back to spaces
String decoded = URLDecoder.decode(urls[i].getPath(),
"UTF-8");
- cpath.append(decoded + sep);
+ cpath.append(decoded + File.pathSeparator);
} catch (UnsupportedEncodingException e) {
// All JREs are required to support UTF-8
}
@@ -421,7 +420,7 @@ public final class JspRuntimeContext {
}
}
- cpath.append(options.getScratchDir() + sep);
+ cpath.append(options.getScratchDir() + File.pathSeparator);
String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH);
if (cp == null || cp.equals("")) {
Modified: tomcat/trunk/java/org/apache/tomcat/jni/Library.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/Library.java?rev=1643310&r1=1643309&r2=1643310&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/Library.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/Library.java Fri Dec 5 14:56:28
2014
@@ -17,6 +17,8 @@
package org.apache.tomcat.jni;
+import java.io.File;
+
/** Library
*
* @author Mladen Turk
@@ -49,8 +51,7 @@ public final class Library {
}
String name = System.mapLibraryName(NAMES[i]);
String path = System.getProperty("java.library.path");
- String sep = System.getProperty("path.separator");
- String [] paths = path.split(sep);
+ String [] paths = path.split(File.pathSeparator);
for (int j=0; j<paths.length; j++) {
java.io.File fd = new java.io.File(paths[j] , name);
if (fd.exists()) {
Modified: tomcat/trunk/test/org/apache/juli/TestClassLoaderLogManager.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/juli/TestClassLoaderLogManager.java?rev=1643310&r1=1643309&r2=1643310&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/juli/TestClassLoaderLogManager.java (original)
+++ tomcat/trunk/test/org/apache/juli/TestClassLoaderLogManager.java Fri Dec 5
14:56:28 2014
@@ -35,31 +35,22 @@ public class TestClassLoaderLogManager {
ClassLoaderLogManager logManager = new ClassLoaderLogManager();
Assert.assertEquals("", logManager.replace(""));
Assert.assertEquals("${", logManager.replace("${"));
- Assert.assertEquals("${undefinedproperty}",
- logManager.replace("${undefinedproperty}"));
+ Assert.assertEquals("${undefinedproperty}",
logManager.replace("${undefinedproperty}"));
Assert.assertEquals(
- System.getProperty("line.separator")
- + System.getProperty("path.separator")
- + File.separator,
- logManager
-
.replace("${line.separator}${path.separator}${file.separator}"));
+ System.getProperty("line.separator") + File.pathSeparator +
File.separator,
+
logManager.replace("${line.separator}${path.separator}${file.separator}"));
Assert.assertEquals(
- "foo" + File.separator + "bar"
- + System.getProperty("line.separator")
- + System.getProperty("path.separator") + "baz",
- logManager
-
.replace("foo${file.separator}bar${line.separator}${path.separator}baz"));
+ "foo" + File.separator + "bar" +
System.getProperty("line.separator")
+ + File.pathSeparator + "baz",
+
logManager.replace("foo${file.separator}bar${line.separator}${path.separator}baz"));
// BZ 51249
Assert.assertEquals(
"%{file.separator}" + File.separator,
logManager.replace("%{file.separator}${file.separator}"));
Assert.assertEquals(
- File.separator + "${undefinedproperty}"
- + File.separator,
- logManager
-
.replace("${file.separator}${undefinedproperty}${file.separator}"));
- Assert.assertEquals("${}" + System.getProperty("path.separator"),
- logManager.replace("${}${path.separator}"));
+ File.separator + "${undefinedproperty}" + File.separator,
+
logManager.replace("${file.separator}${undefinedproperty}${file.separator}"));
+ Assert.assertEquals("${}" + File.pathSeparator,
logManager.replace("${}${path.separator}"));
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]