git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@417020 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -2,7 +2,10 @@ Changes from current Ant 1.6.5 version to current SVN version | |||
| ============================================================= | |||
| Changes that could break older environments: | |||
| -------------------------------------------- | |||
| ------------------------------------------- | |||
| * Removed support for xalan1 completely. Users of Xalan1 for ant builds will | |||
| have to stay at ant 1.6.5 or upgrade to xalan2. | |||
| * Improved recursion detection for lines with multiple matches of same token on one single line. | |||
| Bugzilla report 38456. | |||
| @@ -200,13 +200,6 @@ | |||
| </or> | |||
| </selector> | |||
| <selector id="needs.xalan1"> | |||
| <or> | |||
| <filename name="${optional.package}/XalanLiaison*"/> | |||
| <filename name="${optional.package}/junit/Xalan1Executor*"/> | |||
| </or> | |||
| </selector> | |||
| <selector id="needs.apache-resolver"> | |||
| <filename name="${apache.resolver.type.package}/**"/> | |||
| </selector> | |||
| @@ -407,9 +400,6 @@ | |||
| <available property="apache.resolver.present" | |||
| classname="org.apache.xml.resolver.tools.CatalogResolver" | |||
| classpathref="classpath"/> | |||
| <available property="xalan.present" | |||
| classname="org.apache.xalan.xslt.XSLTProcessorFactory" | |||
| classpathref="classpath"/> | |||
| <available property="xalan2.present" | |||
| classname="org.apache.xalan.transformer.TransformerImpl" | |||
| classpathref="classpath"/> | |||
| @@ -657,7 +647,6 @@ | |||
| <selector refid="needs.sun.b64" unless="base64.present"/> | |||
| <selector refid="needs.trax" unless="trax.present"/> | |||
| <selector refid="needs.xalan1" unless="xalan.present"/> | |||
| <selector refid="needs.apache-resolver" unless="apache.resolver.present"/> | |||
| <selector refid="needs.junit" unless="junit.present"/> | |||
| <selector refid="needs.apache-regexp" | |||
| @@ -838,7 +827,6 @@ | |||
| <not> | |||
| <or> | |||
| <selector refid="needs.trax"/> | |||
| <selector refid="needs.xalan1"/> | |||
| <selector refid="needs.apache-resolver"/> | |||
| <selector refid="needs.junit"/> | |||
| <selector refid="needs.apache-regexp"/> | |||
| @@ -883,7 +871,6 @@ | |||
| </macrodef> | |||
| <optional-jar dep="trax"/> | |||
| <optional-jar dep="xalan1"/> | |||
| <optional-jar dep="apache-resolver"/> | |||
| <optional-jar dep="junit"/> | |||
| <optional-jar dep="apache-regexp"/> | |||
| @@ -1698,10 +1685,6 @@ | |||
| unless="trax.impl.present"/> | |||
| <!-- needs xerces to work --> | |||
| <exclude name="${optional.package}/XalanLiaisonTest.java" | |||
| unless="bsf.present"/> | |||
| <exclude name="${optional.package}/XalanLiaisonTest.java" | |||
| unless="xerces1.present"/> | |||
| <exclude name="${ant.package}/IncludeTest.java" | |||
| unless="xerces1.present"/> | |||
| <exclude name="${type.package}/selectors/ModifiedSelectorTest.java" | |||
| @@ -1813,8 +1813,7 @@ mv /tmp/foo $ANT_HOME/bin/antRun | |||
| "offending" jar out of <code>ANT_HOME/lib</code>. For the | |||
| <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>, | |||
| <code>ant-xalan1.jar</code> or <code>ant-xslp.jar</code> - | |||
| it would be <code>ant-trax.jar</code> or <code>ant-xslp.jar</code> - | |||
| depending on the processor you use.</p> | |||
| <p>If you do so, you will have to <code><taskdef></code> | |||
| all optional tasks that need the external library and use | |||
| @@ -114,20 +114,12 @@ element which is used to perform Entity and URI resolution.</p> | |||
| <td valign="top">processor</td> | |||
| <td valign="top">name of the XSLT processor to use. | |||
| Permissible values are :<ul> | |||
| Permissible value is :<ul> | |||
| <li>"trax" for a TraX compliant processor (ie JAXP interface | |||
| implementation such as Xalan 2 or Saxon)</li> | |||
| <li>"xalan" for | |||
| the Apache XML Xalan (version 1) processor</li> | |||
| <li>the name of a custom class implementing the interface | |||
| <code>org.apache.tools.ant.taskdefs.XSLTLiaison.</code></li> | |||
| </ul> | |||
| Defaults to trax, followed by xalan | |||
| The first one found in your class | |||
| path is the one that is used. | |||
| implementation such as Xalan 2 or Saxon)</li></ul> | |||
| Defaults to trax. | |||
| <br/> | |||
| <em><strong>DEPRECATED</strong> - xalan (xalan1) is deprecated and no | |||
| more supported.</em>. | |||
| Support for xalan1 has been removed in ant 1.7. | |||
| </td> | |||
| <td align="center" valign="top">No</td> | |||
| </tr> | |||
| @@ -29,12 +29,13 @@ out of the box. The table below summarize the compatibility status. | |||
| <tr><td>XSLTC</td><td>JDK 1.5.x</td><td>OK</td></tr> | |||
| <tr><td>2.x</td><td>JDK 1.4.x</td><td>DEPRECATED<br><i>Use ${ant.home}/etc/junit-frames-xalan1.xsl | |||
| <br> Upgrade Xalan using the JDK endorsement mechanism</i></td></tr> | |||
| <tr><td>1.2</td><td>N/A</td><td>DEPRECATED<br><i>Use ${ant.home}/etc/junit-frames-xalan1.xsl</i><td></tr> | |||
| </table> | |||
| <p>With Ant 1.6.2 we had to decide between supporting Xalan-J 1/Xalan J 2.4.1- | |||
| and Xalan 2.4.1+/XSLTC, since there was no way to support both couples at the same | |||
| time.</p> | |||
| <p>With Ant 1.7 we had to drop support Xalan-J 1, since Xalan-J 1 has not | |||
| available anymore for quite some time.</p> | |||
| <h3>Parameters</h3> | |||
| <table border="1" cellpadding="2" cellspacing="0"> | |||
| @@ -99,10 +99,6 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| private static final String TRAX_LIAISON_CLASS = | |||
| "org.apache.tools.ant.taskdefs.optional.TraXLiaison"; | |||
| /** Name of the now-deprecated Xalan liaison class */ | |||
| private static final String XALAN_LIAISON_CLASS = | |||
| "org.apache.tools.ant.taskdefs.optional.XalanLiaison"; | |||
| /** Utilities used for file operations */ | |||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
| @@ -163,11 +159,6 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| * @since Ant 1.7 | |||
| */ | |||
| public static final String PROCESSOR_TRAX = "trax"; | |||
| /** | |||
| * The xalan1 processor (deprecated option) | |||
| * @since Ant 1.7 | |||
| */ | |||
| public static final String PROCESSOR_XALAN1 = "xalan"; | |||
| /** | |||
| * Creates a new XSLTProcess Task. | |||
| @@ -493,10 +484,6 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| String classname; | |||
| if (proc.equals(PROCESSOR_TRAX)) { | |||
| classname = TRAX_LIAISON_CLASS; | |||
| } else if (proc.equals(PROCESSOR_XALAN1)) { | |||
| log("DEPRECATED - xalan processor is deprecated. Use trax " | |||
| + "instead."); | |||
| classname = XALAN_LIAISON_CLASS; | |||
| } else { | |||
| //anything else is a classname | |||
| classname = proc; | |||
| @@ -753,12 +740,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| try { | |||
| resolveProcessor(PROCESSOR_TRAX); | |||
| } catch (Throwable e1) { | |||
| try { | |||
| resolveProcessor(PROCESSOR_XALAN1); | |||
| } catch (Throwable e2) { | |||
| e2.printStackTrace(); | |||
| throw new BuildException(e1); | |||
| } | |||
| e1.printStackTrace(); | |||
| throw new BuildException(e1); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,116 +0,0 @@ | |||
| /* | |||
| * Copyright 2000-2002,2004-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed 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; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileOutputStream; | |||
| import java.io.IOException; | |||
| import org.apache.tools.ant.taskdefs.XSLTLiaison; | |||
| import org.apache.xalan.xslt.XSLTInputSource; | |||
| import org.apache.xalan.xslt.XSLTProcessor; | |||
| import org.apache.xalan.xslt.XSLTProcessorFactory; | |||
| import org.apache.xalan.xslt.XSLTResultTarget; | |||
| /** | |||
| * Concrete liaison for Xalan 1.x API. | |||
| * | |||
| * @since Ant 1.1 | |||
| */ | |||
| public class XalanLiaison implements XSLTLiaison { | |||
| protected XSLTProcessor processor; | |||
| protected File stylesheet; | |||
| /** | |||
| * Constructor for XalanLiaison. | |||
| * @throws Exception on error | |||
| */ | |||
| public XalanLiaison() throws Exception { | |||
| processor = XSLTProcessorFactory.getProcessor(); | |||
| } | |||
| /** | |||
| * Set the style sheet to use. | |||
| * @param stylesheet the style sheet file to use | |||
| * @throws Exception on error | |||
| */ | |||
| public void setStylesheet(File stylesheet) throws Exception { | |||
| this.stylesheet = stylesheet; | |||
| } | |||
| /** | |||
| * Carry out the transformation. | |||
| * @param infile the input file | |||
| * @param outfile the output file | |||
| * @throws Exception on error | |||
| */ | |||
| public void transform(File infile, File outfile) throws Exception { | |||
| FileInputStream fis = null; | |||
| FileOutputStream fos = null; | |||
| FileInputStream xslStream = null; | |||
| try { | |||
| xslStream = new FileInputStream(stylesheet); | |||
| fis = new FileInputStream(infile); | |||
| fos = new FileOutputStream(outfile); | |||
| // systemid such as file:/// + getAbsolutePath() are considered | |||
| // invalid here... | |||
| XSLTInputSource xslSheet = new XSLTInputSource(xslStream); | |||
| xslSheet.setSystemId(stylesheet.getAbsolutePath()); | |||
| XSLTInputSource src = new XSLTInputSource(fis); | |||
| src.setSystemId(infile.getAbsolutePath()); | |||
| XSLTResultTarget res = new XSLTResultTarget(fos); | |||
| processor.process(src, xslSheet, res); | |||
| } finally { | |||
| // make sure to close all handles, otherwise the garbage | |||
| // collector will close them...whenever possible and | |||
| // Windows may complain about not being able to delete files. | |||
| try { | |||
| if (xslStream != null) { | |||
| xslStream.close(); | |||
| } | |||
| } catch (IOException ignored) { | |||
| //ignore | |||
| } | |||
| try { | |||
| if (fis != null) { | |||
| fis.close(); | |||
| } | |||
| } catch (IOException ignored) { | |||
| //ignore | |||
| } | |||
| try { | |||
| if (fos != null) { | |||
| fos.close(); | |||
| } | |||
| } catch (IOException ignored) { | |||
| //ignore | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Add a parameter. | |||
| * @param name the name of the parameter | |||
| * @param value the value of the parameter | |||
| */ | |||
| public void addParam(String name, String value) { | |||
| processor.setStylesheetParam(name, value); | |||
| } | |||
| } //-- XalanLiaison | |||
| @@ -1,81 +0,0 @@ | |||
| /* | |||
| * Copyright 2001-2002,2004 The Apache Software Foundation | |||
| * | |||
| * Licensed 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 org.apache.xalan.xslt.XSLTInputSource; | |||
| import org.apache.xalan.xslt.XSLTProcessor; | |||
| import org.apache.xalan.xslt.XSLTProcessorFactory; | |||
| import org.apache.xalan.xslt.XSLTResultTarget; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.xml.sax.SAXException; | |||
| /** | |||
| * Xalan 1 executor. It will need a lot of things in the classpath: | |||
| * xerces for the serialization, xalan and bsf for the extension. | |||
| * @todo do everything via reflection to avoid compile problems ? | |||
| * | |||
| * @ant.task ignore="true" | |||
| */ | |||
| public class Xalan1Executor extends XalanExecutor { | |||
| private static final String xsltP = "org.apache.xalan.xslt.XSLTProcessor"; | |||
| XSLTProcessor processor = null; | |||
| public Xalan1Executor() { | |||
| try { | |||
| processor = XSLTProcessorFactory.getProcessor(); | |||
| } catch (SAXException e) { | |||
| e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. | |||
| } | |||
| } | |||
| protected String getImplementation() { | |||
| return processor.getClass().getName(); | |||
| } | |||
| protected String getProcVersion(String classNameImpl) | |||
| throws BuildException { | |||
| try { | |||
| // xalan 1 | |||
| if (classNameImpl.equals(xsltP)) { | |||
| return getXalanVersion(xsltP + "Version"); | |||
| } | |||
| 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); | |||
| } | |||
| } | |||
| void execute() throws Exception { | |||
| // need to quote otherwise it breaks because of "extra illegal tokens" | |||
| processor.setStylesheetParam("output.dir", "'" | |||
| + caller.toDir.getAbsolutePath() + "'"); | |||
| XSLTInputSource xml_src = new XSLTInputSource(caller.document); | |||
| String system_id = caller.getStylesheetSystemId(); | |||
| XSLTInputSource xsl_src = new XSLTInputSource(system_id); | |||
| OutputStream os = getOutputStream(); | |||
| try { | |||
| XSLTResultTarget target = new XSLTResultTarget(os); | |||
| processor.process(xml_src, xsl_src, target); | |||
| } finally { | |||
| os.close(); | |||
| } | |||
| } | |||
| } | |||
| @@ -60,9 +60,8 @@ abstract class XalanExecutor { | |||
| abstract void execute() throws Exception; | |||
| /** | |||
| * Create a valid Xalan executor. It checks first if Xalan2 is | |||
| * present, if not it checks for xalan1. If none is available, it | |||
| * fails. | |||
| * 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. | |||
| @@ -75,15 +74,9 @@ abstract class XalanExecutor { | |||
| executor = (XalanExecutor) clazz.newInstance(); | |||
| } catch (Exception xsltcApacheMissing) { | |||
| caller.task.log(xsltcApacheMissing.toString()); | |||
| try { | |||
| Class clazz = Class.forName(PACKAGE + "Xalan1Executor"); | |||
| executor = (XalanExecutor) clazz.newInstance(); | |||
| } catch (Exception xalan1Missing) { | |||
| caller.task.log(xalan1Missing.toString()); | |||
| throw new BuildException("Could not find xstlc nor xalan2 nor " | |||
| + "xalan1 in the classpath. Check " | |||
| 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); | |||
| @@ -1,56 +0,0 @@ | |||
| /* | |||
| * Copyright 2001-2002,2004 The Apache Software Foundation | |||
| * | |||
| * Licensed 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; | |||
| import org.apache.tools.ant.taskdefs.XSLTLiaison; | |||
| import java.io.File; | |||
| /** | |||
| * Xalan Liaison testcase | |||
| */ | |||
| public class XalanLiaisonTest extends AbstractXSLTLiaisonTest { | |||
| public XalanLiaisonTest(String name){ | |||
| super(name); | |||
| } | |||
| public void tearDown() { | |||
| File f = new File("xalan1-redirect-out.tmp"); | |||
| if (f.exists()) { | |||
| f.delete(); | |||
| } | |||
| } | |||
| protected XSLTLiaison createLiaison() throws Exception { | |||
| return new XalanLiaison(); | |||
| } | |||
| public void testXalan1Redirect() throws Exception { | |||
| File xsl = getFile("/taskdefs/optional/xalan-redirect-in.xsl"); | |||
| liaison.setStylesheet(xsl); | |||
| File out = new File("xalan1-redirect-out-dummy.tmp"); | |||
| File in = getFile("/taskdefs/optional/xsltliaison-in.xsl"); | |||
| try { | |||
| liaison.addParam("xalan-version", "1"); | |||
| liaison.transform(in, out); | |||
| } finally { | |||
| out.delete(); | |||
| } | |||
| } | |||
| } | |||
| @@ -1568,8 +1568,8 @@ mv /tmp/foo $ANT_HOME/bin/antRun | |||
| "offending" jar out of <code>ANT_HOME/lib</code>. For the | |||
| <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>, | |||
| <code>ant-xalan1.jar</code> or <code>ant-xslp.jar</code> - | |||
| it would be <code>ant-trax.jar</code> | |||
| or <code>ant-xslp.jar</code> - | |||
| depending on the processor you use.</p> | |||
| <p>If you do so, you will have to <code><taskdef></code> | |||