git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@911648 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -4,6 +4,8 @@ Changes from Ant 1.8.0 TO current SVN version | |||||
| Changes that could break older environments: | Changes that could break older environments: | ||||
| ------------------------------------------- | ------------------------------------------- | ||||
| * ant-trax.jar is no longer produced since TrAX is included in JDK 1.4+. | |||||
| * Ant no longer ships with Apache Xerces-J or the XML APIs but relies | * Ant no longer ships with Apache Xerces-J or the XML APIs but relies | ||||
| on the Java runtime to provide a parser and matching API versions. | on the Java runtime to provide a parser and matching API versions. | ||||
| @@ -185,16 +185,6 @@ | |||||
| </or> | </or> | ||||
| </selector> | </selector> | ||||
| <!-- depends on external libraries --> | |||||
| <selector id="needs.trax"> | |||||
| <or> | |||||
| <filename name="${optional.package}/TraXLiaison*"/> | |||||
| <filename name="${optional.package}/XSLTTraceSupport*"/> | |||||
| <filename name="${optional.package}/XsltTest*"/> | |||||
| <filename name="${type.package}/XMLCatalogBuildFileTest*"/> | |||||
| </or> | |||||
| </selector> | |||||
| <selector id="needs.apache-resolver"> | <selector id="needs.apache-resolver"> | ||||
| <filename name="${apache.resolver.type.package}/**"/> | <filename name="${apache.resolver.type.package}/**"/> | ||||
| </selector> | </selector> | ||||
| @@ -357,19 +347,6 @@ | |||||
| <available property="netrexx.present" | <available property="netrexx.present" | ||||
| classname="netrexx.lang.Rexx" | classname="netrexx.lang.Rexx" | ||||
| classpathref="classpath"/> | classpathref="classpath"/> | ||||
| <available property="trax.present" | |||||
| classname="javax.xml.transform.Transformer" | |||||
| classpathref="classpath"/> | |||||
| <condition property="trax.impl.present"> | |||||
| <or> | |||||
| <and> | |||||
| <isset property="javax.xml.transform.TransformerFactory"/> | |||||
| <available classname="${javax.xml.transform.TransformerFactory}" | |||||
| classpathref="classpath"/> | |||||
| </and> | |||||
| <available resource="META-INF/services/javax.xml.transform.TransformerFactory"/> | |||||
| </or> | |||||
| </condition> | |||||
| <available property="apache.resolver.present" | <available property="apache.resolver.present" | ||||
| classname="org.apache.xml.resolver.tools.CatalogResolver" | classname="org.apache.xml.resolver.tools.CatalogResolver" | ||||
| classpathref="classpath"/> | classpathref="classpath"/> | ||||
| @@ -560,7 +537,6 @@ | |||||
| <selector refid="needs.jdk1.5+" unless="jdk1.5+"/> | <selector refid="needs.jdk1.5+" unless="jdk1.5+"/> | ||||
| <selector refid="not.in.kaffe" if="kaffe"/> | <selector refid="not.in.kaffe" if="kaffe"/> | ||||
| <selector refid="needs.trax" unless="trax.present"/> | |||||
| <selector refid="needs.apache-resolver" unless="apache.resolver.present"/> | <selector refid="needs.apache-resolver" unless="apache.resolver.present"/> | ||||
| <selector refid="needs.junit" unless="junit.present"/> | <selector refid="needs.junit" unless="junit.present"/> | ||||
| <selector refid="needs.apache-regexp" | <selector refid="needs.apache-regexp" | ||||
| @@ -743,7 +719,6 @@ | |||||
| <not> | <not> | ||||
| <or> | <or> | ||||
| <selector refid="ant.launcher"/> | <selector refid="ant.launcher"/> | ||||
| <selector refid="needs.trax"/> | |||||
| <selector refid="needs.apache-resolver"/> | <selector refid="needs.apache-resolver"/> | ||||
| <selector refid="needs.junit"/> | <selector refid="needs.junit"/> | ||||
| <selector refid="needs.apache-regexp"/> | <selector refid="needs.apache-regexp"/> | ||||
| @@ -784,7 +759,6 @@ | |||||
| </sequential> | </sequential> | ||||
| </macrodef> | </macrodef> | ||||
| <optional-jar dep="trax"/> | |||||
| <optional-jar dep="apache-resolver"/> | <optional-jar dep="apache-resolver"/> | ||||
| <optional-jar dep="junit"/> | <optional-jar dep="junit"/> | ||||
| <optional-jar dep="apache-regexp"/> | <optional-jar dep="apache-regexp"/> | ||||
| @@ -1665,17 +1639,11 @@ see ${build.junit.reports} / ${antunit.reports} | |||||
| </condition> | </condition> | ||||
| <condition property="run.antunit.report"> | <condition property="run.antunit.report"> | ||||
| <and> | |||||
| <isset property="run.antunit" /> | |||||
| <isset property="trax.impl.present" /> | |||||
| </and> | |||||
| <isset property="run.antunit" /> | |||||
| </condition> | </condition> | ||||
| <condition property="run.junit.report"> | <condition property="run.junit.report"> | ||||
| <and> | |||||
| <isset property="run.junit" /> | |||||
| <isset property="trax.impl.present" /> | |||||
| </and> | |||||
| <isset property="run.junit" /> | |||||
| </condition> | </condition> | ||||
| </target> | </target> | ||||
| @@ -1761,17 +1729,8 @@ see ${build.junit.reports} / ${antunit.reports} | |||||
| <!-- these tests need to be localised before being ran???? --> | <!-- these tests need to be localised before being ran???? --> | ||||
| <exclude name="${optional.package}/PvcsTest.java"/> | <exclude name="${optional.package}/PvcsTest.java"/> | ||||
| <!-- These tests need a TraX implementation like xalan2 or saxon --> | |||||
| <exclude name="${optional.package}/TraXLiaisonTest.java" | |||||
| unless="trax.impl.present"/> | |||||
| <exclude name="${optional.package}/XsltTest.java" | |||||
| unless="trax.impl.present"/> | |||||
| <exclude name="${ant.package}/types/XMLCatalogBuildFileTest.java" | |||||
| unless="trax.impl.present"/> | |||||
| <exclude name="${optional.package}/junit/JUnitReportTest.java" | <exclude name="${optional.package}/junit/JUnitReportTest.java" | ||||
| unless="run.junitreport"/> | unless="run.junitreport"/> | ||||
| <exclude name="${taskdefs.package}/StyleTest.java" | |||||
| unless="trax.impl.present"/> | |||||
| <!-- needs xerces to work --> | <!-- needs xerces to work --> | ||||
| <exclude name="${ant.package}/IncludeTest.java" | <exclude name="${ant.package}/IncludeTest.java" | ||||
| @@ -700,24 +700,14 @@ Installing Ant / Optional Tasks</a> section above.</p> | |||||
| <td><b>Needed For</b></td> | <td><b>Needed For</b></td> | ||||
| <td><b>Available At</b></td> | <td><b>Available At</b></td> | ||||
| </tr> | </tr> | ||||
| <tr> | |||||
| <td>An XSL transformer like Xalan</td> | |||||
| <td>style task</td> | |||||
| <td> | |||||
| <b>If you use JDK 1.4+, an XSL transformer is already included, so you need not do anything special.</b><br> | |||||
| <ul><li>XALAN : <a href="http://xml.apache.org/xalan-j/index.html" | |||||
| target="_top">http://xml.apache.org/xalan-j/index.html</a></li> | |||||
| </ul> | |||||
| </td> | |||||
| </tr> | |||||
| <tr> | <tr> | ||||
| <td>jakarta-regexp-1.3.jar</td> | <td>jakarta-regexp-1.3.jar</td> | ||||
| <td>regexp type with mappers</td> | |||||
| <td>regexp type with mappers (if you do not wish to use java.util.regex)</td> | |||||
| <td><a href="http://jakarta.apache.org/regexp/" target="_top">http://jakarta.apache.org/regexp/</a></td> | <td><a href="http://jakarta.apache.org/regexp/" target="_top">http://jakarta.apache.org/regexp/</a></td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td>jakarta-oro-2.0.8.jar</td> | <td>jakarta-oro-2.0.8.jar</td> | ||||
| <td>regexp type with mappers and the perforce tasks<br> | |||||
| <td>regexp type with mappers (if you do not wish to use java.util.regex) and the Perforce tasks<br> | |||||
| To use the FTP task, | To use the FTP task, | ||||
| you need jakarta-oro 2.0.8 or later, and <a href="#commons-net">commons-net</a></td> | you need jakarta-oro 2.0.8 or later, and <a href="#commons-net">commons-net</a></td> | ||||
| <td><a href="http://jakarta.apache.org/oro/" target="_top">http://jakarta.apache.org/oro/</a></td> | <td><a href="http://jakarta.apache.org/oro/" target="_top">http://jakarta.apache.org/oro/</a></td> | ||||
| @@ -53,9 +53,7 @@ | |||||
| <File DiskId="1" Id="file18" Name="ANT-ST_2.JAR" LongName="ant-starteam.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-starteam.jar" /> | <File DiskId="1" Id="file18" Name="ANT-ST_2.JAR" LongName="ant-starteam.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-starteam.jar" /> | ||||
| <File DiskId="1" Id="file19" Name="ANT-ST_1.JAR" LongName="ant-stylebook.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-stylebook.jar" /> | <File DiskId="1" Id="file19" Name="ANT-ST_1.JAR" LongName="ant-stylebook.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-stylebook.jar" /> | ||||
| <File DiskId="1" Id="file20" Name="ANT-SW_1.JAR" LongName="ant-swing.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-swing.jar" /> | <File DiskId="1" Id="file20" Name="ANT-SW_1.JAR" LongName="ant-swing.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-swing.jar" /> | ||||
| <File DiskId="1" Id="file21" Name="ant-trax.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-trax.jar" /> | |||||
| <File DiskId="1" Id="file22" Name="ANT-WE_1.JAR" LongName="ant-weblogic.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-weblogic.jar" /> | <File DiskId="1" Id="file22" Name="ANT-WE_1.JAR" LongName="ant-weblogic.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-weblogic.jar" /> | ||||
| <File DiskId="1" Id="file23" Name="ANT-XA_1.JAR" LongName="ant-xalan1.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-xalan1.jar" /> | |||||
| <File DiskId="1" Id="file24" Name="ant.jar" Vital="yes" src="$(var.dist.dir)/lib\ant.jar" /> | <File DiskId="1" Id="file24" Name="ant.jar" Vital="yes" src="$(var.dist.dir)/lib\ant.jar" /> | ||||
| <File DiskId="1" Id="file25" Name="LIBRAR_1.PRO" LongName="libraries.properties" Vital="yes" src="$(var.dist.dir)/lib\libraries.properties" /> | <File DiskId="1" Id="file25" Name="LIBRAR_1.PRO" LongName="libraries.properties" Vital="yes" src="$(var.dist.dir)/lib\libraries.properties" /> | ||||
| <File DiskId="1" Id="file26" Name="README" Vital="yes" src="$(var.dist.dir)/lib\README" /> | <File DiskId="1" Id="file26" Name="README" Vital="yes" src="$(var.dist.dir)/lib\README" /> | ||||
| @@ -32,7 +32,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma | |||||
| <groupId>org.apache.ant</groupId> | <groupId>org.apache.ant</groupId> | ||||
| <artifactId>ant-apache-xalan2</artifactId> | <artifactId>ant-apache-xalan2</artifactId> | ||||
| <version>1.8.0-SNAPSHOT</version> | <version>1.8.0-SNAPSHOT</version> | ||||
| <description>contains the junit and junirreport tasks</description> | |||||
| <description>contains Xalan2-specific features</description> | |||||
| <dependencies> | <dependencies> | ||||
| <dependency> | <dependency> | ||||
| <groupId>org.apache.ant</groupId> | <groupId>org.apache.ant</groupId> | ||||
| @@ -59,7 +59,6 @@ | |||||
| <include>org/apache/tools/ant/util/regexp/Jdk14Regexp*</include> | <include>org/apache/tools/ant/util/regexp/Jdk14Regexp*</include> | ||||
| </includes> | </includes> | ||||
| <excludes> | <excludes> | ||||
| <exclude>org/apache/tools/ant/taskdefs/optional/TraXLiaison*</exclude> | |||||
| <exclude>org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport*</exclude> | <exclude>org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport*</exclude> | ||||
| <exclude>org/apache/tools/ant/taskdefs/optional/junit/**</exclude> | <exclude>org/apache/tools/ant/taskdefs/optional/junit/**</exclude> | ||||
| <exclude>org/apache/tools/ant/taskdefs/optional/perforce/**</exclude> | <exclude>org/apache/tools/ant/taskdefs/optional/perforce/**</exclude> | ||||
| @@ -1,73 +0,0 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!-- | |||||
| Licensed to the Apache Software Foundation (ASF) under one or more | |||||
| contributor license agreements. See the NOTICE file distributed with | |||||
| this work for additional information regarding copyright ownership. | |||||
| The ASF licenses this file to You under the Apache License, Version 2.0 | |||||
| (the "License"); you may not use this file except in compliance with | |||||
| the License. You may obtain a copy of the License at | |||||
| http://www.apache.org/licenses/LICENSE-2.0 | |||||
| Unless required by applicable law or agreed to in writing, software | |||||
| distributed under the License is distributed on an "AS IS" BASIS, | |||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| See the License for the specific language governing permissions and | |||||
| limitations under the License. | |||||
| --> | |||||
| <!-- | |||||
| This POM has been created manually by the Ant Development Team. | |||||
| Please contact us if you are not satisfied with the data contained in this POM. | |||||
| URL : http://ant.apache.org | |||||
| --> | |||||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
| <parent> | |||||
| <groupId>org.apache.ant</groupId> | |||||
| <artifactId>ant-parent</artifactId> | |||||
| <relativePath>../pom.xml</relativePath> | |||||
| <version>1.8.0-SNAPSHOT</version> | |||||
| </parent> | |||||
| <modelVersion>4.0.0</modelVersion> | |||||
| <groupId>org.apache.ant</groupId> | |||||
| <artifactId>ant-trax</artifactId> | |||||
| <version>1.8.0-SNAPSHOT</version> | |||||
| <description>contains particularly one class necessary for the execution of the xslt task</description> | |||||
| <dependencies> | |||||
| <dependency> | |||||
| <groupId>org.apache.ant</groupId> | |||||
| <artifactId>ant-apache-xalan2</artifactId> | |||||
| <version>1.8.0-SNAPSHOT</version> | |||||
| <scope>compile</scope> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <!-- xalan contains a TRAX compliant implementation --> | |||||
| <groupId>xalan</groupId> | |||||
| <artifactId>xalan</artifactId> | |||||
| <version>2.7.0</version> | |||||
| <optional>true</optional> | |||||
| <scope>runtime</scope> | |||||
| </dependency> | |||||
| </dependencies> | |||||
| <build> | |||||
| <plugins> | |||||
| <plugin> | |||||
| <groupId>org.apache.maven.plugins</groupId> | |||||
| <artifactId>maven-compiler-plugin</artifactId> | |||||
| <configuration> | |||||
| <source>1.4</source> | |||||
| <target>1.4</target> | |||||
| <includes> | |||||
| <include>org/apache/tools/ant//taskdefs/optional/TraXLiaison*</include> | |||||
| </includes> | |||||
| </configuration> | |||||
| </plugin> | |||||
| </plugins> | |||||
| <sourceDirectory>../../../../src/main</sourceDirectory> | |||||
| <testSourceDirectory>../../../../src/testcases</testSourceDirectory> | |||||
| <outputDirectory>../../../../target/${project.artifactId}/classes</outputDirectory> | |||||
| <testOutputDirectory>../../../../target/${project.artifactId}/testcases</testOutputDirectory> | |||||
| <directory>../../../../target/${project.artifactId}</directory> | |||||
| </build> | |||||
| </project> | |||||
| @@ -90,7 +90,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma | |||||
| <module>ant-nodeps</module> | <module>ant-nodeps</module> | ||||
| <module>ant-swing</module> | <module>ant-swing</module> | ||||
| <module>ant-testutil</module> | <module>ant-testutil</module> | ||||
| <module>ant-trax</module> | |||||
| </modules> | </modules> | ||||
| <dependencies> | <dependencies> | ||||
| <dependency> | <dependency> | ||||
| @@ -108,10 +108,6 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| /** for resolving entities such as dtds */ | /** for resolving entities such as dtds */ | ||||
| private XMLCatalog xmlCatalog = new XMLCatalog(); | private XMLCatalog xmlCatalog = new XMLCatalog(); | ||||
| /** Name of the TRAX Liaison class */ | |||||
| private static final String TRAX_LIAISON_CLASS = | |||||
| "org.apache.tools.ant.taskdefs.optional.TraXLiaison"; | |||||
| /** Utilities used for file operations */ | /** Utilities used for file operations */ | ||||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | ||||
| @@ -525,7 +521,6 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| /** | /** | ||||
| * Set the name of the XSL processor to use; optional, default trax. | * Set the name of the XSL processor to use; optional, default trax. | ||||
| * Other values are "xalan" for Xalan1 | |||||
| * | * | ||||
| * @param processor the name of the XSL processor | * @param processor the name of the XSL processor | ||||
| */ | */ | ||||
| @@ -675,15 +670,13 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| * @exception Exception if the processor cannot be loaded. | * @exception Exception if the processor cannot be loaded. | ||||
| */ | */ | ||||
| private void resolveProcessor(String proc) throws Exception { | private void resolveProcessor(String proc) throws Exception { | ||||
| String classname; | |||||
| if (proc.equals(PROCESSOR_TRAX)) { | if (proc.equals(PROCESSOR_TRAX)) { | ||||
| classname = TRAX_LIAISON_CLASS; | |||||
| liaison = new org.apache.tools.ant.taskdefs.optional.TraXLiaison(); | |||||
| } else { | } else { | ||||
| //anything else is a classname | //anything else is a classname | ||||
| classname = proc; | |||||
| Class clazz = loadClass(proc); | |||||
| liaison = (XSLTLiaison) clazz.newInstance(); | |||||
| } | } | ||||
| Class clazz = loadClass(classname); | |||||
| liaison = (XSLTLiaison) clazz.newInstance(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -906,8 +899,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| * @return an instance of the XSLTLiason interface. | * @return an instance of the XSLTLiason interface. | ||||
| */ | */ | ||||
| protected XSLTLiaison getLiaison() { | protected XSLTLiaison getLiaison() { | ||||
| // if processor wasn't specified, see if TraX is available. If not, | |||||
| // default it to xalan, depending on which is in the classpath | |||||
| // if processor wasn't specified, use TraX. | |||||
| if (liaison == null) { | if (liaison == null) { | ||||
| if (processor != null) { | if (processor != null) { | ||||
| try { | try { | ||||
| @@ -918,8 +910,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| } else { | } else { | ||||
| try { | try { | ||||
| resolveProcessor(PROCESSOR_TRAX); | resolveProcessor(PROCESSOR_TRAX); | ||||
| } catch (Throwable e1) { | |||||
| e1.printStackTrace(); | |||||
| } catch (Exception e1) { // should not happen | |||||
| handleError(e1); | handleError(e1); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,96 +0,0 @@ | |||||
| /* | |||||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||||
| * contributor license agreements. See the NOTICE file distributed with | |||||
| * this work for additional information regarding copyright ownership. | |||||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||||
| * (the "License"); you may not use this file except in compliance with | |||||
| * the License. You may obtain a copy of the License at | |||||
| * | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| * | |||||
| * Unless required by applicable law or agreed to in writing, software | |||||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| * See the License for the specific language governing permissions and | |||||
| * limitations under the License. | |||||
| * | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.junit; | |||||
| import java.io.OutputStream; | |||||
| import javax.xml.transform.Result; | |||||
| import javax.xml.transform.Source; | |||||
| import javax.xml.transform.Transformer; | |||||
| import javax.xml.transform.TransformerFactory; | |||||
| import javax.xml.transform.dom.DOMSource; | |||||
| import javax.xml.transform.stream.StreamResult; | |||||
| import javax.xml.transform.stream.StreamSource; | |||||
| import org.apache.tools.ant.BuildException; | |||||
| /** | |||||
| * This class is not used by the framework any more. | |||||
| * We plan to remove it in Ant 1.8 | |||||
| * @deprecated since Ant 1.7 | |||||
| * | |||||
| * | |||||
| * @ant.task ignore="true" | |||||
| */ | |||||
| public class Xalan2Executor extends XalanExecutor { | |||||
| private static final String APAC = "org.apache.xalan."; | |||||
| private static final String SPAC = "com.sun.org.apache.xalan."; | |||||
| private TransformerFactory tfactory = TransformerFactory.newInstance(); | |||||
| /** {@inheritDoc}. */ | |||||
| protected String getImplementation() throws BuildException { | |||||
| return tfactory.getClass().getName(); | |||||
| } | |||||
| /** {@inheritDoc}. */ | |||||
| protected String getProcVersion(String classNameImpl) | |||||
| throws BuildException { | |||||
| try { | |||||
| // xalan 2 | |||||
| if (classNameImpl.equals(APAC + "processor.TransformerFactoryImpl") | |||||
| || | |||||
| classNameImpl.equals(APAC + "xslt.XSLTProcessorFactory")) { | |||||
| return getXalanVersion(APAC + "processor.XSLProcessorVersion"); | |||||
| } | |||||
| // xalan xsltc | |||||
| if (classNameImpl.equals(APAC | |||||
| + "xsltc.trax.TransformerFactoryImpl")) { | |||||
| return getXSLTCVersion(APAC + "xsltc.ProcessorVersion"); | |||||
| } | |||||
| // jdk 1.5 xsltc | |||||
| if (classNameImpl | |||||
| .equals(SPAC + "internal.xsltc.trax.TransformerFactoryImpl")) { | |||||
| return getXSLTCVersion(SPAC | |||||
| + "internal.xsltc.ProcessorVersion"); | |||||
| } | |||||
| throw new BuildException("Could not find a valid processor version" | |||||
| + " implementation from " | |||||
| + classNameImpl); | |||||
| } catch (ClassNotFoundException e) { | |||||
| throw new BuildException("Could not find processor version " | |||||
| + "implementation", e); | |||||
| } | |||||
| } | |||||
| /** {@inheritDoc}. */ | |||||
| void execute() throws Exception { | |||||
| String systemId = caller.getStylesheetSystemId(); | |||||
| Source xslSrc = new StreamSource(systemId); | |||||
| Transformer tformer = tfactory.newTransformer(xslSrc); | |||||
| Source xmlSrc = new DOMSource(caller.document); | |||||
| OutputStream os = getOutputStream(); | |||||
| try { | |||||
| tformer.setParameter("output.dir", caller.toDir.getAbsolutePath()); | |||||
| Result result = new StreamResult(os); | |||||
| tformer.transform(xmlSrc, result); | |||||
| } finally { | |||||
| os.close(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,135 +0,0 @@ | |||||
| /* | |||||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||||
| * contributor license agreements. See the NOTICE file distributed with | |||||
| * this work for additional information regarding copyright ownership. | |||||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||||
| * (the "License"); you may not use this file except in compliance with | |||||
| * the License. You may obtain a copy of the License at | |||||
| * | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| * | |||||
| * Unless required by applicable law or agreed to in writing, software | |||||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| * See the License for the specific language governing permissions and | |||||
| * limitations under the License. | |||||
| * | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.junit; | |||||
| import java.io.BufferedOutputStream; | |||||
| import java.io.ByteArrayOutputStream; | |||||
| import java.io.File; | |||||
| import java.io.FileOutputStream; | |||||
| import java.io.IOException; | |||||
| import java.io.OutputStream; | |||||
| import java.lang.reflect.Field; | |||||
| import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.Project; | |||||
| /** | |||||
| * This class is not used by the framework any more. | |||||
| * We plan to remove it in Ant 1.8 | |||||
| * @deprecated since Ant 1.7 | |||||
| * | |||||
| */ | |||||
| abstract class XalanExecutor { | |||||
| private static final String PACKAGE = | |||||
| "org.apache.tools.ant.taskdefs.optional.junit."; | |||||
| // CheckStyle:VisibilityModifier OFF - bc | |||||
| /** the transformer caller */ | |||||
| protected AggregateTransformer caller; | |||||
| // CheckStyle:VisibilityModifier ON | |||||
| /** set the caller for this object. */ | |||||
| private void setCaller(AggregateTransformer caller) { | |||||
| this.caller = caller; | |||||
| } | |||||
| /** get the appropriate stream based on the format (frames/noframes) */ | |||||
| protected final OutputStream getOutputStream() throws IOException { | |||||
| if (AggregateTransformer.FRAMES.equals(caller.format)) { | |||||
| // dummy output for the framed report | |||||
| // it's all done by extension... | |||||
| return new ByteArrayOutputStream(); | |||||
| } else { | |||||
| return new BufferedOutputStream( | |||||
| new FileOutputStream(new File(caller.toDir, "junit-noframes.html"))); | |||||
| } | |||||
| } | |||||
| /** override to perform transformation */ | |||||
| abstract void execute() throws Exception; | |||||
| /** | |||||
| * Create a valid Xalan executor. It checks if Xalan2 is | |||||
| * present. If none is available, it fails. | |||||
| * @param caller object containing the transformation information. | |||||
| * @throws BuildException thrown if it could not find a valid xalan | |||||
| * executor. | |||||
| */ | |||||
| static XalanExecutor newInstance(AggregateTransformer caller) | |||||
| throws BuildException { | |||||
| XalanExecutor executor = null; | |||||
| try { | |||||
| Class clazz = Class.forName(PACKAGE + "Xalan2Executor"); | |||||
| executor = (XalanExecutor) clazz.newInstance(); | |||||
| } catch (Exception xsltcApacheMissing) { | |||||
| caller.task.log(xsltcApacheMissing.toString()); | |||||
| throw new BuildException("Could not find xstlc nor xalan2 " | |||||
| + "in the classpath. Check " | |||||
| + "http://xml.apache.org/xalan-j"); | |||||
| } | |||||
| String classNameImpl = executor.getImplementation(); | |||||
| String version = executor.getProcVersion(classNameImpl); | |||||
| caller.task.log("Using " + version, Project.MSG_VERBOSE); | |||||
| executor.setCaller(caller); | |||||
| return executor; | |||||
| } | |||||
| /** | |||||
| * This methods should return the classname implementation of the | |||||
| * underlying xslt processor | |||||
| * @return the classname of the implementation, for example: | |||||
| * org.apache.xalan.processor.TransformerFactoryImpl | |||||
| * @see #getProcVersion(String) | |||||
| */ | |||||
| protected abstract String getImplementation(); | |||||
| /** | |||||
| * Try to discover the xslt processor version based on the | |||||
| * className. There is nothing carved in stone and it can change | |||||
| * anytime, so this is just for the sake of giving additional | |||||
| * information if we can find it. | |||||
| * @param classNameImpl the classname of the underlying xslt processor | |||||
| * @return a string representing the implementation version. | |||||
| * @throws BuildException | |||||
| */ | |||||
| protected abstract String getProcVersion(String classNameImpl) | |||||
| throws BuildException; | |||||
| /** a bit simplistic but xsltc data are conveniently private non final */ | |||||
| protected final String getXSLTCVersion(String procVersionClassName) | |||||
| throws ClassNotFoundException { | |||||
| // there's a convenient xsltc class version but data are | |||||
| // private so use package information | |||||
| Class procVersion = Class.forName(procVersionClassName); | |||||
| Package pkg = procVersion.getPackage(); | |||||
| return pkg.getName() + " " + pkg.getImplementationTitle() | |||||
| + " " + pkg.getImplementationVersion(); | |||||
| } | |||||
| /** pretty useful data (Xalan version information) to display. */ | |||||
| protected final String getXalanVersion(String procVersionClassName) | |||||
| throws ClassNotFoundException { | |||||
| Class procVersion = Class.forName(procVersionClassName); | |||||
| String pkg = procVersion.getPackage().getName(); | |||||
| try { | |||||
| Field f = procVersion.getField("S_VERSION"); | |||||
| return pkg + " " + f.get(null).toString(); | |||||
| } catch (Exception e) { | |||||
| return pkg + " ?.?"; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -65,7 +65,7 @@ public class XsltTest extends BuildFileTest { | |||||
| public void testCatchNoDtd() throws Exception { | public void testCatchNoDtd() throws Exception { | ||||
| expectBuildExceptionContaining("testCatchNoDtd", | expectBuildExceptionContaining("testCatchNoDtd", | ||||
| "expected failure", | "expected failure", | ||||
| "Fatal error during transformation"); | |||||
| /* actually: "chemical" */null); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -79,6 +79,7 @@ public class XsltTest extends BuildFileTest { | |||||
| executeTarget("testOutputProperty"); | executeTarget("testOutputProperty"); | ||||
| } | } | ||||
| /* Only runs if xalan.jar is in CP (not incl. Sun's JRE repackaging): | |||||
| public void testFactory() throws Exception { | public void testFactory() throws Exception { | ||||
| executeTarget("testFactory"); | executeTarget("testFactory"); | ||||
| } | } | ||||
| @@ -86,6 +87,8 @@ public class XsltTest extends BuildFileTest { | |||||
| public void testAttribute() throws Exception { | public void testAttribute() throws Exception { | ||||
| executeTarget("testAttribute"); | executeTarget("testAttribute"); | ||||
| } | } | ||||
| */ | |||||
| public void testXMLWithEntitiesInNonAsciiPath() throws Exception { | public void testXMLWithEntitiesInNonAsciiPath() throws Exception { | ||||
| executeTarget("testXMLWithEntitiesInNonAsciiPath"); | executeTarget("testXMLWithEntitiesInNonAsciiPath"); | ||||
| } | } | ||||
| @@ -1785,10 +1785,7 @@ mv /tmp/foo $ANT_HOME/bin/antRun | |||||
| dependencies on external libraries. You can move the | dependencies on external libraries. You can move the | ||||
| "offending" jar out of <code>ANT_HOME/lib</code>. For the | "offending" jar out of <code>ANT_HOME/lib</code>. For the | ||||
| <code><junit></code> task it would be | <code><junit></code> task it would be | ||||
| <code>ant-junit.jar</code> and for <code><style></code> | |||||
| it would be <code>ant-trax.jar</code> | |||||
| or <code>ant-xslp.jar</code> - | |||||
| depending on the processor you use.</p> | |||||
| <code>ant-junit.jar</code>.</p> | |||||
| <p>If you do so, you will have to <code><taskdef></code> | <p>If you do so, you will have to <code><taskdef></code> | ||||
| all optional tasks that need the external library and use | all optional tasks that need the external library and use | ||||