From 18784a313b7d3cc5ebc714ca4d7c2eacdf0718ab Mon Sep 17 00:00:00 2001 From: Jacobus Martinus Kruithof Date: Sun, 25 Jun 2006 14:38:27 +0000 Subject: [PATCH] Removed support for Xalan1. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@417020 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 5 +- build.xml | 17 --- docs/faq.html | 3 +- docs/manual/CoreTasks/style.html | 16 +-- docs/manual/OptionalTasks/junitreport.html | 3 +- .../tools/ant/taskdefs/XSLTProcess.java | 21 +--- .../ant/taskdefs/optional/XalanLiaison.java | 116 ------------------ .../optional/junit/Xalan1Executor.java | 81 ------------ .../optional/junit/XalanExecutor.java | 15 +-- .../taskdefs/optional/XalanLiaisonTest.java | 56 --------- xdocs/faq.xml | 4 +- 11 files changed, 19 insertions(+), 318 deletions(-) delete mode 100644 src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java delete mode 100644 src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java delete mode 100644 src/testcases/org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java diff --git a/WHATSNEW b/WHATSNEW index 6df5f23cb..bfcb25071 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -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. diff --git a/build.xml b/build.xml index 00c884965..41f4e40aa 100644 --- a/build.xml +++ b/build.xml @@ -200,13 +200,6 @@ - - - - - - - @@ -407,9 +400,6 @@ - @@ -657,7 +647,6 @@ - - @@ -883,7 +871,6 @@ - @@ -1698,10 +1685,6 @@ unless="trax.impl.present"/> - - ANT_HOME/lib. For the <junit> task it would be ant-junit.jar and for <style> - it would be ant-trax.jar, - ant-xalan1.jar or ant-xslp.jar - + it would be ant-trax.jar or ant-xslp.jar - depending on the processor you use.

If you do so, you will have to <taskdef> all optional tasks that need the external library and use diff --git a/docs/manual/CoreTasks/style.html b/docs/manual/CoreTasks/style.html index 1db2dea86..6d823e320 100644 --- a/docs/manual/CoreTasks/style.html +++ b/docs/manual/CoreTasks/style.html @@ -114,20 +114,12 @@ element which is used to perform Entity and URI resolution.

processor name of the XSLT processor to use. - Permissible values are :
    + Permissible value is :
    • "trax" for a TraX compliant processor (ie JAXP interface - implementation such as Xalan 2 or Saxon)
    • -
    • "xalan" for - the Apache XML Xalan (version 1) processor
    • -
    • the name of a custom class implementing the interface - org.apache.tools.ant.taskdefs.XSLTLiaison.
    • -
    - 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)
+ Defaults to trax.
- DEPRECATED - xalan (xalan1) is deprecated and no - more supported.. + Support for xalan1 has been removed in ant 1.7. No diff --git a/docs/manual/OptionalTasks/junitreport.html b/docs/manual/OptionalTasks/junitreport.html index 97071c490..1450f05d0 100644 --- a/docs/manual/OptionalTasks/junitreport.html +++ b/docs/manual/OptionalTasks/junitreport.html @@ -29,12 +29,13 @@ out of the box. The table below summarize the compatibility status. XSLTCJDK 1.5.xOK 2.xJDK 1.4.xDEPRECATED
Use ${ant.home}/etc/junit-frames-xalan1.xsl
Upgrade Xalan using the JDK endorsement mechanism
-1.2N/ADEPRECATED
Use ${ant.home}/etc/junit-frames-xalan1.xsl

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.

+

With Ant 1.7 we had to drop support Xalan-J 1, since Xalan-J 1 has not +available anymore for quite some time.

Parameters

diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index 6d28dc3c3..bb981bdab 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -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); } } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java b/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java deleted file mode 100644 index 36b03df03..000000000 --- a/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java +++ /dev/null @@ -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 diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java deleted file mode 100644 index 5238ed51c..000000000 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java +++ /dev/null @@ -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(); - } - } -} diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java index 2b26213a4..ebc8370c4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java @@ -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); diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java b/src/testcases/org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java deleted file mode 100644 index b1d06a449..000000000 --- a/src/testcases/org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java +++ /dev/null @@ -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(); - } - } -} - diff --git a/xdocs/faq.xml b/xdocs/faq.xml index 7857bff4e..a810019f2 100644 --- a/xdocs/faq.xml +++ b/xdocs/faq.xml @@ -1568,8 +1568,8 @@ mv /tmp/foo $ANT_HOME/bin/antRun "offending" jar out of ANT_HOME/lib. For the <junit> task it would be ant-junit.jar and for <style> - it would be ant-trax.jar, - ant-xalan1.jar or ant-xslp.jar - + it would be ant-trax.jar + or ant-xslp.jar - depending on the processor you use.

If you do so, you will have to <taskdef>