Thread: [Japi-cvs] SF.net SVN: japi:[702] tools/replacer/trunk
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2008-11-30 11:00:57
|
Revision: 702
http://japi.svn.sourceforge.net/japi/?rev=702&view=rev
Author: christianhujer
Date: 2008-11-30 11:00:50 +0000 (Sun, 30 Nov 2008)
Log Message:
-----------
Updated replacer. More tests, better build.
Modified Paths:
--------------
tools/replacer/trunk/build.xml
tools/replacer/trunk/lib/japi-lib-argparser-trunk.jar
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.java
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.properties
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Substitution.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/ReplacerTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java
Added Paths:
-----------
tools/replacer/trunk/module.properties
tools/replacer/trunk/replacer.iml
tools/replacer/trunk/src/doc/
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/SplitIterator.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationTestCase.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableDefaultTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableLineIteratorTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterablePatternListTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableSplitIteratorTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIteratorTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithSplitIteratorTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithStringSplitTest.java
Property Changed:
----------------
tools/replacer/trunk/
Property changes on: tools/replacer/trunk
___________________________________________________________________
Added: svn:externals
+ common https://japi.svn.sourceforge.net/svnroot/japi/common/trunk
Modified: tools/replacer/trunk/build.xml
===================================================================
--- tools/replacer/trunk/build.xml 2008-11-03 22:59:37 UTC (rev 701)
+++ tools/replacer/trunk/build.xml 2008-11-30 11:00:50 UTC (rev 702)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ DirCount is a program for converting Strings into byte arrays.
+ ~ Replacer is a program for performing an in-place search and replace
+ ~ based on regular expressions.
~ Copyright (C) 2007 Christian Hujer
~
~ This program is free software; you can redistribute it and/or modify
@@ -18,12 +19,28 @@
~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-->
-<project name="Replacer" default="compile">
+<project name="Replacer" default="buildapp">
- <property name="module.version" value="0.1" />
- <property name="module.name" value="Replacer" />
- <property name="module.shortname" value="Replacer" />
- <property name="module.title" value="Replacer" />
+ <property file="module.properties" />
+
+ <!-- Sets module.version to something very reasonable, depending on whether we're in trunk, tags, branches or somewhere else. -->
+ <basename property="dir.version" file="${user.dir}" />
+ <dirname property="parent" file="${user.dir}" />
+ <basename property="parentRegion" file="${parent}" />
+ <exec outputproperty="svnversion" executable="svnversion">
+ <env key="LC_ALL" value="C" />
+ </exec>
+ <condition property="module.version" value="trunk-${svnversion}">
+ <equals arg1="trunk" arg2="${dir.version}" />
+ </condition>
+ <condition property="module.version" value="branch-${dir.version}-${svnversion}">
+ <equals arg1="branches" arg2="${parentRegion}" />
+ </condition>
+ <condition property="module.version" value="${dir.version}">
+ <equals arg1="tags" arg2="${parentRegion}" />
+ </condition>
+ <property name="module.version" value="${parentRegion}-${dir.version}-${svnversion}" />
+
<property name="main.class" value="net.sf.japi.tools.replacer.Replacer" />
<taskdef name="pack200" classpath="common/antlib/Pack200Task.jar" classname="com.sun.tools.apache.ant.pack200.Pack200Task" />
@@ -41,7 +58,6 @@
description = "Compiles production classes"
>
<mkdir dir="classes/production/${module.shortname}" />
- <mkdir dir="classes/test/${module.shortname}" />
<javac
srcdir="src/prj"
destdir="classes/production/${module.shortname}"
@@ -53,7 +69,6 @@
<fileset dir="lib" includes="*.jar" excludes="LICENSE-*.jar" />
<fileset dir="common/lib" includes="*.jar" excludes="LICENSE-*.jar" />
</classpath>
- <exclude name="test/**/*.java" />
</javac>
<copy
todir="classes/production/${module.shortname}"
@@ -74,8 +89,6 @@
description = "Packs distribution archives."
depends = "clean, compile"
>
- <!--depends = "clean, compile, doc"
- -->
<delete dir="dist" />
<mkdir dir="dist" />
<property name="distName" value="dist/${module.name}-${module.version}" />
@@ -191,22 +204,23 @@
>
<include name="net/**" />
</packageset>
- <tag enabled="true" name="retval" description="Return Values:" scope="methods" />
- <tag enabled="true" name="pre" description="Preconditions:" scope="methods,constructors" />
- <tag enabled="true" name="post" description="Postconditions:" scope="methods" />
- <tag enabled="true" name="invariant" description="Invariant:" scope="methods,fields" />
- <tag enabled="true" name="note" description="Notes:" />
- <tag enabled="true" name="warning" description="Warnings:" />
- <!--tag enabled="true" name="todo" description="Todo:" /-->
- <taglet name="com.sun.tools.doclets.ToDoTaglet" path="" />
- <tag enabled="true" name="fixme" description="Fixme:" />
- <tag enabled="true" name="xxx" description="XXX:" />
+ <taglet name="net.sf.japi.taglets.FixmeTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.HistoryTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.InvariantTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.NoteTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.PostconditionTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.PreconditionTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.ReturnValueTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.TodoTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.WarningTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
+ <taglet name="net.sf.japi.taglets.XxxTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" />
</javadoc>
</target>
<target
name = "buildapp"
description = "Creates executable jar"
+ depends = "compile"
>
<property name="appName" value="${module.name}-${module.version}-app" />
<jar destfile="${appName}.jar">
Modified: tools/replacer/trunk/lib/japi-lib-argparser-trunk.jar
===================================================================
(Binary files differ)
Added: tools/replacer/trunk/module.properties
===================================================================
--- tools/replacer/trunk/module.properties (rev 0)
+++ tools/replacer/trunk/module.properties 2008-11-30 11:00:50 UTC (rev 702)
@@ -0,0 +1,23 @@
+#
+# Replacer is a command for performing regular expression substitutions.
+# Copyright (C) 2008 Christian Hujer.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+update.focus=none
+module.name=Replacer
+module.shortname=Replacer
+module.title=Replacer
Property changes on: tools/replacer/trunk/module.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
Added: tools/replacer/trunk/replacer.iml
===================================================================
--- tools/replacer/trunk/replacer.iml (rev 0)
+++ tools/replacer/trunk/replacer.iml 2008-11-30 11:00:50 UTC (rev 702)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/doc" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/prj" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/tst" isTestSource="true" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="annotations" level="project" />
+ <orderEntry type="library" name="junit" level="project" />
+ <orderEntry type="module" module-name="libs-argparser" />
+ <orderEntryProperties />
+ </component>
+</module>
+
Property changes on: tools/replacer/trunk/replacer.iml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:eol-style
+ LF
Added: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java (rev 0)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java 2008-11-30 11:00:50 UTC (rev 702)
@@ -0,0 +1,77 @@
+package net.sf.japi.tools.replacer;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.regex.Pattern;
+import org.jetbrains.annotations.NotNull;
+
+/** Iterable for iterating lines.
+ *
+ * @warning The returned Iterator may show unexpected behaviour when the underlying CharSequence is concurrently modified.
+ *
+ * @see LineIterator for more details.
+ *
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ */
+public class LineIterable implements Iterable<CharSequence> {
+
+ /** The pattern for splitting lines. */
+ private static final Pattern LINE_SPLIT_PATTERN = Pattern.compile("(?<=\\n|\u0085|\u2028|\u2029|\\r(?!\\n))");
+
+ /** The implementation for creating the iterator. */
+ public enum IteratorImplementation {
+
+ /** Create the iterator from a list from a pattern split. */
+ PATTERN_LIST,
+
+ /** Use the {@link LineIterator} class. */
+ LINE_ITERATOR,
+
+ /** Use the {@link SplitIterator} class. */
+ SPLIT_ITERATOR
+ }
+
+ /** Compile time-switch whether to use regex or LineIterator. */
+ public static final IteratorImplementation DEFAULT_MODE = IteratorImplementation.SPLIT_ITERATOR;
+
+ /** The text that should be iterated. */
+ @NotNull private final CharSequence text;
+
+ /** The implementation to use. */
+ @NotNull private final IteratorImplementation mode;
+
+ /** Create an Iterable for iterating lines.
+ * Uses the default mode for creating the iterator.
+ * @param text CharSequence that for iterating line-wise.
+ */
+ public LineIterable(final CharSequence text) {
+ this(text, DEFAULT_MODE);
+ }
+
+ /** Create an Iterable for iterating lines.
+ * Uses the default mode for creating the iterator.
+ * @param text CharSequence that for iterating line-wise.
+ * @param mode Implemenation to use.
+ */
+ public LineIterable(final CharSequence text, @NotNull final IteratorImplementation mode) {
+ this.text = text;
+ this.mode = mode;
+ }
+
+ /** {@inheritDoc} */
+ public Iterator<CharSequence> iterator() {
+ switch (mode) {
+ case PATTERN_LIST:
+ if (text.length() == 0) {
+ return Collections.<CharSequence>emptySet().iterator();
+ }
+ return Arrays.<CharSequence>asList(LINE_SPLIT_PATTERN.split(text)).iterator();
+ case LINE_ITERATOR:
+ return new LineIterator(text);
+ case SPLIT_ITERATOR:
+ return new SplitIterator(text, LINE_SPLIT_PATTERN);
+ }
+ throw new Error("Compile time error. IteratorImplementation missing.");
+ }
+}
Property changes on: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
Added: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java (rev 0)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java 2008-11-30 11:00:50 UTC (rev 702)
@@ -0,0 +1,115 @@
+package net.sf.japi.tools.replacer;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import org.jetbrains.annotations.NotNull;
+
+/** Iterator for lines.
+ *
+ * <h4>Line terminators</h4>
+ * A <dfn>line terminator</dfn> is a one- or two-character sequence that marks the end of a line of the input character sequence.
+ * The following are recognized as line terminators:
+ * <ul>
+ * <li>A newline (line feed) character (<code>'\n'</code>),</li>
+ * <li>a carriage-return character followed immediately by a newline character (<code>"\r\n"</code>),</li>
+ * <li>a standalone carriage-return character (<code>'\r'</code>),</li>
+ * <li>a next-line character (<code>'\u0085'</code>),</li>
+ * <li>a line-separator character (<code>'\u2028'</code>), or</li>
+ * <li>a paragraph-separator character (<code>'\u2029</code>).</li>
+ * </ul>
+ *
+ * The line terminator is included in the returned line.
+ *
+ * This Iterator does not support {@link Iterator#remove()}.
+ *
+ * @warning The Iterator may show unexpected behaviour when the underlying CharSequence is concurrently modified.
+ *
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ */
+public class LineIterator implements Iterator<CharSequence> {
+
+ /** Unicode character "NEW LINE" / "LINE FEED". */
+ private static final char LINE_FEED = '\n';
+
+ /** Unicode character "CARRIAGE RETURN". */
+ private static final char CARRIAGE_RETURN = '\r';
+
+ /** Unicode character "NEXT LINE". */
+ private static final char NEXT_LINE = '\u0085';
+
+ /** Unicode character "LINE SEPARATOR". */
+ private static final char LINE_SEPARATOR = '\u2028';
+
+ /** Unicode character "PARAGRAPH SEPARATOR". */
+ private static final char PARAGRAPH_SEPARATOR = '\u2029';
+
+ /** The text that contains the lines over which to iterate. */
+ @NotNull private final CharSequence text;
+
+ /** The end index of the previous line (exclusive),
+ * at the same time the start index of the next line (inclusive).
+ */
+ // Do not rename end - matches CharSequence#subSequence(int, int).
+ private int end = 0;
+
+ /** Create a line iterator.
+ * @param text Text to iterator line-wise.
+ */
+ public LineIterator(@NotNull final CharSequence text) {
+ this.text = text;
+ }
+
+ /** {@inheritDoc} */
+ public boolean hasNext() {
+ return end < text.length();
+ }
+
+ /** {@inheritDoc} */
+ public CharSequence next() {
+ // 1. Check if there is a next line.
+ // If not, the iterator was used wrongly, so throw an exception.
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+
+ // 2. Determine start of line.
+ // The previous end (exclusive) is the next start (inclusive).
+ // Do not rename start - matches CharSequence#subSequence(int, int).
+ final int start = end;
+
+ // 3. Determine end of line.
+ // The end of line is after the next line terminator.
+ while (++end < text.length()) {
+ if (isCharBeforeEndALineTerminator()) {
+ break;
+ }
+ }
+
+ // 4. Return the text's subsequence that is that line.
+ return text.subSequence(start, end);
+ }
+
+ /** Returns whether or not the character before the current {@link #end} terminates a line.
+ * @return Whether or not the character before the current {@link #end} terminates a line.
+ * @retval <code>true</code> if the character before the current {@link #end} terminates a line.
+ * @retval <code>false</code> otherwise (no line termination).
+ */
+ private boolean isCharBeforeEndALineTerminator() {
+ final char c = text.charAt(end - 1);
+ return
+ c == LINE_FEED ||
+ // CARRIAGE_RETURN only already terminates a line if it is standalone.
+ // If it is immediately followed by a LINE_FEED, that line feed will terminate the line in the next invocation.
+ (c == CARRIAGE_RETURN && (end == text.length() || text.charAt(end) != LINE_FEED)) ||
+ c == NEXT_LINE ||
+ c == LINE_SEPARATOR ||
+ c == PARAGRAPH_SEPARATOR;
+ }
+
+ /** {@inheritDoc}
+ * @throws UnsupportedOperationException The remove operation is not supported by this iterator.
+ */
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
Modified: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.java 2008-11-03 22:59:37 UTC (rev 701)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.java 2008-11-30 11:00:50 UTC (rev 702)
@@ -1,10 +1,5 @@
package net.sf.japi.tools.replacer;
-import net.sf.japi.io.args.ArgParser;
-import net.sf.japi.io.args.BasicCommand;
-import net.sf.japi.io.args.Option;
-import org.jetbrains.annotations.NotNull;
-
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
@@ -18,23 +13,45 @@
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
+import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Formatter;
import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import net.sf.japi.io.args.ArgParser;
+import net.sf.japi.io.args.BasicCommand;
+import net.sf.japi.io.args.CharsetDisplaynameComparator;
+import net.sf.japi.io.args.Option;
+import net.sf.japi.io.args.OptionType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/** Performs one or more regular expression based substitutions on one or more files.
* Files will only be written if at least one of the substitution steps caused a change.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
+// TODO Add interactive mode.
+// The interactive mode for each match should show the context of the substitution.
+// It should replace only after user confirmation.
+// TODO Add ranges mode.
+// The ranges mode specifies a range before an s command.
+// The default range is % - all lines of the file.
+// Ranges could also be 3,5 - lines 3 to 5 in the file.
+// TODO Add option for user-definable command, e.g. for checking out files from a VCS.
+// TODO Add pretend option to just pretend changing files but do not actually change them.
+// TODO Support comment lines, e.g. with #
public class Replacer extends BasicCommand {
/** The default file ending for backup files. */
@NotNull
public static final String DEFAULT_BACKUP_EXTENSION = ".bak";
- /** Buffer size for read buffer. */
+ /** Buffer size for buffers, e.g. read or copy buffer. */
private static final int BUF_SIZE = 4096;
/** Main program.
@@ -50,25 +67,31 @@
/** Unmodifiable view to the list of substitutions that shall be performed. */
@NotNull private final Collection<Substitution> unmodifiableSubstitutions = Collections.unmodifiableCollection(substitutions);
- /** Whether to force overwriting files or not.
+ /** Whether or not to force overwriting files or not.
* If <code>true</code>, files will be made writable if possible.
* If <code>false</code> (default), files can only be written if they were writable before.
*/
private boolean force;
- /** Whether to recurse into subdirectories or not.
+ /** Whether or not to recurse into subdirectories or not.
* If <code>true</code>, directories will be opened recursively and substitution performed on all files found.
* If <code>false</code> (default), directories will simply be ignored.
*/
private boolean recursive;
- /** Whether to create backups of modified files.
+ /** Whether or not to create backups of modified files.
* If <code>true</code>, backups with the original file content will be made if a file has changed.
* If <code>false</code> (default), no backups will be made.
* Intermediate backups will always be created to make writing pseudo-atomic.
*/
private boolean backup;
+ /** Whether or not to be verbose.
+ * If <code>true</code>, verbose output like the changed file will be printed to stderr.
+ * If <code>false</code> (default), the program behaves silently.
+ */
+ private boolean verbose;
+
/** The number of errors that occurred.
* Errors are only cases where actual exceptions were thrown, i.e. {@link FileNotFoundException} or {@link IOException}.
* If 0 (zero) no errors occurred.
@@ -80,9 +103,13 @@
@NotNull private String backupExtension = DEFAULT_BACKUP_EXTENSION;
/** The file encoding that is used for reading and writing files as weil es parsing substitutions from {@link System#in}. */
- private String encoding = Charset.defaultCharset().name();
+ private Charset encoding = Charset.defaultCharset();
+ /** The command to make the file writable. */
+ @Nullable private String makeWritableCommand = null;
+
/** {@inheritDoc} */
+ @SuppressWarnings({"InstanceMethodNamingConvention"})
public int run(@NotNull final List<String> args) throws Exception {
if (args.size() == 0) {
final CharSequence content = read(System.in);
@@ -114,16 +141,20 @@
replace(f);
}
}
- if (file.isFile()) {
+ // Checking for non-existant files is intentional.
+ // Opening the non-existant file will lead to the exception and thus the error message to inform the user.
+ if (file.isFile() || !file.exists()) {
try {
final CharSequence content = readFile(file);
final CharSequence newContent = replaceAll(content);
if (!equals(content, newContent)) {
- final File tmpFile = new File(file.getParentFile(), file.getName() + backupExtension);
- file.renameTo(tmpFile);
- writeFile(file, newContent);
- if (!backup) {
+ if (backup) {
+ final File tmpFile = new File(file.getParentFile(), file.getName() + backupExtension);
+ copyFile(file, tmpFile);
+ writeFile(file, newContent);
tmpFile.deleteOnExit();
+ } else {
+ writeFile(file, newContent);
}
}
} catch (final IOException e) {
@@ -133,7 +164,7 @@
}
}
- /** Returns whether two Objects are equal regarding their String representation.
+ /** Returns whether or not two Objects are equal regarding their String representation.
* This method is particularly useful for CharSequences because CharSequence does not define a general contract about <code>equals()</code> and <code>hashCode()</code>.
* Therefore it is inappropriate to compare CharSequences using <code>equals()</code>.
* @param s1 First Object to compare.
@@ -148,10 +179,10 @@
* @param orig Original char sequence to perform substitution on.
* @return New CharSequence with all substitutions performed.
*/
- public CharSequence replaceAll(@NotNull final CharSequence orig) {
+ @NotNull public CharSequence replaceAll(@NotNull final CharSequence orig) {
CharSequence temp = orig;
for (final Substitution substitution : substitutions) {
- temp = substitution.replaceAll(temp);
+ temp = substitution.replace(temp);
}
return temp;
}
@@ -161,7 +192,7 @@
* @return Contents of the InputStream.
* @throws IOException In case of I/O problems.
*/
- public CharSequence read(@NotNull final InputStream stream) throws IOException {
+ @NotNull public CharSequence read(@NotNull final InputStream stream) throws IOException {
final StringBuilder sb = new StringBuilder();
final Reader in = new InputStreamReader(stream instanceof BufferedInputStream ? stream : new BufferedInputStream(stream), encoding);
final char[] buf = new char[BUF_SIZE];
@@ -178,7 +209,7 @@
* @return Contents of the file.
* @throws IOException In case of I/O problems.
*/
- public CharSequence readFile(@NotNull final File file) throws IOException {
+ @NotNull public CharSequence readFile(@NotNull final File file) throws IOException {
final InputStream in = new FileInputStream(file);
try {
return read(in);
@@ -189,22 +220,97 @@
/** Writes a CharSequence into a (text) file.
* @param file File to write.
- * @param string CharSequence to write.
+ * @param text CharSequence to write.
* @throws IOException In case of I/O problems.
*/
- public void writeFile(@NotNull final File file, @NotNull final CharSequence string) throws IOException {
+ public void writeFile(@NotNull final File file, @NotNull final CharSequence text) throws IOException {
+ if (verbose) {
+ System.err.print("File : " + file);
+ System.err.flush();
+ }
if (force && !file.canWrite()) {
- file.setWritable(true);
+ makeWritable(file);
}
final Writer out = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(file)), encoding);
try {
- out.append(string);
+ out.append(text);
out.flush();
+ if (verbose) {
+ System.err.println("\rChanged file: " + file);
+ }
} finally {
out.close();
}
}
+ /** Copies a file into another.
+ * @param src File from which to copy.
+ * @param dest File to copy to.
+ * @throws IOException in case of I/O problems.
+ */
+ private static void copyFile(@NotNull final File src, @NotNull final File dest) throws IOException {
+ final InputStream in = new FileInputStream(src);
+ try {
+ final OutputStream out = new FileOutputStream(dest);
+ try {
+ copy(in, out);
+ } finally {
+ out.close();
+ }
+ } finally {
+ in.close();
+ }
+ }
+
+ /** Copies a stream to another.
+ * @param in Stream from which to copy.
+ * @param out Stream to copy to.
+ * @throws IOException in case of I/O problems.
+ */
+ private static void copy(@NotNull final InputStream in, @NotNull final OutputStream out) throws IOException {
+ final byte[] buf = new byte[BUF_SIZE];
+ for (int bytesRead; (bytesRead = in.read(buf, 0, BUF_SIZE)) != -1;) {
+ out.write(buf, 0, bytesRead);
+ }
+ out.flush();
+ }
+
+ /** Makes a file writable.
+ * If no command is defined, this is simply done by trying to change the file's access permissions.
+ * If a command is defined, the command will be executed.
+ * @param file File to make writable.
+ * @throws IOException In case of I/O problems when trying to make the file writable.
+ */
+ private void makeWri...
[truncated message content] |
|
From: <chr...@us...> - 2009-02-14 23:03:01
|
Revision: 850
http://japi.svn.sourceforge.net/japi/?rev=850&view=rev
Author: christianhujer
Date: 2009-02-14 21:41:59 +0000 (Sat, 14 Feb 2009)
Log Message:
-----------
Updated copyright statements in source code.
Modified Paths:
--------------
tools/replacer/trunk/build.xml
tools/replacer/trunk/module.properties
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.java
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.properties
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/SplitIterator.java
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Substitution.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationTestCase.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableDefaultTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableLineIteratorTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterablePatternListTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableSplitIteratorTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIteratorTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithSplitIteratorTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithStringSplitTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/ReplacerTest.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java
Modified: tools/replacer/trunk/build.xml
===================================================================
--- tools/replacer/trunk/build.xml 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/build.xml 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Replacer is a program for performing an in-place search and replace
- ~ based on regular expressions.
- ~ Copyright (C) 2007 Christian Hujer
+ ~ Copyright (C) 2009 Christian Hujer
~
- ~ This program is free software; you can redistribute it and/or modify
+ ~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
- ~ the Free Software Foundation; either version 2 of the License, or
+ ~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
@@ -14,9 +12,8 @@
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
- ~ You should have received a copy of the GNU General Public License along
- ~ with this program; if not, write to the Free Software Foundation, Inc.,
- ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<project name="Replacer" default="buildapp">
Modified: tools/replacer/trunk/module.properties
===================================================================
--- tools/replacer/trunk/module.properties 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/module.properties 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,20 +1,18 @@
#
-# Replacer is a command for performing regular expression substitutions.
-# Copyright (C) 2008 Christian Hujer.
+# Copyright (C) 2009 Christian Hujer
#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
#
-# This library is distributed in the hope that it will be useful,
+# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
update.focus=none
Modified: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterable.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package net.sf.japi.tools.replacer;
import java.util.Arrays;
Modified: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package net.sf.japi.tools.replacer;
import java.util.Iterator;
Modified: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package net.sf.japi.tools.replacer;
import java.io.BufferedInputStream;
Modified: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.properties
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.properties 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Replacer.properties 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+#
+# Copyright (C) 2009 Christian Hujer
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
setForce=Try to overwrite write-protected files.
setRecursive=Descend into subdirectories recursively.
setBackup=Create backup files.
Modified: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/SplitIterator.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/SplitIterator.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/SplitIterator.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package net.sf.japi.tools.replacer;
import java.util.Iterator;
Modified: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Substitution.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Substitution.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/Substitution.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package net.sf.japi.tools.replacer;
import org.jetbrains.annotations.NotNull;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationTestCase.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationTestCase.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationTestCase.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import java.util.Iterator;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableDefaultTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableDefaultTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableDefaultTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import java.util.Iterator;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableLineIteratorTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableLineIteratorTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableLineIteratorTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import java.util.Iterator;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterablePatternListTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterablePatternListTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterablePatternListTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import java.util.Iterator;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableSplitIteratorTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableSplitIteratorTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIterableSplitIteratorTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import java.util.Iterator;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIteratorTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIteratorTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithLineIteratorTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import java.util.Iterator;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithSplitIteratorTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithSplitIteratorTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithSplitIteratorTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import java.util.regex.Pattern;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithStringSplitTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithStringSplitTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/LineIterationWithStringSplitTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import java.util.Arrays;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/ReplacerTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/ReplacerTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/ReplacerTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import net.sf.japi.io.args.BasicCommand;
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java 2009-02-14 21:41:08 UTC (rev 849)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java 2009-02-14 21:41:59 UTC (rev 850)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2009 Christian Hujer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package test.net.sf.japi.tools.replacer;
import org.junit.Assert;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-02-17 20:49:31
|
Revision: 935
http://japi.svn.sourceforge.net/japi/?rev=935&view=rev
Author: christianhujer
Date: 2009-02-17 20:49:27 +0000 (Tue, 17 Feb 2009)
Log Message:
-----------
Updated libraries to no longer be checked in.
Modified Paths:
--------------
tools/replacer/trunk/build.xml
Removed Paths:
-------------
tools/replacer/trunk/lib/annotations.jar
tools/replacer/trunk/lib/japi-lib-argparser-trunk.jar
Modified: tools/replacer/trunk/build.xml
===================================================================
--- tools/replacer/trunk/build.xml 2009-02-17 20:45:44 UTC (rev 934)
+++ tools/replacer/trunk/build.xml 2009-02-17 20:49:27 UTC (rev 935)
@@ -22,4 +22,8 @@
&commonBuild;
+ <target name="getlibs">
+ <get src="http://downloads.sourceforge.net/japi/japi-lib-argparser-0.2.0.jar" dest="lib/japi-lib-argparser.jar" />
+ </target>
+
</project>
Deleted: tools/replacer/trunk/lib/annotations.jar
===================================================================
(Binary files differ)
Deleted: tools/replacer/trunk/lib/japi-lib-argparser-trunk.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|