From 7cd7c4e5f82cbe8a3fe5d03b7c8ea871a523fdd1 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 6 May 2003 15:19:17 +0000 Subject: [PATCH] Big VAJ changes, in particular if they have ever worked for anybody, they probably won't do so any longer. Make the servlets work by using IBM's servlet classes PR: 10016 URL-encoding in didn't work properly. The VAJ tasks now support a haltonfailure attribute to conditionally keep building even if they fail. It is now possible to use the latest (versioned or unversioned) edition in by using special wildcard characters. PR: 2236. Submitted by: Martin Landers Francois Rey git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274553 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 16 +++ build.xml | 9 -- docs/manual/Integration/VAJAntTool.html | 117 ++++++++++-------- .../ant/taskdefs/optional/ide/VAJExport.java | 96 +++++++++++--- .../ant/taskdefs/optional/ide/VAJImport.java | 77 +++++++----- .../ant/taskdefs/optional/ide/VAJLoad.java | 58 +++++++-- .../taskdefs/optional/ide/VAJLocalUtil.java | 58 ++++++++- .../taskdefs/optional/ide/VAJRemoteUtil.java | 10 +- .../ant/taskdefs/optional/ide/VAJTask.java | 16 ++- .../optional/ide/VAJToolsServlet.java | 12 +- 10 files changed, 334 insertions(+), 135 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 3a3891d64..6a47bc8e2 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -30,6 +30,10 @@ Changes that could break older environments: of the older ORO Netcomponents version. See . +* If the Visual Age tasks used to work for you, they may stop doing so + now - and we'd like to know about it. The current set of tasks is + supposed to work with any version of VAJ starting with 3.0. + Fixed bugs: ----------- * Filter readers were not handling line endings properly. Bugzilla @@ -115,6 +119,11 @@ Fixed bugs: * Setting filesonly to true in and related tasks would cause the archives to be always recreated. Bugzilla Report 19449. +* The Visual Age for Java tasks didn't work (at least for versions 3.0 + and higher). Bugzilla Report 10016. + +* URL-encoding in didn't work properly. + Other changes: -------------- * Six new Clearcase tasks added. @@ -286,6 +295,13 @@ Other changes: control the automatic line-end conversion performed on ASCII files. Bugzilla Report 18884. +* The VAJ tasks now support a haltonfailure attribute to conditionally + keep building even if they fail. + +* It is now possible to use the latest (versioned or unversioned) edition + in by using special wildcard characters. Also fixes + Bugzilla Report 2236. + Changes from Ant 1.5.2 to Ant 1.5.3 =================================== diff --git a/build.xml b/build.xml index 4a33a3d40..fb18c6d49 100644 --- a/build.xml +++ b/build.xml @@ -249,9 +249,6 @@ - - - @@ -403,10 +400,6 @@ classname="org.apache.env.Which" classpathref="classpath"/> - - @@ -587,7 +580,6 @@ - @@ -755,7 +747,6 @@ - diff --git a/docs/manual/Integration/VAJAntTool.html b/docs/manual/Integration/VAJAntTool.html index 98b8f4291..1d088784d 100644 --- a/docs/manual/Integration/VAJAntTool.html +++ b/docs/manual/Integration/VAJAntTool.html @@ -12,8 +12,12 @@
  • Wolf Siberski (siberski at kbs.uni-hannover.de)
  • Christoph Wilhelms - (christoph.wilhelms at tui.de)
  • -Version 1.2 - 2001/06/14
    + (christoph.wilhelms at tui.de) +
  • Martin Landers + (martin.landers@bea.de)
  • +
  • François Rey + (francois.rey@capco.com)
  • +Version 1.2.1 - 2003/01/16

    Table of Contents

      @@ -47,6 +51,14 @@ viewed in a logging window. Concluding: This tool provides decent deployment support VAJ has not (out of the box).

      What's new

      + + + - + -
      2003/01/16 +
        +
      • Now works outside of VAJ. +
      • Added attribute haltonerror, "*" and "**" version qualifiers. +
      • Amended documentation (this file) accordingly. +
      2001/06/14 @@ -97,14 +109,20 @@ workspace.

      Attribute Description Required
      remote

      name and port of a remote tool server. (format: <servername>:<port no>).
      If this attribute is set, the tasks will be executed on the specified tool server. 

      no
      + no + + haltonerror + +

      Stop the build process if an error occurs, + (default: "yes")

      + no

      Parameters specified as nested elements

      vajproject

      @@ -121,13 +139,17 @@ workspace.

      yes version - name of the requested version +

      name of the requested version, + or one of the special qualifiers "*" or "**"
      + "*" loads the latest versioned edition of the project
      + "**" will load the latest version (including open editions)

      yes

      Example

      <vajload remote="localhost:32767">
      -    <vajproject name="My Testcases" version="1.7beta"/>
      +    <vajproject name="My App" version="*"/>
      +    <vajproject name="My Testcases" version="**"/>
           <vajproject name="JUnit" version="3.2"/>
       </vajload>
       
      @@ -191,7 +213,13 @@ files <servername>:<port no>).
      If this attribute is set, the tasks will be executed on the specified tool server. 

      - no + no + + haltonerror + +

      Stop the build process if an error occurs, + (default: "yes")

      + no

      Parameters specified as nested elements

      @@ -258,7 +286,7 @@ from the file system into VAJ. These imports can be specified with a fileset. Description Required - vajProject + project imported files are added to this VAJ project yes @@ -283,7 +311,13 @@ from the file system into VAJ. These imports can be specified with a fileset. <servername>:<port no>).
      If this attribute is set, the tasks will be executed on the specified tool server. 

      - no + no + + haltonerror + +

      Stop the build process if an error occurs, + (default: "yes")

      + no

      Parameters specified as nested elements

      @@ -313,34 +347,16 @@ from the VAJ Tools menu (see Usage).

      Installation

      -

      At the moment the installation has it's rough edges. If something -described below doesn't work for You, it's probably not Your fault -but incomplete/wrong instructions. In this case, please contact one -of the authors.

      We assume C:\IBMVJava as VAJ install directory. If You have installed it elsewhere, adapt the pathes below.

      Plugin

        -
      • install the Visual Age IDE Tools (via File->Quick - Start-> Add feature->'IBM IDE Utility class libraries' -
      • import an appropriate XML parser to VAJ (we use Xerces - 1.2.0 and are happy with it). Unfortunately the XML parser delivered with VAJ - (in the project 'IBM XML Parser for Java') doesn't work with Ant. You have to - remove that project (temporarily) from the workspace before importing another - XML implementation. - -
      • import the Ant sources and resources into VAJ.
      • Create the directory C:\IBMVJava\ide\tools\org-apache-tools-ant. -
      • export the Ant and XML parser class and resource files - into this directory. Be sure to select class files and - resources. Sources don't have to - be exported. Some optional tasks have errors and can't be exported when You - don't have the necessary packages in Your workspace (e.g. junit task, ejbc - task). If You need this tasks either import these packages into VAJ, too, or - copy the .class files directly from the binary distribution. +
      • Expand in that directory all the jars contained in the lib + directory of your Ant installation.
      • copy default.ini (in - ant\src\...\taskdefs\optional\ide) to + org\apache\tools\ant\taskdefs\optional\ide) to C:\IBMVJava\ide\tools\org-apache-tools-ant\default.ini.
      • if you want to access this help from the Workbench, create the @@ -351,9 +367,7 @@ install directory. If You have installed it elsewhere, adapt the pathes below.
      • VAJ has to be restarted to recognize the new tool.
      • Now if You open the context menu of a project, You should see the entry 'Ant Build' in the Tools submenu (see Usage). -
      • Make sure the tool works as expected. Now You can - remove Ant and the imported XML parser from Your workspace (and optionally add - the IBM parser again).
      +
    • Make sure the tool works as expected.

    Servlets for Remote Tool Access

    • @@ -372,25 +386,11 @@ install directory. If You have installed it elsewhere, adapt the pathes below.
      servlet.vajload.code=org.apache.tools.ant.taskdefs.optional.ide.VAJLoadServlet
       servlet.vajexport.code=org.apache.tools.ant.taskdefs.optional.ide.VAJExportServlet
      -servlet.vajimport.code=org.apache.tools.ant.taskdefs.optional.ide.VAJImportServletName
        
      -
    • export the following classes from the package - org.apache.tools.ant - to C:\IBMVJava\ide\tools\com-ibm-ivj-toolserver\servlets\:
      - BuildException
      - DirectoryScanner
      - FileScanner
      - Location
      -
    • export the following classes from the package - org.apache.tools.ant.taksdefs.optional.ide - to C:\IBMVJava\ide\tools\com-ibm-ivj-toolserver\servlets\:
      - VAJUtil
      - VAJExportServlet
      - VAJImportServlet
      - VAJLoadServlet
      - VAJLocalUtil
      - VAJProjectDescription
      - VAJToolsServlet
      - VAJWorkspaceScanner
      +servlet.vajimport.code=org.apache.tools.ant.taskdefs.optional.ide.VAJImportServletName
      +
      +  
    • Expand the Ant libraries (ant.jar and optional.jar + contained in the lib directory of your Ant installation) to the directory + C:\IBMVJava\ide\tools\com-ibm-ivj-toolserver\servlets\.
    • configure the Remote Access (via Window->Options..., then choose 'Remote Access To Tool API') as shown in the following picture:
    @@ -460,6 +460,10 @@ files. This messsage appears if the file
    .../org/apache/tools/ant/taskdefs/defaults.properties is missing. Make sure that you import/export not only java/class files, but also all resource files when importing/exporting Ant.

    +

    Q: If I try to re-load a build +file, I get the error "XML parser factory has not been configured correctly". Why?
    +A: Make sure the META-INF/services directory of the xercesImpl.jar has also been expanded +into the C:\IBMVJava\ide\tools\org-apache-tools-ant directory.

    Q: I want to load, export and build more then one Visual Age project to one jar! How to?
    A: The VA tasks are able to load and export several @@ -551,9 +555,14 @@ JDK independent by now. 1.2 2001/07/02 -

    Added documentation of new remote feature.
    Minor corrections.

    +

    Added documentation of new remote feature.
    Minor corrections.

    + + 1.2.1 + 2003/01/16 + +

    Added documentation for haltonerror, "*" and "**" version qualifiers.


    -
    Copyright &#copy 2001-2003 Apache Software +
    Copyright © 2001-2003 Apache Software Foundation. All rights Reserved.
    diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java index 6661ad42f..22aecdfc8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,23 +68,77 @@ import org.apache.tools.ant.types.PatternSet; * their respective package 'dir's. * Example: *
    - * <vajexport destdir="C:/builddir/source"> - *  <include name="/MyVAProject/org/foo/subsystem1/**" /> - *  <exclude name="/MyVAProject/org/foo/subsystem1/test/**"/> - * </vajexport> + * <vajexport destdir="C:/builddir/source"> + *  <include name="/MyVAProject/org/foo/subsystem1/**" /> + *  <exclude name="/MyVAProject/org/foo/subsystem1/test/**"/> + * </vajexport> *
    * exports all packages in the project MyVAProject which start with * 'org.foo.subsystem1' except of these starting with * 'org.foo.subsystem1.test'. * - * There are flags to choose which items to export: - * exportSources: export Java sources - * exportResources: export project resources - * exportClasses: export class files - * exportDebugInfo: export class files with debug info (use with exportClasses) - * default is exporting Java files and resources. + *

    Parameters: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    AttributeDescriptionRequired
    destdirlocation to store the exported filesYes
    exportSourcesexport Java sources, defaults to "yes"No
    exportResourcesexport resource files, defaults to "yes"No
    exportClassesexport class files, defaults to "no"No
    exportDebugInfoinclude debug info in exported class files, + * defaults to "no"No
    defaultexcludesuse default excludes when exporting, + * defaults to "yes". + * Default excludes are: IBM/**, + * Java class libraries/**, Sun class libraries/**, + * JSP Page Compile Generated Code/**, Visual Age*/**No
    overwriteoverwrite existing files, defaults to "yes"No
    remoteremote tool server to run this command against + * (format: <servername> : <port no>)No
    haltonerrorstop the build process if an error occurs, + * defaults to "yes"No
    * * @author Wolf Siberski, TUI Infotec GmbH + * @author Martin Landers, Beck et al. projects */ public class VAJExport extends VAJTask { @@ -123,12 +177,20 @@ public class VAJExport extends VAJTask { } // delegate the export to the VAJUtil object. - getUtil().exportPackages(destDir, - patternSet.getIncludePatterns(getProject()), - patternSet.getExcludePatterns(getProject()), - exportClasses, exportDebugInfo, - exportResources, exportSources, - useDefaultExcludes, overwrite); + try { + getUtil().exportPackages(destDir, + patternSet.getIncludePatterns(getProject()), + patternSet.getExcludePatterns(getProject()), + exportClasses, exportDebugInfo, + exportResources, exportSources, + useDefaultExcludes, overwrite); + } catch (BuildException ex) { + if (haltOnError) { + throw ex; + } else { + log(ex.toString()); + } + } } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java index 4dbd90d7b..629195872 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -82,7 +82,7 @@ import org.apache.tools.ant.types.FileSet; * created in the repository and automatically loaded into the Workspace. * There has to be at least one nested FileSet element. *

    - *

    There are attributes to choose which items to export: + *

    Parameters: * * * @@ -110,9 +110,22 @@ import org.apache.tools.ant.types.FileSet; * * * + * + * + * + * + * + * + * + * + * + * *
    Attributeimport class files, defaults to "no"No
    remoteremote tool server to run this command against + * (format: <servername> : <port no>)No
    haltonerrorstop the build process if an error occurs, + * defaults to "yes"No
    * * @author Glenn McAllister, inspired by a similar task written by Peter Kelley + * @author Martin Landers, Beck et al. projects */ public class VAJImport extends VAJTask { protected Vector filesets = new Vector(); @@ -123,6 +136,25 @@ public class VAJImport extends VAJTask { protected boolean useDefaultExcludes = true; + /** + * Extended DirectoryScanner that has accessors for the + * includes and excludes fields. + * + * This is kindof a hack to get includes and excludes + * from the directory scanner. In order to keep + * the URLs short we only want to send the patterns to the + * remote tool server and let him figure out the files. + * + * This replaces the former reflection hack that + * didn't compile for old JDKs. + * + * @see VAJImport#importFileSet(FileSet) + */ + private static class LocalDirectoryScanner extends DirectoryScanner { + public String[] getIncludes() { return includes; } + public String[] getExcludes() { return excludes; } + } + /** * The VisualAge for Java Project name to import into. */ @@ -182,8 +214,16 @@ public class VAJImport extends VAJTask { throw new BuildException("The VisualAge for Java Project name is required!"); } - for (Enumeration e = filesets.elements(); e.hasMoreElements();) { - importFileset((FileSet) e.nextElement()); + try { + for (Enumeration e = filesets.elements(); e.hasMoreElements();) { + importFileset((FileSet) e.nextElement()); + } + } catch (BuildException ex) { + if (haltOnError) { + throw ex; + } else { + log(ex.toString()); + } } } @@ -192,35 +232,14 @@ public class VAJImport extends VAJTask { * Workspace. */ protected void importFileset(FileSet fileset) { - DirectoryScanner ds = fileset.getDirectoryScanner(this.getProject()); + LocalDirectoryScanner ds = new LocalDirectoryScanner(); + fileset.setupDirectoryScanner(ds, this.getProject()); if (ds.getIncludedFiles().length == 0) { return; } - String[] includes = null; - String[] excludes = null; - - // Hack to get includes and excludes. We could also use getIncludedFiles, - // but that would result in very long HTTP-requests. - // Therefore we want to send the patterns only to the remote tool server - // and let him figure out the files. - try { - Class directoryScanner = ds.getClass(); - - Field includesField = directoryScanner.getDeclaredField("includes"); - includesField.setAccessible(true); - includes = (String[]) includesField.get(ds); - - Field excludesField = directoryScanner.getDeclaredField("excludes"); - excludesField.setAccessible(true); - excludes = (String[]) excludesField.get(ds); - } catch (NoSuchFieldException nsfe) { - throw new BuildException( - "DirectoryScanner.includes or .excludes missing" + nsfe.getMessage()); - } catch (IllegalAccessException iae) { - throw new BuildException( - "Access to DirectoryScanner.includes or .excludes not allowed"); - } + String[] includes = ds.getIncludes(); + String[] excludes = ds.getExcludes(); getUtil().importFiles(importProject, ds.getBasedir(), includes, excludes, diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java index 9f97429bf..1d70e7220 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,21 +54,51 @@ package org.apache.tools.ant.taskdefs.optional.ide; - import java.util.Vector; +import org.apache.tools.ant.BuildException; /** - * Load specific project versions into the Visual Age for Java workspace. - * Each project and version name has to be specified completely. + * Load project versions into the Visual Age for Java workspace. + * Each project is identified by its name and a version qualifier. + * Allowed qualifiers are: + *

      + *
    • Any valid Visual Age version name
    • + *
    • * (loads the latest versioned edition)
    • + *
    • ** (loads the latest edition, including open editions)
    • + *
    * Example: - *
    - * <vajload> - *  <project name="MyVAProject" version="2.1"/> - *  <project name="Apache Xerces" version="1.2.0"/> - * </vajload> + *
    + * <vajload> + *  <project name="MyVAProject" version="*"/> + *  <project name="Apache Xerces" version="1.2.0"/> + *  <project name="Brand New Stuff" version="**"/> + * </vajload> *
    * + *

    Parameters:

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    AttributeDescriptionRequired
    remoteremote tool server to run this command against + * (format: <servername> : <port no>)No
    haltonerrorstop the build process if an error occurs, + * defaults to "yes"No
    + *

    + * * @author Wolf Siberski, TUI Infotec GmbH + * @author Martin Landers, Beck et al. projects */ public class VAJLoad extends VAJTask { @@ -78,7 +108,15 @@ public class VAJLoad extends VAJTask { * Load specified projects. */ public void execute() { - getUtil().loadProjects(projectDescriptions); + try { + getUtil().loadProjects(projectDescriptions); + } catch (BuildException ex) { + if (haltOnError) { + throw ex; + } else { + log(ex.toString()); + } + } } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java index 92c81e212..337ad889b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,6 +64,7 @@ import com.ibm.ivj.util.base.ToolEnv; import com.ibm.ivj.util.base.Type; import com.ibm.ivj.util.base.Workspace; import java.io.File; +import java.util.Date; import java.util.Enumeration; import java.util.Vector; import org.apache.tools.ant.BuildException; @@ -75,6 +76,7 @@ import org.apache.tools.ant.DirectoryScanner; * wraps IvjExceptions into BuildExceptions * * @author Wolf Siberski, TUI Infotec GmbH + * @author Martin Landers, Beck et al. projects */ abstract class VAJLocalUtil implements VAJUtil{ // singleton containing the VAJ workspace @@ -194,10 +196,17 @@ abstract class VAJLocalUtil implements VAJUtil{ e.hasMoreElements();) { VAJProjectDescription d = (VAJProjectDescription) e.nextElement(); - ProjectEdition pe = findProjectEdition(d.getName(), d.getVersion()); + ProjectEdition pe; + if (d.getVersion().equals("*")) + pe = findLatestProjectEdition(d.getName(), false); + else if (d.getVersion().equals("**")) + pe = findLatestProjectEdition(d.getName(), true); + else + pe = findProjectEdition(d.getName(), d.getVersion()); try { - log("Loading '" + d.getName() + "', Version '" + d.getVersion() - + "', into Workspace", MSG_VERBOSE); + log("Loading '" + pe.getName() + "', Version '" + + ((pe.getVersionName() != null)?pe.getVersionName():"("+pe.getVersionStamp()+ ")")+ + "' into Workspace", MSG_VERBOSE); pe.loadIntoWorkspace(); } catch (IvjException ex) { throw createBuildException("Project '" + d.getName() @@ -270,6 +279,47 @@ abstract class VAJLocalUtil implements VAJUtil{ } + /** + * Finds the latest project edition in the repository. + * + * @param name project name + * @param includeOpenEditions include open/scratch editions in the search? + * @return com.ibm.ivj.util.base.ProjectEdition the specified edition + */ + private ProjectEdition findLatestProjectEdition( + String name, + boolean includeOpenEditions) { + try { + ProjectEdition[] editions = null; + editions = getWorkspace().getRepository().getProjectEditions(name); + if (editions == null) { + throw new BuildException("Project " + name + " doesn't exist"); + } + + // find latest (versioned) project edition by date + ProjectEdition pe = null; + Date latestStamp = new Date(0); // Let's hope there are no projects older than the epoch ;-) + for (int i = 0; i < editions.length; i++) { + if (!includeOpenEditions && !editions[i].isVersion()) + continue; + if (latestStamp.before(editions[i].getVersionStamp())) { + latestStamp = editions[i].getVersionStamp(); + pe = editions[i]; + } + } + + if (pe == null) { + throw new BuildException("Can't determine latest edition for project " + name); + } + log("Using version " + ((pe.getVersionName() != null)?pe.getVersionName():"("+pe.getVersionStamp()+ ")") + + " of " + pe.getName(), MSG_INFO); + return pe; + } catch (IvjException e) { + throw createBuildException("VA Exception occured: ", e); + } + + } + //----------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java index fe2820e28..9c08152aa 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +61,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; +import java.net.URLEncoder; import java.util.Enumeration; import java.util.Vector; import org.apache.tools.ant.BuildException; @@ -71,6 +72,7 @@ import org.apache.tools.ant.Task; * wraps IvjExceptions into BuildExceptions * * @author Wolf Siberski, TUI Infotec GmbH + * @author Martin Landers, Beck et al. projects */ class VAJRemoteUtil implements VAJUtil{ // calling task @@ -139,7 +141,7 @@ class VAJRemoteUtil implements VAJUtil{ boolean includeSources, boolean useDefaultExcludes) { String result = VAJToolsServlet.DIR_PARAM + "=" - + dir.getAbsolutePath().replace('\\', '/') + "&" + + URLEncoder.encode(dir.getAbsolutePath()) + "&" + VAJToolsServlet.CLASSES_PARAM + "=" + includeClasses + "&" + VAJToolsServlet.RESOURCES_PARAM + "=" + includeResources + "&" + VAJToolsServlet.SOURCES_PARAM + "=" + includeSources + "&" @@ -148,13 +150,13 @@ class VAJRemoteUtil implements VAJUtil{ if (includePatterns != null) { for (int i = 0; i < includePatterns.length; i++){ result = result + "&" + VAJExportServlet.INCLUDE_PARAM + "=" - + includePatterns[i].replace(' ', '+').replace('\\', '/'); + + URLEncoder.encode(includePatterns[i]); } } if (excludePatterns != null) { for (int i = 0; i < excludePatterns.length; i++){ result = result + "&" + VAJExportServlet.EXCLUDE_PARAM + "=" - + excludePatterns[i].replace(' ', '+').replace('\\', '/'); + + URLEncoder.encode(excludePatterns[i]); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java index 0af38ae20..c24a209f5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ package org.apache.tools.ant.taskdefs.optional.ide; * attributes (remoteServer) and util methods * * @author: Wolf Siberski + * @author: Martin Landers, Beck et al. projects */ import org.apache.tools.ant.Task; @@ -79,6 +80,8 @@ public class VAJTask extends Task { // holds the appropriate VAJUtil implementation private VAJUtil util = null; + // checks if this task throws BuildException on error + protected boolean haltOnError = true; /** * returns the VAJUtil implementation @@ -103,4 +106,15 @@ public class VAJTask extends Task { public void setRemote(String remoteServer) { this.remoteServer = remoteServer; } + + /** + * Flag to control behaviour in case of VAJ errors. + * If this attribute is set errors will be ignored + * (no BuildException will be thrown) otherwise + * VAJ errors will be wrapped into a BuildException and + * stop the build. + */ + public void setHaltonerror(boolean newHaltOnError) { + haltOnError = newHaltOnError; + } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java index 86300532a..8ee039e62 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,13 +54,11 @@ package org.apache.tools.ant.taskdefs.optional.ide; - - +import com.ibm.ivj.toolserver.servletclasses.servlet.ServletException; +import com.ibm.ivj.toolserver.servletclasses.servlet.http.HttpServlet; +import com.ibm.ivj.toolserver.servletclasses.servlet.http.HttpServletRequest; +import com.ibm.ivj.toolserver.servletclasses.servlet.http.HttpServletResponse; import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.util.StringUtils;