You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by BugRat Mail System <to...@cortexity.com> on 2000/09/30 02:21:35 UTC
BugRat Report #184 has been filed.
Bug report #184 has just been filed.
You can view the report at the following URL:
<http://znutar.cortexity.com:8888/BugRatViewer/ShowReport/184>
REPORT #184 Details.
Project: Ant
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: received
Priority: medium
Severity: non-critical
Confidence: public
Environment:
Release: CVS of September 15th
JVM Release: 1.2.2
Operating System: NT / Solaris
OS Release: 4.0 / 2.6
Platform: PC / Sun
Synopsis:
Filters don't work when multiple '@' on the line
Description:
Imagine the following jsp file fragment:
<%@ include file="@ROOT@/some/include.jsp%>
The filter doen't replace @ROOT@ with it's value, and the
line is unchanged.
RE: BugRat Report #184 has been filed.
Posted by Erik Meade <em...@geekfarm.org>.
I took a look at this bug, and couldn't reproduce it, my attempts
to do so follow. I created the first test file ( filter1.txt )
to make sure I didn't break anything, and the second ( filter2.txt )
so I could "fix the bug". The only time I got close to producing
this bug is when I forgot to add filtering="yes" to tasks.
add files filter1.txt and filter2.txt to src/etc/testcases/taskdefs
Index: filter1.txt
===================================================================
@year@
Index: filter2.txt
===================================================================
<%@ include file="@ROOT@/some/include.jsp"%>
Index: filter.xml
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/etc/testcases/taskdefs/filter.xml,v
retrieving revision 1.1
diff -u -r1.1 filter.xml
--- filter.xml 2000/09/20 13:38:47 1.1
+++ filter.xml 2000/10/02 01:11:00
@@ -18,4 +18,24 @@
<filter token="" value=""/>
</target>
+ <target name="test5">
+ <filter token="year" value="2000" />
+ <copyfile src="filter1.txt" dest="filtered.tmp" filtering="yes"/>
+ </target>
+
+ <target name="test6">
+ <filter token="year" value="2000" />
+ <copydir src="." dest="./taskdefs.tmp" filtering="yes"
includes="filter1.txt"/>
+ </target>
+
+ <target name="test7">
+ <filter token="ROOT" value="root" />
+ <copyfile src="filter2.txt" dest="filtered.tmp" filtering="yes"/>
+ </target>
+
+ <target name="test8">
+ <filter token="ROOT" value="root" />
+ <copydir src="." dest="./taskdefs.tmp" filtering="yes"
includes="filter2.txt"/>
+ </target>
+
</project>
Index: FilterTest.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/Filt
erTest.java,v
retrieving revision 1.1
diff -u -r1.1 FilterTest.java
--- FilterTest.java 2000/09/20 13:38:50 1.1
+++ FilterTest.java 2000/10/02 01:14:31
@@ -54,33 +54,88 @@
package org.apache.tools.ant.taskdefs;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
/**
- * @author Nico Seessle <ni...@seessle.de>
+ * @author Nico Seessle <ni...@seessle.de>
*/
-public class FilterTest extends TaskdefsTest
-
- public FilterTest(String name)
+public class FilterTest extends TaskdefsTest {
+
+ private final static TASKDEFS_DIR = "src/etc/testcases/taskdefs/";
+
+ public FilterTest(String name) {
super(name);
- }
-
- public void setUp()
- configureProject("src/etc/testcases/taskdefs/filter.xml");
+ }
+
+ public void setUp() {
+ configureProject(TASKDEFS_DIR + "filter.xml");
}
- public void test1()
+ public void test1() {
expectBuildException("test1", "required argument missing");
}
- public void test2()
+ public void test2() {
expectBuildException("test2", "required argument missing");
}
- public void test3()
+ public void test3() {
expectBuildException("test3", "required argument missing");
}
-
- public void test4()
+
+ public void test4() {
executeTarget("test4");
+ }
+
+ public void test5() {
+ executeTarget("test5");
+ assertEquals("2000",
+ getFilteredFile("5", TASKDEFS_DIR + "filtered.tmp"));
}
-
+
+ public void test6() {
+ executeTarget("test6");
+ assertEquals("2000",
+ getFilteredFile("6", TASKDEFS_DIR +
"taskdefs.tmp/filter1.txt"));
+ }
+
+ public void test7() {
+ executeTarget("test7");
+ assertEquals("<%@ include file=\"root/some/include.jsp\"%>",
+ getFilteredFile("7", TASKDEFS_DIR + "filtered.tmp"));
+ }
+
+ public void test8() {
+ executeTarget("test8");
+ assertEquals("<%@ include file=\"root/some/include.jsp\"%>",
+ getFilteredFile("8", TASKDEFS_DIR +
"taskdefs.tmp/filter2.txt"));
+ }
+
+ private String getFilteredFile(String testNumber, String filteredFile)
{
+ String line = null;
+ File f = new File(filteredFile);
+ if (!f.exists()) {
+ fail("filter test"+testNumber+" failed");
+ } else {
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(new FileReader(f));
+ } catch (FileNotFoundException fnfe) {
+ fail("filter test"+testNumber+" failed, filtered file: " +
f.toString() + " not found");
+ }
+ try {
+ line = in.readLine();
+ in.close();
+ } catch (IOException ioe) {
+ fail("filter test"+testNumber+" failed. IOException while
reading filtered file: " + ioe);
+ }
+ }
+ f.delete();
+ return line;
+ }
}
+
> -----Original Message-----
> From: BugRat Mail System [mailto:tomcat-bugs@cortexity.com]
> Sent: Friday, September 29, 2000 5:22 PM
> To: ant-bugs@cortexity.com
> Subject: BugRat Report #184 has been filed.
>
>
> Bug report #184 has just been filed.
>
> You can view the report at the following URL:
>
> <http://znutar.cortexity.com:8888/BugRatViewer/ShowReport/184>
>
> REPORT #184 Details.
>
> Project: Ant
> Category: Bug Report
> SubCategory: New Bug Report
> Class: swbug
> State: received
> Priority: medium
> Severity: non-critical
> Confidence: public
> Environment:
> Release: CVS of September 15th
> JVM Release: 1.2.2
> Operating System: NT / Solaris
> OS Release: 4.0 / 2.6
> Platform: PC / Sun
>
> Synopsis:
> Filters don't work when multiple '@' on the line
>
> Description:
> Imagine the following jsp file fragment:
>
> <%@ include file="@ROOT@/some/include.jsp%>
>
> The filter doen't replace @ROOT@ with it's value, and the
> line is unchanged.
>