Browse Source

add a test case for bugrep 37348 in the xslt task, also remove

unneeded imports in FileUtils


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@345256 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 19 years ago
parent
commit
98f8daca39
6 changed files with 57 additions and 11 deletions
  1. +19
    -0
      src/etc/testcases/taskdefs/optional/xml/apache.xsl
  2. +13
    -0
      src/etc/testcases/taskdefs/optional/xml/docwithentity.xml
  3. +3
    -0
      src/etc/testcases/taskdefs/optional/xml/entity.xml
  4. +19
    -2
      src/etc/testcases/taskdefs/optional/xslt.xml
  5. +0
    -9
      src/main/org/apache/tools/ant/util/FileUtils.java
  6. +3
    -0
      src/testcases/org/apache/tools/ant/taskdefs/optional/XsltTest.java

+ 19
- 0
src/etc/testcases/taskdefs/optional/xml/apache.xsl View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="xml"/>

<xsl:template match="/">
<authors>
<xsl:apply-templates/>
</authors>
</xsl:template>
<xsl:template match="author">
<author>
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
</author>
</xsl:template>
</xsl:stylesheet>

+ 13
- 0
src/etc/testcases/taskdefs/optional/xml/docwithentity.xml View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE books [
<!ENTITY globaldefinitions SYSTEM "entity.xml">
]>
<books>
&globaldefinitions;
<book name="the lord of rings">
<author name="tolkien"/>
</book>
<book name="le malade imaginaire">
<author name="moliere"/>
</book>
</books>

+ 3
- 0
src/etc/testcases/taskdefs/optional/xml/entity.xml View File

@@ -0,0 +1,3 @@
<book name="hamlet">
<author name="shakespeare"/>
</book>

+ 19
- 2
src/etc/testcases/taskdefs/optional/xslt.xml View File

@@ -1,12 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>

<project name="xslt" default="xslt" basedir=".">
<property name="nonasciidir" value="xml/&#0227;nt"/>
<target name="init">
<mkdir dir="xml/out"/>
</target>

<target name="initNonAscii">
<mkdir dir="${nonasciidir}"/>
<copy todir="${nonasciidir}">
<fileset dir="xml">
<include name="docwithentity.xml"/>
<include name="entity.xml"/>
</fileset>
</copy>
</target>

<target name="teardown">
<delete dir="xml/out"/>
<delete dir="${nonasciidir}" quiet="true"/>
</target>
<target name="testCatchNoDtd" depends="init">
@@ -60,6 +72,11 @@
</factory>
</xslt>
</target>

<!-- inspired by bug report 37348 -->
<target name="testXMLWithEntitiesInNonAsciiPath" depends="initNonAscii">
<xslt in="${nonasciidir}/docwithentity.xml"
out="xml/out/test-out.xml"
style="xml/apache.xsl">
</xslt>
</target>
</project>

+ 0
- 9
src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -17,34 +17,25 @@

package org.apache.tools.ant.util;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.CharacterIterator;
import java.text.DecimalFormat;
import java.text.StringCharacterIterator;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.filters.util.ChainReaderHelper;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.FilterSetCollection;
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.launch.Locator;
import org.apache.xerces.util.URI;

/**
* This class also encapsulates methods which allow Files to be


+ 3
- 0
src/testcases/org/apache/tools/ant/taskdefs/optional/XsltTest.java View File

@@ -85,5 +85,8 @@ public class XsltTest extends BuildFileTest {
public void testAttribute() throws Exception {
executeTarget("testAttribute");
}
public void testXMLWithEntitiesInNonAsciiPath() throws Exception {
executeTarget("testXMLWithEntitiesInNonAsciiPath");
}
}


Loading…
Cancel
Save