You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2010/04/19 11:23:31 UTC
svn commit: r935488 - in /ant/core/trunk/src/main/org/apache/tools/ant:
filters/ClassConstants.java taskdefs/LoadProperties.java
util/LayoutPreservingProperties.java util/ResourceUtils.java
Author: bodewig
Date: Mon Apr 19 09:23:31 2010
New Revision: 935488
URL: http://svn.apache.org/viewvc?rev=935488&view=rev
Log:
extract constant
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java?rev=935488&r1=935487&r2=935488&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java Mon Apr 19 09:23:31 2010
@@ -22,7 +22,7 @@ import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.tools.ant.BuildException;
-
+import org.apache.tools.ant.util.ResourceUtils;
/**
* Assembles the constants declared in a Java class in
@@ -104,7 +104,7 @@ public final class ClassConstants
if (clazz == null || clazz.length() == 0) {
ch = -1;
} else {
- final byte[] bytes = clazz.getBytes("ISO-8859-1");
+ final byte[] bytes = clazz.getBytes(ResourceUtils.ISO_8859_1);
try {
final Class javaClassHelper =
Class.forName(JAVA_CLASS_HELPER);
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java?rev=935488&r1=935487&r2=935488&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java Mon Apr 19 09:23:31 2010
@@ -37,6 +37,7 @@ import org.apache.tools.ant.types.Filter
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.types.resources.JavaResource;
import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.ResourceUtils;
/**
* Load a file's contents as Ant properties.
@@ -181,7 +182,7 @@ public class LoadProperties extends Task
if (!text.endsWith("\n")) {
text = text + "\n";
}
- tis = new ByteArrayInputStream(text.getBytes("ISO8859_1"));
+ tis = new ByteArrayInputStream(text.getBytes(ResourceUtils.ISO_8859_1));
final Properties props = new Properties();
props.load(tis);
Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java?rev=935488&r1=935487&r2=935488&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java Mon Apr 19 09:23:31 2010
@@ -140,7 +140,7 @@ public class LayoutPreservingProperties
public void load(InputStream inStream) throws IOException {
String s = readLines(inStream);
- byte[] ba = s.getBytes("ISO-8859-1");
+ byte[] ba = s.getBytes(ResourceUtils.ISO_8859_1);
ByteArrayInputStream bais = new ByteArrayInputStream(ba);
super.load(bais);
}
@@ -251,7 +251,7 @@ public class LayoutPreservingProperties
}
public void store(OutputStream out, String header) throws IOException {
- OutputStreamWriter osw = new OutputStreamWriter(out, "ISO-8859-1");
+ OutputStreamWriter osw = new OutputStreamWriter(out, ResourceUtils.ISO_8859_1);
int skipLines = 0;
int totalLines = logicalLines.size();
@@ -309,7 +309,7 @@ public class LayoutPreservingProperties
* @param is the stream from which to read the data
*/
private String readLines(InputStream is) throws IOException {
- InputStreamReader isr = new InputStreamReader(is, "ISO-8859-1");
+ InputStreamReader isr = new InputStreamReader(is, ResourceUtils.ISO_8859_1);
BufferedReader br = new BufferedReader(isr);
if (logicalLines.size() > 0) {
Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java?rev=935488&r1=935487&r2=935488&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/ResourceUtils.java Mon Apr 19 09:23:31 2010
@@ -66,6 +66,13 @@ public class ResourceUtils {
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
/**
+ * Name of charset "ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1".
+ *
+ * @since Ant 1.8.1
+ */
+ public static final String ISO_8859_1 = "ISO-8859-1";
+
+ /**
* Tells which source files should be reprocessed based on the
* last modification date of target files.
* @param logTo where to send (more or less) interesting output.