", 0, 0, script);
} catch (BSFException be) {
- Throwable t = be;
+ Throwable t = be;
Throwable te = be.getTargetException();
if (te != null) {
if (te instanceof BuildException) {
@@ -128,7 +127,7 @@ public class Script extends Task {
* @param msg Sets the value for the script variable.
*/
public void setLanguage(String language) {
- this.language = language;
+ this.language = language;
}
/**
@@ -151,7 +150,7 @@ public class Script extends Task {
} catch (IOException e) {
throw new BuildException(e);
}
-
+
script += new String(data);
}
@@ -161,6 +160,6 @@ public class Script extends Task {
* @param msg Sets the value for the script variable.
*/
public void addText(String text) {
- this.script += text;
+ this.script += text;
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
index 84cbe3f22..a7ca03d75 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
@@ -1,4 +1,4 @@
-/* -*-Java-*-
+/*
*******************************************************************
*
* File: Csharp.java
@@ -85,12 +85,12 @@ package org.apache.tools.ant.taskdefs.optional.dotnet;
// imports
// ====================================================================
+import java.io.*;
+import java.text.*;
+import java.util.*;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;
import org.apache.tools.ant.types.*;
-import java.io.*;
-import java.util.*;
-import java.text.*;
// ====================================================================
@@ -232,23 +232,23 @@ The first pass is just a proof of concept; enough to test.
TODO
- - get PATH incorporated into reference/module lookup
-
- is Win32Icon broken?
-
- all the missing options
+
- get PATH incorporated into reference/module lookup
+
- is Win32Icon broken?
+
- all the missing options
History
-
- 0.2 |
- Slightly different |
- Split command execution to a separate class;
- |
- 0.1 |
- "I can't believe it's so rudimentary" |
- First pass; minimal builds only support;
- |
-
-
+
+ 0.2 |
+ Slightly different |
+ Split command execution to a separate class;
+ |
+ 0.1 |
+ "I can't believe it's so rudimentary" |
+ First pass; minimal builds only support;
+ |
+
+
@version 0.2
@author Steve Loughran steve_l@iseran.com
@@ -258,7 +258,7 @@ History
public class CSharp
extends org.apache.tools.ant.taskdefs.MatchingTask {
- //=============================================================================
+ //=============================================================================
/** constructor inits everything and set up the search pattern
*/
@@ -283,7 +283,7 @@ public class CSharp
protected static final String csc_file_pattern="*."+csc_file_ext;
- //=============================================================================
+ //=============================================================================
/** list of reference classes. (pretty much a classpath equivalent)
*/
@@ -335,14 +335,14 @@ public class CSharp
//bail on no references listed
if (refpath.length()==0)
return null;
-
+
StringBuffer s=new StringBuffer("/reference:");
s.append(refpath);
return new String(s);
- }
+ }
*/
- //=============================================================================
+ //=============================================================================
/* optimise flag
*/
@@ -366,9 +366,9 @@ public class CSharp
*/
protected String getOptimizeParameter() {
return "/optimize"+(_optimize?"+":"-");
- }
-
- //=============================================================================
+ }
+
+ //=============================================================================
/** incremental build flag */
protected boolean _incremental;
@@ -390,9 +390,9 @@ public class CSharp
*/
protected String getIncrementalParameter() {
return "/incremental"+(_incremental?"+":"-");
- }
+ }
- //=============================================================================
+ //=============================================================================
/** debug flag. Controls generation of debug information.
*/
@@ -404,7 +404,7 @@ public class CSharp
public void setDebug(boolean f)
{_debug=f;}
-
+
/** query the debug flag
* @return true if debug is turned on
*/
@@ -417,15 +417,15 @@ public class CSharp
*/
protected String getDebugParameter() {
return "/debug"+(_debug?"+":"-");
- }
+ }
- //=============================================================================
+ //=============================================================================
/** output XML documentation flag
- */
-
+ */
+
protected File _docFile;
-
+
/** file for generated XML documentation
* @param output file
*/
@@ -443,9 +443,9 @@ public class CSharp
return "/doc:"+_docFile.toString();
else
return null;
- }
-
- //=============================================================================
+ }
+
+ //=============================================================================
/** warning level: 0-4, with 4 being most verbose
*/
private int _warnLevel;
@@ -466,9 +466,9 @@ public class CSharp
*/
protected String getWarnLevelParameter() {
return "/warn:"+_warnLevel;
- }
+ }
- //=============================================================================
+ //=============================================================================
/** enable unsafe code flag. Clearly set to false by default
*/
@@ -484,9 +484,9 @@ public class CSharp
*/
protected String getUnsafeParameter(){
return _unsafe?"/unsafe":null;
- }
-
- //=============================================================================
+ }
+
+ //=============================================================================
/** main class (or null for automatic choice)
*/
protected String _mainClass;
@@ -504,9 +504,9 @@ public class CSharp
return "/main:"+_mainClass;
else
return null;
- }
+ }
- //=============================================================================
+ //=============================================================================
/** source directory upon which the search pattern is applied
*/
private File _srcDir;
@@ -518,7 +518,7 @@ public class CSharp
_srcDir = project.resolveFile(srcDirName);
}
- //=============================================================================
+ //=============================================================================
/** destination directory (null means use the source directory)
*/
private File _destDir;
@@ -529,9 +529,9 @@ public class CSharp
public void setDestDir(String dirName) {
_destDir = project.resolveFile(dirName);
}
-
+
- //=============================================================================
+ //=============================================================================
/** type of target. Should be one of exe|library|module|winexe|(null)
default is exe; the actual value (if not null) is fed to the command line.
See /target
@@ -548,7 +548,7 @@ public class CSharp
targetType=targetType.toLowerCase();
if(targetType.equals("exe") || targetType.equals("library") ||
targetType.equals("module") ||targetType.equals("winexe") ) {
- _targetType=targetType;
+ _targetType=targetType;
}
else
throw new BuildException("targetType " +targetType+" is not a valid type");
@@ -556,7 +556,7 @@ public class CSharp
public String getTargetType() {
return _targetType;
- }
+ }
/** get the argument or null for no argument needed
*/
@@ -565,14 +565,14 @@ public class CSharp
return "/target:"+_targetType;
else
return null;
- }
+ }
- //=============================================================================
+ //=============================================================================
/* icon for incorporation into apps
*/
- protected File _win32icon;
+ protected File _win32icon;
/**
* Set the win32 icon
@@ -591,7 +591,7 @@ public class CSharp
return null;
}
- //=============================================================================
+ //=============================================================================
/** defines list 'RELEASE;WIN32;NO_SANITY_CHECKS;;SOMETHING_ELSE'
*
*/
@@ -614,7 +614,7 @@ public class CSharp
else return "/DEFINE:"+_definitions;
}
- //=============================================================================
+ //=============================================================================
/** list of extra modules to refer to
*
*/
@@ -637,7 +637,7 @@ public class CSharp
else return "/addmodule:"+_additionalModules;
}
- //=============================================================================
+ //=============================================================================
/** output file. If not supplied this is derived from the
* source file
*/
@@ -661,7 +661,7 @@ public class CSharp
return "/out:"+f.toString();
}
- //=============================================================================
+ //=============================================================================
/** flag to control action on execution trouble
*/
@@ -679,7 +679,7 @@ public class CSharp
return _failOnError;
}
- //=============================================================================
+ //=============================================================================
/** reset all contents.
*/
public void Clear() {
@@ -701,7 +701,7 @@ public class CSharp
}
- //=============================================================================
+ //=============================================================================
/** do the work by building the command line and then calling it
*/
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
index d17425d38..5ebdb628d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
@@ -1,11 +1,11 @@
-/* -*-Java-*-
+/*
*******************************************************************
*
* File: Csharp.java
* RCS: $Header$
* Author: Steve Loughran
* Created: July 21, 2000
-* Modified: $Modtime: 00-11-01 10:25 $
+* Modified: $Modtime: 00-11-01 10:25 $
* Language: Java
* Status: Experimental
*
@@ -85,12 +85,12 @@ package org.apache.tools.ant.taskdefs.optional.dotnet;
// imports
// ====================================================================
+import java.io.*;
+import java.text.*;
+import java.util.*;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;
import org.apache.tools.ant.types.*;
-import java.io.*;
-import java.util.*;
-import java.text.*;
/**
Task to assemble .net 'Intermediate Language' files.
@@ -213,7 +213,7 @@ import java.text.*;
public class Ilasm
extends org.apache.tools.ant.taskdefs.MatchingTask {
- //=============================================================================
+ //=============================================================================
/** constructor inits everything and set up the search pattern
*/
@@ -241,7 +241,7 @@ public class Ilasm
*/
protected static final String exe_title="ilasm";
- //=============================================================================
+ //=============================================================================
/** reset all contents.
*/
public void Clear() {
@@ -257,7 +257,7 @@ public class Ilasm
_owner=null;
}
- //=============================================================================
+ //=============================================================================
/** source directory upon which the search pattern is applied
*/
private File _srcDir;
@@ -270,7 +270,7 @@ public class Ilasm
}
- //=============================================================================
+ //=============================================================================
/** type of target. Should be one of exe|library|module|winexe|(null)
default is exe; the actual value (if not null) is fed to the command line.
See /target
@@ -286,7 +286,7 @@ public class Ilasm
throws BuildException {
targetType=targetType.toLowerCase();
if(targetType.equals("exe") || targetType.equals("library")) {
- _targetType=targetType;
+ _targetType=targetType;
}
else
throw new BuildException("targetType " +targetType+" is not a valid type");
@@ -294,7 +294,7 @@ public class Ilasm
public String getTargetType() {
return _targetType;
- }
+ }
/** get the argument or null for no argument needed
*/
@@ -309,9 +309,9 @@ public class Ilasm
return "/dll";
else
return null;
- }
-
- //=============================================================================
+ }
+
+ //=============================================================================
/** owner string is a slightly trivial barrier to disassembly
*/
@@ -328,7 +328,7 @@ public class Ilasm
return null;
}
- //=============================================================================
+ //=============================================================================
/** test for a string containing something useful
* @param string to test
* @returns true if the argument is not null or empty
@@ -336,7 +336,7 @@ public class Ilasm
protected boolean notEmpty(String s)
{return s!=null && s.length()!=0;}
- //=============================================================================
+ //=============================================================================
/** verbose flag
*/
@@ -350,7 +350,7 @@ public class Ilasm
return _verbose?null:"/quiet";
}
- //=============================================================================
+ //=============================================================================
/** listing flag
*/
@@ -364,7 +364,7 @@ public class Ilasm
return _listing?"/listing":"/nolisting";
}
- //=============================================================================
+ //=============================================================================
/** output file. If not supplied this is derived from the
* source file
*/
@@ -388,7 +388,7 @@ public class Ilasm
return "/output="+f.toString();
}
- //=============================================================================
+ //=============================================================================
/** resource file (.res format) to include in the app.
*/
@@ -406,7 +406,7 @@ public class Ilasm
return null;
}
- //=============================================================================
+ //=============================================================================
/** flag to control action on execution trouble
*/
@@ -424,7 +424,7 @@ public class Ilasm
return _failOnError;
}
- //=============================================================================
+ //=============================================================================
/** debug flag. Controls generation of debug information.
*/
@@ -436,7 +436,7 @@ public class Ilasm
public void setDebug(boolean f)
{_debug=f;}
-
+
/** query the debug flag
* @return true if debug is turned on
*/
@@ -449,9 +449,9 @@ public class Ilasm
*/
protected String getDebugParameter() {
return _debug?"/debug":null;
- }
+ }
- //=============================================================================
+ //=============================================================================
/** This is the execution entry point. Build a list of files and
* call ilasm on each of them.
*/
@@ -475,7 +475,7 @@ public class Ilasm
} // end execute
- //=============================================================================
+ //=============================================================================
/** do the work by building the command line and then calling it
*/
@@ -504,7 +504,4 @@ public class Ilasm
//now run the command of exe + settings + file
command.runCommand();
} // end executeOneFile
-
-
-
} //class
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
index 1a8464acb..3c50226e5 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
@@ -1,4 +1,4 @@
-/* -*-Java-*-
+/*
*******************************************************************
*
* File: CSharp.java
@@ -78,12 +78,12 @@ package org.apache.tools.ant.taskdefs.optional.dotnet;
// imports
+import java.io.*;
+import java.text.*;
+import java.util.*;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;
import org.apache.tools.ant.types.*;
-import java.io.*;
-import java.util.*;
-import java.text.*;
@@ -232,6 +232,4 @@ public class NetCommand {
throw new BuildException(_title+" failed: " + e, e, _owner.getLocation());
}
}
-
-
} //class
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
index 4d6a97477..72356b828 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
@@ -51,7 +51,6 @@
* information on the Apache Software Foundation, please see
* .
*/
-
package org.apache.tools.ant.taskdefs.optional.ejb;
import java.io.*;
@@ -345,9 +344,9 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
// now the vendor specific files, if any
addVendorFiles(ejbFiles, baseName);
-
- // add any inherited files
- checkAndAddInherited(ejbFiles);
+
+ // add any inherited files
+ checkAndAddInherited(ejbFiles);
// Lastly create File object for the Jar files. If we are using
// a flat destination dir, then we need to redefine baseName!
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java
index 921476033..c0a959c95 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java
@@ -1,23 +1,76 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
package org.apache.tools.ant.taskdefs.optional.ejb;
import java.io.*;
public class InnerClassFilenameFilter implements FilenameFilter {
- private String baseClassName;
+ private String baseClassName;
- InnerClassFilenameFilter(String baseclass){
- int extidx = baseclass.lastIndexOf(".class");
- if (extidx == -1) {
- extidx = baseclass.length()-1;
- }
- baseClassName = baseclass.substring(0,extidx);
- }
+ InnerClassFilenameFilter(String baseclass){
+ int extidx = baseclass.lastIndexOf(".class");
+ if (extidx == -1) {
+ extidx = baseclass.length()-1;
+ }
+ baseClassName = baseclass.substring(0,extidx);
+ }
- public boolean accept (File Dir, String filename){
- if ((filename.lastIndexOf(".") != filename.lastIndexOf(".class"))
- || (filename.indexOf(baseClassName + "$") != 0)) {
- return false;
- }
- return true;
- }
+ public boolean accept (File Dir, String filename){
+ if ((filename.lastIndexOf(".") != filename.lastIndexOf(".class"))
+ || (filename.indexOf(baseClassName + "$") != 0)) {
+ return false;
+ }
+ return true;
+ }
}
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 a3fb93baf..54169c583 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
@@ -54,18 +54,18 @@ package org.apache.tools.ant.taskdefs.optional.ide;
* .
*/
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.PatternSet;
+
import com.ibm.ivj.util.base.ExportCodeSpec;
import com.ibm.ivj.util.base.IvjException;
import com.ibm.ivj.util.base.Package;
-
import java.io.File;
-import java.util.Vector;
import java.util.Enumeration;
+import java.util.Vector;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.PatternSet;
/**
* Export packages from the Visual Age for Java workspace.
@@ -96,145 +96,145 @@ import java.util.Enumeration;
*/
public class VAJExport extends Task {
- protected File destDir;
- protected boolean exportSources = true;
- protected boolean exportResources = true;
- protected boolean exportClasses = false;
- protected boolean exportDebugInfo = false;
- protected boolean useDefaultExcludes = true;
-
- protected PatternSet patternSet = new PatternSet();
-
- /**
- * add a name entry on the exclude list
- */
- public PatternSet.NameEntry createExclude() {
- return patternSet.createExclude();
- }
-
- /**
- * add a name entry on the include list
- */
- public PatternSet.NameEntry createInclude() {
- return patternSet.createInclude();
- }
-
- /**
- * do the export
- */
- public void execute() throws BuildException {
- // first off, make sure that we've got a destdir
- if (destDir == null) {
- throw new BuildException("destdir attribute must be set!");
- }
-
- VAJWorkspaceScanner ds = this.getWorkspaceScanner();
-
- Package[] packages = ds.getIncludedPackages();
-
- export(packages);
- }
-
- /**
- * export the array of Packages
- */
- public void export(Package[] packages) {
- try {
- String dest = destDir.getAbsolutePath();
-
- log("Exporting " + packages.length + " package(s) to " + dest);
- for (int i = 0; i < packages.length; i++) {
- log(" " + packages[i].getName(), Project.MSG_VERBOSE);
- }
-
- ExportCodeSpec exportSpec = new ExportCodeSpec();
-
- exportSpec.setPackages(packages);
- exportSpec.includeJava(exportSources);
- exportSpec.includeClass(exportClasses);
- exportSpec.includeResources(exportResources);
- exportSpec.includeClassDebugInfo(exportDebugInfo);
- exportSpec.useSubdirectories(true);
- exportSpec.overwriteFiles(true);
- exportSpec.setExportDirectory(dest);
- VAJUtil.getWorkspace().exportData(exportSpec);
- } catch (IvjException ex) {
- throw VAJUtil.createBuildException("Exporting failed!", ex);
- }
- }
-
- /**
- * Returns the directory scanner needed to access the files to process.
- */
- protected VAJWorkspaceScanner getWorkspaceScanner() {
- VAJWorkspaceScanner scanner = new VAJWorkspaceScanner();
- scanner.setIncludes(patternSet.getIncludePatterns(getProject()));
- scanner.setExcludes(patternSet.getExcludePatterns(getProject()));
- if (useDefaultExcludes)
- scanner.addDefaultExcludes();
- scanner.scan();
- return scanner;
- }
-
- /**
- * Sets whether default exclusions should be used or not.
- *
- * @param useDefaultExcludes "true"|"on"|"yes" when default exclusions
- * should be used, "false"|"off"|"no" when they
- * shouldn't be used.
- */
- public void setDefaultexcludes(boolean useDefaultExcludes) {
- this.useDefaultExcludes = useDefaultExcludes;
- }
-
- /**
- * Set the destination directory into which the Java source
- * files should be compiled.
- */
- public void setDestdir(File destDir) {
- this.destDir = destDir;
- }
-
- /**
- * Sets the set of exclude patterns. Patterns may be separated by a comma
- * or a space.
- *
- * @param excludes the string containing the exclude patterns
- */
- public void setExcludes(String excludes) {
- patternSet.setExcludes(excludes);
- }
-
- /**
- */
- public void setExportClasses(boolean doExport) {
- exportClasses = doExport;
- }
-
- /**
- */
- public void setExportDebugInfo(boolean doExport) {
- exportDebugInfo = doExport;
- }
-
- /**
- */
- public void setExportResources(boolean doExport) {
- exportResources = doExport;
- }
-
- /**
- */
- public void setExportSources(boolean doExport) {
- exportSources = doExport;
- }
- /**
- * Sets the set of include patterns. Patterns may be separated by a comma
- * or a space.
- *
- * @param includes the string containing the include patterns
- */
- public void setIncludes(String includes) {
- patternSet.setIncludes(includes);
- }
-}
\ No newline at end of file
+ protected File destDir;
+ protected boolean exportSources = true;
+ protected boolean exportResources = true;
+ protected boolean exportClasses = false;
+ protected boolean exportDebugInfo = false;
+ protected boolean useDefaultExcludes = true;
+
+ protected PatternSet patternSet = new PatternSet();
+
+ /**
+ * add a name entry on the exclude list
+ */
+ public PatternSet.NameEntry createExclude() {
+ return patternSet.createExclude();
+ }
+
+ /**
+ * add a name entry on the include list
+ */
+ public PatternSet.NameEntry createInclude() {
+ return patternSet.createInclude();
+ }
+
+ /**
+ * do the export
+ */
+ public void execute() throws BuildException {
+ // first off, make sure that we've got a destdir
+ if (destDir == null) {
+ throw new BuildException("destdir attribute must be set!");
+ }
+
+ VAJWorkspaceScanner ds = this.getWorkspaceScanner();
+
+ Package[] packages = ds.getIncludedPackages();
+
+ export(packages);
+ }
+
+ /**
+ * export the array of Packages
+ */
+ public void export(Package[] packages) {
+ try {
+ String dest = destDir.getAbsolutePath();
+
+ log("Exporting " + packages.length + " package(s) to " + dest);
+ for (int i = 0; i < packages.length; i++) {
+ log(" " + packages[i].getName(), Project.MSG_VERBOSE);
+ }
+
+ ExportCodeSpec exportSpec = new ExportCodeSpec();
+
+ exportSpec.setPackages(packages);
+ exportSpec.includeJava(exportSources);
+ exportSpec.includeClass(exportClasses);
+ exportSpec.includeResources(exportResources);
+ exportSpec.includeClassDebugInfo(exportDebugInfo);
+ exportSpec.useSubdirectories(true);
+ exportSpec.overwriteFiles(true);
+ exportSpec.setExportDirectory(dest);
+ VAJUtil.getWorkspace().exportData(exportSpec);
+ } catch (IvjException ex) {
+ throw VAJUtil.createBuildException("Exporting failed!", ex);
+ }
+ }
+
+ /**
+ * Returns the directory scanner needed to access the files to process.
+ */
+ protected VAJWorkspaceScanner getWorkspaceScanner() {
+ VAJWorkspaceScanner scanner = new VAJWorkspaceScanner();
+ scanner.setIncludes(patternSet.getIncludePatterns(getProject()));
+ scanner.setExcludes(patternSet.getExcludePatterns(getProject()));
+ if (useDefaultExcludes)
+ scanner.addDefaultExcludes();
+ scanner.scan();
+ return scanner;
+ }
+
+ /**
+ * Sets whether default exclusions should be used or not.
+ *
+ * @param useDefaultExcludes "true"|"on"|"yes" when default exclusions
+ * should be used, "false"|"off"|"no" when they
+ * shouldn't be used.
+ */
+ public void setDefaultexcludes(boolean useDefaultExcludes) {
+ this.useDefaultExcludes = useDefaultExcludes;
+ }
+
+ /**
+ * Set the destination directory into which the Java source
+ * files should be compiled.
+ */
+ public void setDestdir(File destDir) {
+ this.destDir = destDir;
+ }
+
+ /**
+ * Sets the set of exclude patterns. Patterns may be separated by a comma
+ * or a space.
+ *
+ * @param excludes the string containing the exclude patterns
+ */
+ public void setExcludes(String excludes) {
+ patternSet.setExcludes(excludes);
+ }
+
+ /**
+ */
+ public void setExportClasses(boolean doExport) {
+ exportClasses = doExport;
+ }
+
+ /**
+ */
+ public void setExportDebugInfo(boolean doExport) {
+ exportDebugInfo = doExport;
+ }
+
+ /**
+ */
+ public void setExportResources(boolean doExport) {
+ exportResources = doExport;
+ }
+
+ /**
+ */
+ public void setExportSources(boolean doExport) {
+ exportSources = doExport;
+ }
+ /**
+ * Sets the set of include patterns. Patterns may be separated by a comma
+ * or a space.
+ *
+ * @param includes the string containing the include patterns
+ */
+ public void setIncludes(String includes) {
+ patternSet.setIncludes(includes);
+ }
+}
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 b3edb3612..c9a9364a4 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
@@ -54,20 +54,20 @@ package org.apache.tools.ant.taskdefs.optional.ide;
* .
*/
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.types.FileSet;
+
import com.ibm.ivj.util.base.ImportCodeSpec;
import com.ibm.ivj.util.base.IvjException;
import com.ibm.ivj.util.base.Project;
import com.ibm.ivj.util.base.ProjectEdition;
import com.ibm.ivj.util.base.Type;
-
import java.io.File;
-import java.util.Vector;
import java.util.Enumeration;
+import java.util.Vector;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
/**
* Import source, class files, and resources to the Visual Age for Java
@@ -123,218 +123,220 @@ import java.util.Enumeration;
* @author: Glenn McAllister, inspired by a similar task written by Peter Kelley
*/
public class VAJImport extends Task {
- protected Vector filesets = new Vector();
- protected boolean importSources = true;
- protected boolean importResources = true;
- protected boolean importClasses = false;
- protected String importProject = null;
- protected Project vajproject = null;
+ protected Vector filesets = new Vector();
+ protected boolean importSources = true;
+ protected boolean importResources = true;
+ protected boolean importClasses = false;
+ protected String importProject = null;
+ protected Project vajproject = null;
+
+ /**
+ * The VisualAge for Java Project name to import into.
+ */
+ public void setProject(String projectName) {
+ this.importProject = projectName;
+ }
- /**
- * The VisualAge for Java Project name to import into.
- */
- public void setProject(String projectName) {
- this.importProject = projectName;
- }
+ /**
+ * Adds a set of files (nested fileset attribute).
+ */
+ public void addFileset(FileSet set) {
+ filesets.addElement(set);
+ }
- /**
- * Adds a set of files (nested fileset attribute).
- */
- public void addFileset(FileSet set) {
- filesets.addElement(set);
- }
+ /**
+ * Import .class files.
+ */
+ public void setImportClasses(boolean importClasses) {
+ this.importClasses = importClasses;
+ }
- /**
- * Import .class files.
- */
- public void setImportClasses(boolean importClasses) {
- this.importClasses = importClasses;
- }
+ /**
+ * Import resource files (anything that doesn't end in
+ * .class or .java)
+ */
+ public void setImportResources(boolean importResources) {
+ this.importResources = importResources;
+ }
- /**
- * Import resource files (anything that doesn't end in
- * .class or .java)
- */
- public void setImportResources(boolean importResources) {
- this.importResources = importResources;
- }
+ /**
+ * Import .java files
+ */
+ public void setImportSources(boolean importSources) {
+ this.importSources = importSources;
+ }
- /**
- * Import .java files
- */
- public void setImportSources(boolean importSources) {
- this.importSources = importSources;
- }
+ /**
+ * Do the import.
+ */
+ public void execute() throws BuildException {
+ if (filesets.size() == 0) {
+ throw new BuildException("At least one fileset is required!");
+ }
- /**
- * Do the import.
- */
- public void execute() throws BuildException {
- if (filesets.size() == 0) {
- throw new BuildException("At least one fileset is required!");
- }
+ if (importProject == null || "".equals(importProject)) {
+ throw new BuildException("The VisualAge for Java Project name is required!");
+ }
- if (importProject == null || "".equals(importProject)) {
- throw new BuildException("The VisualAge for Java Project name is required!");
- }
+ vajproject = getVAJProject();
+ if (vajproject == null) {
+ try {
+ vajproject = VAJUtil.getWorkspace().createProject(this.importProject, true);
+ } catch (IvjException e) {
+ throw VAJUtil.createBuildException( "Error while creating Project " +
+ importProject + ": ",
+ e );
+ }
+ }
- vajproject = getVAJProject();
- if (vajproject == null) {
- try {
- vajproject = VAJUtil.getWorkspace().createProject(this.importProject, true);
- } catch (IvjException e) {
- throw VAJUtil.createBuildException(
- "Error while creating Project " + importProject + ": ",
- e);
- }
- }
+ for (Enumeration e = filesets.elements(); e.hasMoreElements();) {
+ importFileset((FileSet) e.nextElement());
+ }
+ }
- for (Enumeration e = filesets.elements(); e.hasMoreElements();) {
- importFileset((FileSet) e.nextElement());
- }
- }
+ /**
+ * Try to get the project we want from the Workspace.
+ */
+ protected Project getVAJProject() {
+ Project found = null;
+ Project[] currentProjects = VAJUtil.getWorkspace().getProjects();
- /**
- * Try to get the project we want from the Workspace.
- */
- protected Project getVAJProject() {
- Project found = null;
- Project[] currentProjects = VAJUtil.getWorkspace().getProjects();
+ for (int i = 0; i < currentProjects.length; i++) {
+ Project p = currentProjects[i];
+ if (p.getName().equals(this.importProject)) {
+ found = p;
+ break;
+ }
+ }
- for (int i = 0; i < currentProjects.length; i++) {
- Project p = currentProjects[i];
- if (p.getName().equals(this.importProject)) {
- found = p;
- break;
- }
- }
+ return found;
+ }
- return found;
- }
+ /**
+ * Import all files from the fileset into the Project in the
+ * Workspace.
+ */
+ protected void importFileset(FileSet fileset) {
+ DirectoryScanner ds = fileset.getDirectoryScanner(this.project);
+ if (ds.getIncludedFiles().length == 0) {
+ return;
+ }
- /**
- * Import all files from the fileset into the Project in the
- * Workspace.
- */
- protected void importFileset(FileSet fileset) {
- DirectoryScanner ds = fileset.getDirectoryScanner(this.project);
- if (ds.getIncludedFiles().length == 0) {
- return;
- }
+ Vector classes = new Vector();
+ Vector sources = new Vector();
+ Vector resources = new Vector();
- Vector classes = new Vector();
- Vector sources = new Vector();
- Vector resources = new Vector();
+ String[] classesArr = null;
+ String[] sourcesArr = null;
+ String[] resourcesArr = null;
- String[] classesArr = null;
- String[] sourcesArr = null;
- String[] resourcesArr = null;
+ StringBuffer msg = new StringBuffer();
+ msg.append("Importing ");
+ String connector = "";
- StringBuffer msg = new StringBuffer();
- msg.append("Importing ");
- String connector = "";
+ ImportCodeSpec importSpec = new ImportCodeSpec();
+ importSpec.setDefaultProject(vajproject);
- ImportCodeSpec importSpec = new ImportCodeSpec();
- importSpec.setDefaultProject(vajproject);
+ scan(
+ fileset.getDir(this.project),
+ ds.getIncludedFiles(),
+ classes,
+ sources,
+ resources);
- scan(
- fileset.getDir(this.project),
- ds.getIncludedFiles(),
- classes,
- sources,
- resources);
+ if (importClasses) {
+ classesArr = new String[classes.size()];
+ classes.copyInto(classesArr);
+ importSpec.setClassFiles(classesArr);
+ if (classesArr.length > 0) {
+ logFiles(classes, "class");
+ msg.append( classesArr.length );
+ msg.append( " class " );
+ msg.append( classesArr.length > 1 ? "files" : "file" );
+ connector = ", ";
+ }
+ }
- if (importClasses) {
- classesArr = new String[classes.size()];
- classes.copyInto(classesArr);
- importSpec.setClassFiles(classesArr);
- if (classesArr.length > 0) {
- logFiles(classes, "class");
- msg.append( classesArr.length );
- msg.append( " class " );
- msg.append( classesArr.length > 1 ? "files" : "file" );
- connector = ", ";
- }
- }
+ if (importSources) {
+ sourcesArr = new String[sources.size()];
+ sources.copyInto(sourcesArr);
+ importSpec.setJavaFiles(sourcesArr);
+ if (sourcesArr.length > 0) {
+ logFiles(sources, "source");
+ msg.append( connector );
+ msg.append( sourcesArr.length );
+ msg.append( " source " );
+ msg.append( sourcesArr.length > 1 ? "files" : "file" );
+ connector = ", ";
+ }
+ }
- if (importSources) {
- sourcesArr = new String[sources.size()];
- sources.copyInto(sourcesArr);
- importSpec.setJavaFiles(sourcesArr);
- if (sourcesArr.length > 0) {
- logFiles(sources, "source");
- msg.append( connector );
- msg.append( sourcesArr.length );
- msg.append( " source " );
- msg.append( sourcesArr.length > 1 ? "files" : "file" );
- connector = ", ";
- }
- }
+ if (importResources) {
+ String resourcePath = fileset.getDir(this.project).getAbsolutePath();
+ resourcesArr = new String[resources.size()];
+ resources.copyInto(resourcesArr);
+ importSpec.setResourcePath(resourcePath);
+ importSpec.setResourceFiles(resourcesArr);
+ if (resourcesArr.length > 0) {
+ logFiles(resources, "resource");
+ log( " (relative to resource path '" + resourcePath + "')",
+ org.apache.tools.ant.Project.MSG_VERBOSE );
- if (importResources) {
- String resourcePath = fileset.getDir(this.project).getAbsolutePath();
- resourcesArr = new String[resources.size()];
- resources.copyInto(resourcesArr);
- importSpec.setResourcePath(resourcePath);
- importSpec.setResourceFiles(resourcesArr);
- if (resourcesArr.length > 0) {
- logFiles(resources, "resource");
- log( " (relative to resource path '" + resourcePath + "')", org.apache.tools.ant.Project.MSG_VERBOSE );
- msg.append( connector );
- msg.append( resourcesArr.length );
- msg.append( " resource " );
- msg.append( resourcesArr.length > 1 ? "files" : "file" );
- }
- }
+ msg.append( connector );
+ msg.append( resourcesArr.length );
+ msg.append( " resource " );
+ msg.append( resourcesArr.length > 1 ? "files" : "file" );
+ }
+ }
- msg.append( " into the " );
- msg.append( importProject );
- msg.append( " project." );
+ msg.append( " into the " );
+ msg.append( importProject );
+ msg.append( " project." );
- log(msg.toString());
-
- try {
- Type[] importedTypes = VAJUtil.getWorkspace().importData(importSpec);
- if (importedTypes == null) {
- throw new BuildException("Unable to import into Workspace!");
- }
- } catch (IvjException ivje) {
- VAJUtil.createBuildException("Error while importing into Workspace: ", ivje);
- }
- }
+ log(msg.toString());
+
+ try {
+ Type[] importedTypes = VAJUtil.getWorkspace().importData(importSpec);
+ if (importedTypes == null) {
+ throw new BuildException("Unable to import into Workspace!");
+ }
+ } catch (IvjException ivje) {
+ VAJUtil.createBuildException("Error while importing into Workspace: ", ivje);
+ }
+ }
- /**
- * Sort the files into classes, sources, and resources.
- */
- protected void scan(
- File dir,
- String[] files,
- Vector classes,
- Vector sources,
- Vector resources) {
- for (int i = 0; i < files.length; i++) {
- String file = (new File(dir, files[i])).getAbsolutePath();
- if (file.endsWith(".java") || file.endsWith(".JAVA")) {
- sources.addElement(file);
- } else
- if (file.endsWith(".class") || file.endsWith(".CLASS")) {
- classes.addElement(file);
- } else {
- // for resources VA expects the path relative to the resource path
- resources.addElement(files[i]);
- }
- }
- }
-
- /**
- * Logs a list of file names to the message log
- * @param fileNames java.util.Vector file names to be logged
- * @param type java.lang.String file type
- */
- protected void logFiles(Vector fileNames, String fileType) {
- log( fileType + " files found for import:", org.apache.tools.ant.Project.MSG_VERBOSE);
- for ( Enumeration e = fileNames.elements(); e.hasMoreElements(); ) {
- log( " " + e.nextElement(), org.apache.tools.ant.Project.MSG_VERBOSE );
- }
- }
-}
\ No newline at end of file
+ /**
+ * Sort the files into classes, sources, and resources.
+ */
+ protected void scan(
+ File dir,
+ String[] files,
+ Vector classes,
+ Vector sources,
+ Vector resources) {
+ for (int i = 0; i < files.length; i++) {
+ String file = (new File(dir, files[i])).getAbsolutePath();
+ if (file.endsWith(".java") || file.endsWith(".JAVA")) {
+ sources.addElement(file);
+ } else
+ if (file.endsWith(".class") || file.endsWith(".CLASS")) {
+ classes.addElement(file);
+ } else {
+ // for resources VA expects the path relative to the resource path
+ resources.addElement(files[i]);
+ }
+ }
+ }
+
+ /**
+ * Logs a list of file names to the message log
+ * @param fileNames java.util.Vector file names to be logged
+ * @param type java.lang.String file type
+ */
+ protected void logFiles(Vector fileNames, String fileType) {
+ log( fileType + " files found for import:", org.apache.tools.ant.Project.MSG_VERBOSE);
+ for ( Enumeration e = fileNames.elements(); e.hasMoreElements(); ) {
+ log( " " + e.nextElement(), org.apache.tools.ant.Project.MSG_VERBOSE );
+ }
+ }
+}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java
index c8cf03402..4f33480b1 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java
@@ -54,15 +54,15 @@ package org.apache.tools.ant.taskdefs.optional.ide;
* .
*/
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
+
import com.ibm.ivj.util.base.IvjException;
import com.ibm.ivj.util.base.ProjectEdition;
-
-import java.util.Vector;
import java.util.Enumeration;
+import java.util.Vector;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
/**
* Load specific project versions into the Visual Age for Java workspace.
@@ -79,175 +79,175 @@ import java.util.Enumeration;
*/
public class VAJLoadProjects extends Task {
- Vector projectDescriptions = new Vector();
- Vector expandedProjectDescriptions = new Vector();
-
- /**
- * Class to maintain VisualAge for Java Workspace Project descriptions.
- */
- public class VAJProjectDescription {
- private String name;
- private String version;
- private boolean projectFound;
-
- public VAJProjectDescription() {
- }
-
- public VAJProjectDescription(String n, String v) {
- name = n;
- version = v;
- }
-
- public String getName() {
- return name;
- }
-
- public String getVersion() {
- return version;
- }
-
- public boolean projectFound() {
- return projectFound;
- }
-
- public void setName(String newName) {
- if (newName == null || newName.equals("")) {
- throw new BuildException("name attribute must be set");
- }
- name = newName;
- }
-
- public void setVersion(String newVersion) {
- if (newVersion == null || newVersion.equals("")) {
- throw new BuildException("version attribute must be set");
- }
- version = newVersion;
- }
-
- public void setProjectFound() {
- projectFound = true;
- }
- }
+ Vector projectDescriptions = new Vector();
+ Vector expandedProjectDescriptions = new Vector();
+
+ /**
+ * Class to maintain VisualAge for Java Workspace Project descriptions.
+ */
+ public class VAJProjectDescription {
+ private String name;
+ private String version;
+ private boolean projectFound;
+
+ public VAJProjectDescription() {
+ }
+
+ public VAJProjectDescription(String n, String v) {
+ name = n;
+ version = v;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public boolean projectFound() {
+ return projectFound;
+ }
+
+ public void setName(String newName) {
+ if (newName == null || newName.equals("")) {
+ throw new BuildException("name attribute must be set");
+ }
+ name = newName;
+ }
+
+ public void setVersion(String newVersion) {
+ if (newVersion == null || newVersion.equals("")) {
+ throw new BuildException("version attribute must be set");
+ }
+ version = newVersion;
+ }
+
+ public void setProjectFound() {
+ projectFound = true;
+ }
+ }
- /**
- * Add a project description entry on the project list.
- */
- public VAJProjectDescription createProject() {
- VAJProjectDescription d = new VAJProjectDescription();
- projectDescriptions.addElement(d);
- return d;
- }
- /**
- * Load specified projects.
- */
- public void execute() {
- expandDescriptions();
- log(
- "Loading " + expandedProjectDescriptions.size() + " project(s) into workspace");
- for (Enumeration e = expandedProjectDescriptions.elements();
- e.hasMoreElements();
- ) {
- VAJProjectDescription d = (VAJProjectDescription) e.nextElement();
-
- ProjectEdition pe = findProjectEdition(d.getName(), d.getVersion());
- try {
- log(
- "Loading " + d.getName() + ", Version " + d.getVersion() + ", into Workspace",
- Project.MSG_VERBOSE);
- pe.loadIntoWorkspace();
- } catch (IvjException ex) {
- throw VAJUtil.createBuildException(
- "Project " + d.getName() + " could not be loaded.",
- ex);
- }
- }
- }
-
- /**
- */
- public void expandDescriptions() {
- String[] projectNames;
- try {
- projectNames = VAJUtil.getWorkspace().getRepository().getProjectNames();
- } catch (IvjException e) {
- throw VAJUtil.createBuildException("VA Exception occured: ", e);
- }
-
- for (int i = 0; i < projectNames.length; i++) {
- for (Enumeration e = projectDescriptions.elements(); e.hasMoreElements();) {
- VAJProjectDescription d = (VAJProjectDescription) e.nextElement();
- String pattern = d.getName();
- if (VAJWorkspaceScanner.match(pattern, projectNames[i])) {
- d.setProjectFound();
- expandedProjectDescriptions.addElement(
- new VAJProjectDescription(projectNames[i], d.getVersion()));
- break;
- }
- }
- }
-
- for (Enumeration e = projectDescriptions.elements(); e.hasMoreElements();) {
- VAJProjectDescription d = (VAJProjectDescription) e.nextElement();
- if (!d.projectFound()) {
- log("No Projects match the name " + d.getName(), Project.MSG_WARN);
- }
- }
- }
-
- /**
- */
- public static Vector findMatchingProjects(String pattern) {
- String[] projectNames;
- try {
- projectNames = VAJUtil.getWorkspace().getRepository().getProjectNames();
- } catch (IvjException e) {
- throw VAJUtil.createBuildException("VA Exception occured: ", e);
- }
-
- Vector matchingProjects = new Vector();
- for (int i = 0; i < projectNames.length; i++) {
- if (VAJWorkspaceScanner.match(pattern, projectNames[i])) {
- matchingProjects.addElement(projectNames[i]);
- }
- }
-
- return matchingProjects;
- }
-
- /**
- * Finds a specific project edition in the repository.
- *
- * @param name project name
- * @param versionName project version name
- * @return com.ibm.ivj.util.base.ProjectEdition
- */
- public static ProjectEdition findProjectEdition(
- String name,
- String versionName) {
- try {
- ProjectEdition[] editions = null;
- editions = VAJUtil.getWorkspace().getRepository().getProjectEditions(name);
-
- if (editions == null) {
- throw new BuildException("Project " + name + " doesn't exist");
- }
-
- ProjectEdition pe = null;
-
- for (int i = 0; i < editions.length && pe == null; i++) {
- if (versionName.equals(editions[i].getVersionName())) {
- pe = editions[i];
- }
- }
- if (pe == null) {
- throw new BuildException(
- "Version " + versionName + " of Project " + name + " doesn't exist");
- }
- return pe;
-
- } catch (IvjException e) {
- throw VAJUtil.createBuildException("VA Exception occured: ", e);
- }
-
- }
-}
\ No newline at end of file
+ /**
+ * Add a project description entry on the project list.
+ */
+ public VAJProjectDescription createProject() {
+ VAJProjectDescription d = new VAJProjectDescription();
+ projectDescriptions.addElement(d);
+ return d;
+ }
+ /**
+ * Load specified projects.
+ */
+ public void execute() {
+ expandDescriptions();
+ log(
+ "Loading " + expandedProjectDescriptions.size() + " project(s) into workspace");
+ for (Enumeration e = expandedProjectDescriptions.elements();
+ e.hasMoreElements();
+ ) {
+ VAJProjectDescription d = (VAJProjectDescription) e.nextElement();
+
+ ProjectEdition pe = findProjectEdition(d.getName(), d.getVersion());
+ try {
+ log( "Loading " + d.getName() + ", Version " + d.getVersion() +
+ ", into Workspace",
+ Project.MSG_VERBOSE );
+ pe.loadIntoWorkspace();
+ } catch (IvjException ex) {
+ throw VAJUtil.createBuildException( "Project " + d.getName() +
+ " could not be loaded.",
+ ex );
+ }
+ }
+ }
+
+ /**
+ */
+ public void expandDescriptions() {
+ String[] projectNames;
+ try {
+ projectNames = VAJUtil.getWorkspace().getRepository().getProjectNames();
+ } catch (IvjException e) {
+ throw VAJUtil.createBuildException("VA Exception occured: ", e);
+ }
+
+ for (int i = 0; i < projectNames.length; i++) {
+ for (Enumeration e = projectDescriptions.elements(); e.hasMoreElements();) {
+ VAJProjectDescription d = (VAJProjectDescription) e.nextElement();
+ String pattern = d.getName();
+ if (VAJWorkspaceScanner.match(pattern, projectNames[i])) {
+ d.setProjectFound();
+ expandedProjectDescriptions.
+ addElement(new VAJProjectDescription(projectNames[i], d.getVersion()));
+ break;
+ }
+ }
+ }
+
+ for (Enumeration e = projectDescriptions.elements(); e.hasMoreElements();) {
+ VAJProjectDescription d = (VAJProjectDescription) e.nextElement();
+ if (!d.projectFound()) {
+ log("No Projects match the name " + d.getName(), Project.MSG_WARN);
+ }
+ }
+ }
+
+ /**
+ */
+ public static Vector findMatchingProjects(String pattern) {
+ String[] projectNames;
+ try {
+ projectNames = VAJUtil.getWorkspace().getRepository().getProjectNames();
+ } catch (IvjException e) {
+ throw VAJUtil.createBuildException("VA Exception occured: ", e);
+ }
+
+ Vector matchingProjects = new Vector();
+ for (int i = 0; i < projectNames.length; i++) {
+ if (VAJWorkspaceScanner.match(pattern, projectNames[i])) {
+ matchingProjects.addElement(projectNames[i]);
+ }
+ }
+
+ return matchingProjects;
+ }
+
+ /**
+ * Finds a specific project edition in the repository.
+ *
+ * @param name project name
+ * @param versionName project version name
+ * @return com.ibm.ivj.util.base.ProjectEdition
+ */
+ public static ProjectEdition findProjectEdition(
+ String name,
+ String versionName) {
+ try {
+ ProjectEdition[] editions = null;
+ editions = VAJUtil.getWorkspace().getRepository().getProjectEditions(name);
+
+ if (editions == null) {
+ throw new BuildException("Project " + name + " doesn't exist");
+ }
+
+ ProjectEdition pe = null;
+
+ for (int i = 0; i < editions.length && pe == null; i++) {
+ if (versionName.equals(editions[i].getVersionName())) {
+ pe = editions[i];
+ }
+ }
+ if (pe == null) {
+ throw new BuildException( "Version " + versionName + " of Project " +
+ name + " doesn't exist" );
+ }
+ return pe;
+
+ } catch (IvjException e) {
+ throw VAJUtil.createBuildException("VA Exception occured: ", e);
+ }
+
+ }
+}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java
index 10852dc9f..2f09d3902 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java
@@ -54,9 +54,9 @@ package org.apache.tools.ant.taskdefs.optional.ide;
* .
*/
-import com.ibm.ivj.util.base.Workspace;
-import com.ibm.ivj.util.base.ToolEnv;
import com.ibm.ivj.util.base.IvjException;
+import com.ibm.ivj.util.base.ToolEnv;
+import com.ibm.ivj.util.base.Workspace;
import org.apache.tools.ant.BuildException;
/**
@@ -66,43 +66,43 @@ import org.apache.tools.ant.BuildException;
* @author Wolf Siberski, TUI Infotec GmbH
*/
class VAJUtil {
- static private Workspace workspace;
-
- /**
- * Wraps IvjException into a BuildException
- *
- * @return org.apache.tools.ant.BuildException
- * @param errMsg Additional error message
- * @param e IvjException which is wrapped
- */
- public static BuildException createBuildException(
- String errMsg,
- IvjException e) {
- errMsg = errMsg + "\n" + e.getMessage();
- String[] errors = e.getErrors();
- if (errors != null) {
- for (int i = 0; i < errors.length; i++) {
- errMsg = errMsg + "\n" + errors[i];
- }
- }
- return new BuildException(errMsg);
- }
-
- /**
- * Insert the method's description here.
- * Creation date: (19.09.2000 13:41:21)
- * @return com.ibm.ivj.util.base.Workspace
- */
- public static Workspace getWorkspace() {
- if (workspace == null) {
- workspace = ToolEnv.connectToWorkspace();
- if (workspace == null) {
- throw new BuildException(
- "Unable to connect to Workspace! "
- + "Make sure you are running in VisualAge for Java.");
- }
- }
+ static private Workspace workspace;
+
+ /**
+ * Wraps IvjException into a BuildException
+ *
+ * @return org.apache.tools.ant.BuildException
+ * @param errMsg Additional error message
+ * @param e IvjException which is wrapped
+ */
+ public static BuildException createBuildException(
+ String errMsg,
+ IvjException e) {
+ errMsg = errMsg + "\n" + e.getMessage();
+ String[] errors = e.getErrors();
+ if (errors != null) {
+ for (int i = 0; i < errors.length; i++) {
+ errMsg = errMsg + "\n" + errors[i];
+ }
+ }
+ return new BuildException(errMsg);
+ }
+
+ /**
+ * Insert the method's description here.
+ * Creation date: (19.09.2000 13:41:21)
+ * @return com.ibm.ivj.util.base.Workspace
+ */
+ public static Workspace getWorkspace() {
+ if (workspace == null) {
+ workspace = ToolEnv.connectToWorkspace();
+ if (workspace == null) {
+ throw new BuildException(
+ "Unable to connect to Workspace! "
+ + "Make sure you are running in VisualAge for Java.");
+ }
+ }
- return workspace;
- }
-}
\ No newline at end of file
+ return workspace;
+ }
+}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java
index 32acd291b..88adaa133 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java
@@ -1,5 +1,3 @@
-package org.apache.tools.ant.taskdefs.optional.ide;
-
/*
* The Apache Software License, Version 1.1
*
@@ -53,15 +51,16 @@ package org.apache.tools.ant.taskdefs.optional.ide;
* information on the Apache Software Foundation, please see
* .
*/
+package org.apache.tools.ant.taskdefs.optional.ide;
-import org.apache.tools.ant.DirectoryScanner;
import com.ibm.ivj.util.base.IvjException;
import com.ibm.ivj.util.base.Package;
import com.ibm.ivj.util.base.Project;
+import java.io.File;
import java.util.Enumeration;
-import java.util.Vector;
import java.util.StringTokenizer;
-import java.io.File;
+import java.util.Vector;
+import org.apache.tools.ant.DirectoryScanner;
/**
* Class for scanning a Visual Age for Java workspace for packages matching
@@ -88,162 +87,160 @@ import java.io.File;
*/
public class VAJWorkspaceScanner extends DirectoryScanner {
- /**
- * Patterns that should be excluded by default.
- *
- * @see #addDefaultExcludes()
- */
- private final static String[] DEFAULTEXCLUDES =
- {
- "IBM*/**",
- "Java class libraries/**",
- "Sun class libraries*/**",
- "JSP Page Compile Generated Code/**",
- "VisualAge*/**",
- };
+ /**
+ * Patterns that should be excluded by default.
+ *
+ * @see #addDefaultExcludes()
+ */
+ private final static String[] DEFAULTEXCLUDES =
+ {
+ "IBM*/**",
+ "Java class libraries/**",
+ "Sun class libraries*/**",
+ "JSP Page Compile Generated Code/**",
+ "VisualAge*/**",
+ };
- /**
- * The packages that where found and matched at least one includes, and
- * matched no excludes.
- */
- private Vector packagesIncluded = new Vector();
+ /**
+ * The packages that where found and matched at least one includes, and
+ * matched no excludes.
+ */
+ private Vector packagesIncluded = new Vector();
- /**
- * Adds the array with default exclusions to the current exclusions set.
- */
- public void addDefaultExcludes() {
- int excludesLength = excludes == null ? 0 : excludes.length;
- String[] newExcludes;
- newExcludes = new String[excludesLength + DEFAULTEXCLUDES.length];
- if (excludesLength > 0) {
- System.arraycopy(excludes, 0, newExcludes, 0, excludesLength);
- }
- for (int i = 0; i < DEFAULTEXCLUDES.length; i++) {
- newExcludes[i + excludesLength] =
- DEFAULTEXCLUDES[i].replace('/', File.separatorChar).replace(
- '\\',
- File.separatorChar);
- }
- excludes = newExcludes;
- }
-
- /**
- * Finds all Projects specified in include patterns.
- *
- * @return the projects
- */
- public Vector findMatchingProjects() {
- Project[] projects = VAJUtil.getWorkspace().getProjects();
+ /**
+ * Adds the array with default exclusions to the current exclusions set.
+ */
+ public void addDefaultExcludes() {
+ int excludesLength = excludes == null ? 0 : excludes.length;
+ String[] newExcludes;
+ newExcludes = new String[excludesLength + DEFAULTEXCLUDES.length];
+ if (excludesLength > 0) {
+ System.arraycopy(excludes, 0, newExcludes, 0, excludesLength);
+ }
+ for (int i = 0; i < DEFAULTEXCLUDES.length; i++) {
+ newExcludes[i + excludesLength] = DEFAULTEXCLUDES[i].
+ replace( '/', File.separatorChar ).replace( '\\', File.separatorChar );
+ }
+ excludes = newExcludes;
+ }
+
+ /**
+ * Finds all Projects specified in include patterns.
+ *
+ * @return the projects
+ */
+ public Vector findMatchingProjects() {
+ Project[] projects = VAJUtil.getWorkspace().getProjects();
- Vector matchingProjects = new Vector();
+ Vector matchingProjects = new Vector();
- boolean allProjectsMatch = false;
- for (int i = 0; i < projects.length; i++) {
- Project project = projects[i];
- for (int j = 0; j < includes.length && !allProjectsMatch; j++) {
- StringTokenizer tok = new StringTokenizer(includes[j], File.separator);
- String projectNamePattern = tok.nextToken();
- if (projectNamePattern.equals("**")) {
- // if an include pattern starts with '**',
- // all projects match
- allProjectsMatch = true;
- } else
- if (match(projectNamePattern, project.getName())) {
- matchingProjects.addElement(project);
- break;
- }
- }
- }
+ boolean allProjectsMatch = false;
+ for (int i = 0; i < projects.length; i++) {
+ Project project = projects[i];
+ for (int j = 0; j < includes.length && !allProjectsMatch; j++) {
+ StringTokenizer tok = new StringTokenizer(includes[j], File.separator);
+ String projectNamePattern = tok.nextToken();
+ if (projectNamePattern.equals("**")) {
+ // if an include pattern starts with '**',
+ // all projects match
+ allProjectsMatch = true;
+ } else
+ if (match(projectNamePattern, project.getName())) {
+ matchingProjects.addElement(project);
+ break;
+ }
+ }
+ }
- if (allProjectsMatch) {
- matchingProjects = new Vector();
- for (int i = 0; i < projects.length; i++) {
- matchingProjects.addElement(projects[i]);
- }
- }
+ if (allProjectsMatch) {
+ matchingProjects = new Vector();
+ for (int i = 0; i < projects.length; i++) {
+ matchingProjects.addElement(projects[i]);
+ }
+ }
- return matchingProjects;
- }
-
- /**
- * Get the names of the packages that matched at least one of the include
- * patterns, and didn't match one of the exclude patterns.
- *
- * @return the matching packages
- */
- public Package[] getIncludedPackages() {
- int count = packagesIncluded.size();
- Package[] packages = new Package[count];
- for (int i = 0; i < count; i++) {
- packages[i] = (Package) packagesIncluded.elementAt(i);
- }
- return packages;
- }
-
- /**
- * Matches a string against a pattern. The pattern contains two special
- * characters:
- * '*' which means zero or more characters,
- * '?' which means one and only one character.
- *
- * @param pattern the (non-null) pattern to match against
- * @param str the (non-null) string that must be matched against the
- * pattern
- *
- * @return true
when the string matches against the pattern,
- * false
otherwise.
- */
- protected static boolean match(String pattern, String str) {
- return DirectoryScanner.match(pattern, str);
- }
- /**
- * Scans the workspace for packages that match at least one include
- * pattern, and don't match any exclude patterns.
- *
- */
- public void scan() {
- if (includes == null) {
- // No includes supplied, so set it to 'matches all'
- includes = new String[1];
- includes[0] = "**";
- }
- if (excludes == null) {
- excludes = new String[0];
- }
+ return matchingProjects;
+ }
+
+ /**
+ * Get the names of the packages that matched at least one of the include
+ * patterns, and didn't match one of the exclude patterns.
+ *
+ * @return the matching packages
+ */
+ public Package[] getIncludedPackages() {
+ int count = packagesIncluded.size();
+ Package[] packages = new Package[count];
+ for (int i = 0; i < count; i++) {
+ packages[i] = (Package) packagesIncluded.elementAt(i);
+ }
+ return packages;
+ }
+
+ /**
+ * Matches a string against a pattern. The pattern contains two special
+ * characters:
+ * '*' which means zero or more characters,
+ * '?' which means one and only one character.
+ *
+ * @param pattern the (non-null) pattern to match against
+ * @param str the (non-null) string that must be matched against the
+ * pattern
+ *
+ * @return true
when the string matches against the pattern,
+ * false
otherwise.
+ */
+ protected static boolean match(String pattern, String str) {
+ return DirectoryScanner.match(pattern, str);
+ }
+ /**
+ * Scans the workspace for packages that match at least one include
+ * pattern, and don't match any exclude patterns.
+ *
+ */
+ public void scan() {
+ if (includes == null) {
+ // No includes supplied, so set it to 'matches all'
+ includes = new String[1];
+ includes[0] = "**";
+ }
+ if (excludes == null) {
+ excludes = new String[0];
+ }
- // only scan projects which are included in at least one include pattern
- Vector matchingProjects = findMatchingProjects();
- for (Enumeration e = matchingProjects.elements(); e.hasMoreElements();) {
- Project project = (Project) e.nextElement();
- scanProject(project);
- }
- }
-
- /**
- * Scans a project for packages that match at least one include
- * pattern, and don't match any exclude patterns.
- *
- */
- public void scanProject(Project project) {
- try {
- Package[] packages = project.getPackages();
- if (packages != null) {
- for (int i = 0; i < packages.length; i++) {
- Package item = packages[i];
- // replace '.' by file seperator because the patterns are
- // using file seperator syntax (and we can use the match
- // methods this way).
- String name =
- project.getName()
- + File.separator
- + item.getName().replace('.', File.separatorChar);
- if (isIncluded(name) && !isExcluded(name)) {
- packagesIncluded.addElement(item);
- }
- }
- }
- } catch (IvjException e) {
- throw VAJUtil.createBuildException("VA Exception occured: ", e);
- }
- }
-}
\ No newline at end of file
+ // only scan projects which are included in at least one include pattern
+ Vector matchingProjects = findMatchingProjects();
+ for (Enumeration e = matchingProjects.elements(); e.hasMoreElements();) {
+ Project project = (Project) e.nextElement();
+ scanProject(project);
+ }
+ }
+
+ /**
+ * Scans a project for packages that match at least one include
+ * pattern, and don't match any exclude patterns.
+ *
+ */
+ public void scanProject(Project project) {
+ try {
+ Package[] packages = project.getPackages();
+ if (packages != null) {
+ for (int i = 0; i < packages.length; i++) {
+ Package item = packages[i];
+ // replace '.' by file seperator because the patterns are
+ // using file seperator syntax (and we can use the match
+ // methods this way).
+ String name =
+ project.getName()
+ + File.separator
+ + item.getName().replace('.', File.separatorChar);
+ if (isIncluded(name) && !isExcluded(name)) {
+ packagesIncluded.addElement(item);
+ }
+ }
+ }
+ } catch (IvjException e) {
+ throw VAJUtil.createBuildException("VA Exception occured: ", e);
+ }
+ }
+}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
index 0cc96afea..25ec702f9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
@@ -51,7 +51,6 @@
* information on the Apache Software Foundation, please see
* .
*/
-
package org.apache.tools.ant.taskdefs.optional.jlink;
import java.io .*;
@@ -65,66 +64,66 @@ import java.io .*;
*/
class ConstantPool extends Object{
- static final
- byte UTF8 = 1, UNUSED = 2, INTEGER = 3, FLOAT = 4, LONG = 5, DOUBLE = 6,
- CLASS = 7, STRING = 8, FIELDREF = 9, METHODREF = 10,
- INTERFACEMETHODREF = 11, NAMEANDTYPE = 12;
+ static final
+ byte UTF8 = 1, UNUSED = 2, INTEGER = 3, FLOAT = 4, LONG = 5, DOUBLE = 6,
+ CLASS = 7, STRING = 8, FIELDREF = 9, METHODREF = 10,
+ INTERFACEMETHODREF = 11, NAMEANDTYPE = 12;
- byte[] types;
+ byte[] types;
- Object[] values;
+ Object[] values;
- ConstantPool( DataInput data ) throws IOException {
- super();
+ ConstantPool( DataInput data ) throws IOException {
+ super();
- int count = data .readUnsignedShort();
- types = new byte [ count ];
- values = new Object [ count ];
- // read in all constant pool entries.
- for ( int i = 1; i < count; i++ ) {
- byte type = data .readByte();
- types[i] = type;
- switch (type)
- {
- case UTF8 :
- values[i] = data .readUTF();
- break;
-
- case UNUSED :
- break;
-
- case INTEGER :
- values[i] = new Integer( data .readInt() );
- break;
-
- case FLOAT :
- values[i] = new Float( data .readFloat() );
- break;
-
- case LONG :
- values[i] = new Long( data .readLong() );
- ++i;
- break;
-
- case DOUBLE :
- values[i] = new Double( data .readDouble() );
- ++i;
- break;
-
- case CLASS :
- case STRING :
- values[i] = new Integer( data .readUnsignedShort() );
- break;
-
- case FIELDREF :
- case METHODREF :
- case INTERFACEMETHODREF :
- case NAMEANDTYPE :
- values[i] = new Integer( data .readInt() );
- break;
- }
- }
- }
+ int count = data .readUnsignedShort();
+ types = new byte [ count ];
+ values = new Object [ count ];
+ // read in all constant pool entries.
+ for ( int i = 1; i < count; i++ ) {
+ byte type = data .readByte();
+ types[i] = type;
+ switch (type)
+ {
+ case UTF8 :
+ values[i] = data .readUTF();
+ break;
+
+ case UNUSED :
+ break;
+
+ case INTEGER :
+ values[i] = new Integer( data .readInt() );
+ break;
+
+ case FLOAT :
+ values[i] = new Float( data .readFloat() );
+ break;
+
+ case LONG :
+ values[i] = new Long( data .readLong() );
+ ++i;
+ break;
+
+ case DOUBLE :
+ values[i] = new Double( data .readDouble() );
+ ++i;
+ break;
+
+ case CLASS :
+ case STRING :
+ values[i] = new Integer( data .readUnsignedShort() );
+ break;
+
+ case FIELDREF :
+ case METHODREF :
+ case INTERFACEMETHODREF :
+ case NAMEANDTYPE :
+ values[i] = new Integer( data .readInt() );
+ break;
+ }
+ }
+ }
}
@@ -135,25 +134,25 @@ class ConstantPool extends Object{
*/
public class ClassNameReader extends Object{
- public static
- String getClassName( InputStream input ) throws IOException {
- DataInputStream data = new DataInputStream( input );
- // verify this is a valid class file.
- int cookie = data .readInt();
- if ( cookie != 0xCAFEBABE ) {
- return null;
- }
- int version = data .readInt();
- // read the constant pool.
- ConstantPool constants = new ConstantPool( data );
- Object[] values = constants .values;
- // read access flags and class index.
- int accessFlags = data .readUnsignedShort();
- int classIndex = data .readUnsignedShort();
- Integer stringIndex = (Integer) values[classIndex];
- String className = (String) values[stringIndex .intValue()];
- return className;
- }
+ public static
+ String getClassName( InputStream input ) throws IOException {
+ DataInputStream data = new DataInputStream( input );
+ // verify this is a valid class file.
+ int cookie = data .readInt();
+ if ( cookie != 0xCAFEBABE ) {
+ return null;
+ }
+ int version = data .readInt();
+ // read the constant pool.
+ ConstantPool constants = new ConstantPool( data );
+ Object[] values = constants .values;
+ // read access flags and class index.
+ int accessFlags = data .readUnsignedShort();
+ int classIndex = data .readUnsignedShort();
+ Integer stringIndex = (Integer) values[classIndex];
+ String className = (String) values[stringIndex .intValue()];
+ return className;
+ }
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java
index 8afeb146a..1fc7e0eaf 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java
@@ -177,7 +177,7 @@ public class JlinkTask extends MatchingTask {
throw new BuildException( ex, location );
}
}
-
+
private boolean haveAddFiles(){
return haveEntries(addfiles);
}
@@ -185,7 +185,7 @@ public class JlinkTask extends MatchingTask {
private boolean haveMergeFiles(){
return haveEntries(mergefiles);
}
-
+
private boolean haveEntries(Path p){
if (p == null){
return false;
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
index cc5492b5f..15cecb043 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
@@ -65,74 +65,74 @@
package org.apache.tools.ant.taskdefs.optional.jlink;
import java.io .*;
-import java.util.zip .*;
-import java.util .Vector;
import java.util .Enumeration;
+import java.util .Vector;
+import java.util.zip .*;
public class jlink extends Object{
- /**
+ /**
* The file that will be created by this instance of jlink.
- */
- public void setOutfile( String outfile ) {
- if ( outfile == null ) {
- return ;
- }
- this .outfile = outfile;
- }
+ */
+ public void setOutfile( String outfile ) {
+ if ( outfile == null ) {
+ return ;
+ }
+ this .outfile = outfile;
+ }
- /**
+ /**
* Adds a file to be merged into the output.
- */
- public void addMergeFile( String mergefile ) {
- if ( mergefile == null ) {
- return ;
- }
- mergefiles .addElement( mergefile );
- }
+ */
+ public void addMergeFile( String mergefile ) {
+ if ( mergefile == null ) {
+ return ;
+ }
+ mergefiles .addElement( mergefile );
+ }
- /**
+ /**
* Adds a file to be added into the output.
- */
- public void addAddFile( String addfile ) {
- if ( addfile == null ) {
- return ;
- }
- addfiles .addElement( addfile );
- }
+ */
+ public void addAddFile( String addfile ) {
+ if ( addfile == null ) {
+ return ;
+ }
+ addfiles .addElement( addfile );
+ }
- /**
+ /**
* Adds several files to be merged into the output.
- */
- public void addMergeFiles( String[] mergefiles ) {
- if ( mergefiles == null ) {
- return ;
- }
- for ( int i = 0; i < mergefiles .length; i++ ) {
- addMergeFile( mergefiles[i] );
- }
- }
+ */
+ public void addMergeFiles( String[] mergefiles ) {
+ if ( mergefiles == null ) {
+ return ;
+ }
+ for ( int i = 0; i < mergefiles .length; i++ ) {
+ addMergeFile( mergefiles[i] );
+ }
+ }
- /**
+ /**
* Adds several file to be added into the output.
- */
- public void addAddFiles( String[] addfiles ) {
- if ( addfiles == null ) {
- return ;
- }
- for ( int i = 0; i < addfiles .length; i++ ) {
- addAddFile( addfiles[i] );
- }
- }
+ */
+ public void addAddFiles( String[] addfiles ) {
+ if ( addfiles == null ) {
+ return ;
+ }
+ for ( int i = 0; i < addfiles .length; i++ ) {
+ addAddFile( addfiles[i] );
+ }
+ }
- /**
+ /**
* Determines whether output will be compressed.
- */
- public void setCompression( boolean compress ) {
- this .compression = compress;
- }
+ */
+ public void setCompression( boolean compress ) {
+ this .compression = compress;
+ }
- /**
+ /**
* Performs the linking of files.
* Addfiles are added to the output as-is. For example, a
* jar file is added to the output as a jar file.
@@ -146,104 +146,105 @@ public class jlink extends Object{
* provide multiple, disjoint directories, as
* addfiles: they will all be added in a rational
* manner to outfile.
- */
- public void link() throws Exception {
- ZipOutputStream output = new ZipOutputStream( new FileOutputStream( outfile ) );
- if ( compression ) {
- output .setMethod( ZipOutputStream .DEFLATED );
- output .setLevel( Deflater .DEFAULT_COMPRESSION );
- } else {
- output .setMethod( ZipOutputStream .STORED );
- }
- Enumeration merges = mergefiles .elements();
- while ( merges .hasMoreElements() ) {
- String path = (String) merges .nextElement();
- File f = new File( path );
- if ( f.getName().endsWith( ".jar" ) || f.getName().endsWith( ".zip" ) ) {
- //Do the merge
- mergeZipJarContents( output, f );
- }
- else {
- //Add this file to the addfiles Vector and add it later at the top level of the output file.
- addAddFile( path );
- }
- }
- Enumeration adds = addfiles .elements();
- while ( adds .hasMoreElements() ) {
- String name = (String) adds .nextElement();
- File f = new File( name );
- if ( f .isDirectory() ) {
- //System.out.println("in jlink: adding directory contents of " + f.getPath());
- addDirContents( output, f, f.getName() + '/', compression );
- }
- else {
- addFile( output, f, "", compression );
- }
- }
- if ( output != null ) {
- try {
- output .close();
- } catch( IOException ioe ) {}
- }
- }
+ */
+ public void link() throws Exception {
+ ZipOutputStream output = new ZipOutputStream( new FileOutputStream( outfile ) );
+ if ( compression ) {
+ output .setMethod( ZipOutputStream .DEFLATED );
+ output .setLevel( Deflater .DEFAULT_COMPRESSION );
+ } else {
+ output .setMethod( ZipOutputStream .STORED );
+ }
+ Enumeration merges = mergefiles .elements();
+ while ( merges .hasMoreElements() ) {
+ String path = (String) merges .nextElement();
+ File f = new File( path );
+ if ( f.getName().endsWith( ".jar" ) || f.getName().endsWith( ".zip" ) ) {
+ //Do the merge
+ mergeZipJarContents( output, f );
+ }
+ else {
+ //Add this file to the addfiles Vector and add it
+ //later at the top level of the output file.
+ addAddFile( path );
+ }
+ }
+ Enumeration adds = addfiles .elements();
+ while ( adds .hasMoreElements() ) {
+ String name = (String) adds .nextElement();
+ File f = new File( name );
+ if ( f .isDirectory() ) {
+ //System.out.println("in jlink: adding directory contents of " + f.getPath());
+ addDirContents( output, f, f.getName() + '/', compression );
+ }
+ else {
+ addFile( output, f, "", compression );
+ }
+ }
+ if ( output != null ) {
+ try {
+ output .close();
+ } catch( IOException ioe ) {}
+ }
+ }
- public static void main( String[] args ) {
- // jlink output input1 ... inputN
- if ( args .length < 2 ) {
- System .out .println( "usage: jlink output input1 ... inputN" );
- System .exit( 1 );
- }
- jlink linker = new jlink();
- linker .setOutfile( args[0] );
- //To maintain compatibility with the command-line version, we will only add files to be merged.
- for ( int i = 1; i < args .length; i++ ) {
- linker .addMergeFile( args[i] );
- }
- try {
- linker .link();
- } catch( Exception ex ) {
- System .err .print( ex .getMessage() );
- }
- }
+ public static void main( String[] args ) {
+ // jlink output input1 ... inputN
+ if ( args .length < 2 ) {
+ System .out .println( "usage: jlink output input1 ... inputN" );
+ System .exit( 1 );
+ }
+ jlink linker = new jlink();
+ linker .setOutfile( args[0] );
+ //To maintain compatibility with the command-line version, we will only add files to be merged.
+ for ( int i = 1; i < args .length; i++ ) {
+ linker .addMergeFile( args[i] );
+ }
+ try {
+ linker .link();
+ } catch( Exception ex ) {
+ System .err .print( ex .getMessage() );
+ }
+ }
/*
* Actually performs the merging of f into the output.
* f should be a zip or jar file.
*/
- private void mergeZipJarContents( ZipOutputStream output, File f ) throws IOException {
- //Check to see that the file with name "name" exists.
- if ( ! f .exists() ) {
- return ;
- }
- ZipFile zipf = new ZipFile( f );
- Enumeration entries = zipf.entries();
- while (entries.hasMoreElements()){
- ZipEntry inputEntry = (ZipEntry) entries.nextElement();
- //Ignore manifest entries. They're bound to cause conflicts between
- //files that are being merged. User should supply their own
- //manifest file when doing the merge.
- String inputEntryName = inputEntry.getName();
- int index = inputEntryName.indexOf("META-INF");
- if (index < 0){
- //META-INF not found in the name of the entry. Go ahead and process it.
- try {
- output.putNextEntry(processEntry(zipf, inputEntry));
- } catch (ZipException ex){
- //If we get here, it could be because we are trying to put a
- //directory entry that already exists.
- //For example, we're trying to write "com", but a previous
- //entry from another mergefile was called "com".
- //In that case, just ignore the error and go on to the
- //next entry.
- String mess = ex.getMessage();
- if (mess.indexOf("duplicate") >= 0){
- //It was the duplicate entry.
- continue;
- } else {
- //I hate to admit it, but we don't know what happened here. Throw the Exception.
- throw ex;
- }
- }
+ private void mergeZipJarContents( ZipOutputStream output, File f ) throws IOException {
+ //Check to see that the file with name "name" exists.
+ if ( ! f .exists() ) {
+ return ;
+ }
+ ZipFile zipf = new ZipFile( f );
+ Enumeration entries = zipf.entries();
+ while (entries.hasMoreElements()){
+ ZipEntry inputEntry = (ZipEntry) entries.nextElement();
+ //Ignore manifest entries. They're bound to cause conflicts between
+ //files that are being merged. User should supply their own
+ //manifest file when doing the merge.
+ String inputEntryName = inputEntry.getName();
+ int index = inputEntryName.indexOf("META-INF");
+ if (index < 0){
+ //META-INF not found in the name of the entry. Go ahead and process it.
+ try {
+ output.putNextEntry(processEntry(zipf, inputEntry));
+ } catch (ZipException ex){
+ //If we get here, it could be because we are trying to put a
+ //directory entry that already exists.
+ //For example, we're trying to write "com", but a previous
+ //entry from another mergefile was called "com".
+ //In that case, just ignore the error and go on to the
+ //next entry.
+ String mess = ex.getMessage();
+ if (mess.indexOf("duplicate") >= 0){
+ //It was the duplicate entry.
+ continue;
+ } else {
+ //I hate to admit it, but we don't know what happened here. Throw the Exception.
+ throw ex;
+ }
+ }
InputStream in = zipf.getInputStream(inputEntry);
int len = buffer.length;
int count = -1;
@@ -252,168 +253,168 @@ public class jlink extends Object{
}
in.close();
output.closeEntry();
- }
- }
- zipf .close();
- }
+ }
+ }
+ zipf .close();
+ }
/*
* Adds contents of a directory to the output.
*/
- private void addDirContents( ZipOutputStream output, File dir, String prefix, boolean compress ) throws IOException {
- String[] contents = dir .list();
- for ( int i = 0; i < contents .length; ++i ) {
- String name = contents[i];
- File file = new File( dir, name );
- if ( file .isDirectory() ) {
- addDirContents( output, file, prefix + name + '/', compress );
- }
- else {
- addFile( output, file, prefix, compress );
- }
- }
- }
+ private void addDirContents( ZipOutputStream output, File dir, String prefix, boolean compress ) throws IOException {
+ String[] contents = dir .list();
+ for ( int i = 0; i < contents .length; ++i ) {
+ String name = contents[i];
+ File file = new File( dir, name );
+ if ( file .isDirectory() ) {
+ addDirContents( output, file, prefix + name + '/', compress );
+ }
+ else {
+ addFile( output, file, prefix, compress );
+ }
+ }
+ }
/*
* Gets the name of an entry in the file. This is the real name
* which for a class is the name of the package with the class
* name appended.
*/
- private String getEntryName( File file, String prefix ) {
- String name = file .getName();
- if ( ! name .endsWith( ".class" ) ) {
- // see if the file is in fact a .class file, and determine its actual name.
- try {
- InputStream input = new FileInputStream( file );
- String className = ClassNameReader .getClassName( input );
- input .close();
- if ( className != null ) {
- return className .replace( '.', '/' ) + ".class";
- }
- } catch( IOException ioe ) {}
- }
- System.out.println("From " + file.getPath() + " and prefix " + prefix + ", creating entry " + prefix+name);
- return (prefix + name);
- }
+ private String getEntryName( File file, String prefix ) {
+ String name = file .getName();
+ if ( ! name .endsWith( ".class" ) ) {
+ // see if the file is in fact a .class file, and determine its actual name.
+ try {
+ InputStream input = new FileInputStream( file );
+ String className = ClassNameReader .getClassName( input );
+ input .close();
+ if ( className != null ) {
+ return className .replace( '.', '/' ) + ".class";
+ }
+ } catch( IOException ioe ) {}
+ }
+ System.out.println("From " + file.getPath() + " and prefix " + prefix + ", creating entry " + prefix+name);
+ return (prefix + name);
+ }
/*
* Adds a file to the output stream.
*/
- private void addFile( ZipOutputStream output, File file, String prefix, boolean compress) throws IOException {
- //Make sure file exists
- long checksum = 0;
- if ( ! file .exists() ) {
- return ;
- }
- ZipEntry entry = new ZipEntry( getEntryName( file, prefix ) );
- entry .setTime( file .lastModified() );
- entry .setSize( file .length() );
+ private void addFile( ZipOutputStream output, File file, String prefix, boolean compress) throws IOException {
+ //Make sure file exists
+ long checksum = 0;
+ if ( ! file .exists() ) {
+ return ;
+ }
+ ZipEntry entry = new ZipEntry( getEntryName( file, prefix ) );
+ entry .setTime( file .lastModified() );
+ entry .setSize( file .length() );
if (! compress){
- entry.setCrc(calcChecksum(file));
+ entry.setCrc(calcChecksum(file));
}
- FileInputStream input = new FileInputStream( file );
- addToOutputStream(output, input, entry);
- }
-
+ FileInputStream input = new FileInputStream( file );
+ addToOutputStream(output, input, entry);
+ }
+
/*
* A convenience method that several other methods might call.
*/
- private void addToOutputStream(ZipOutputStream output, InputStream input, ZipEntry ze) throws IOException{
- try {
- output.putNextEntry(ze);
- } catch (ZipException zipEx) {
- //This entry already exists. So, go with the first one.
- input.close();
- return;
- }
- int numBytes = -1;
- while((numBytes = input.read(buffer)) > 0){
- output.write(buffer, 0, numBytes);
- }
- output.closeEntry();
- input.close();
- }
+ private void addToOutputStream(ZipOutputStream output, InputStream input, ZipEntry ze) throws IOException{
+ try {
+ output.putNextEntry(ze);
+ } catch (ZipException zipEx) {
+ //This entry already exists. So, go with the first one.
+ input.close();
+ return;
+ }
+ int numBytes = -1;
+ while((numBytes = input.read(buffer)) > 0){
+ output.write(buffer, 0, numBytes);
+ }
+ output.closeEntry();
+ input.close();
+ }
/*
* A method that does the work on a given entry in a mergefile.
* The big deal is to set the right parameters in the ZipEntry
* on the output stream.
*/
- private ZipEntry processEntry( ZipFile zip, ZipEntry inputEntry ) throws IOException{
- /*
- First, some notes.
- On MRJ 2.2.2, getting the size, compressed size, and CRC32 from the
- ZipInputStream does not work for compressed (deflated) files. Those calls return -1.
- For uncompressed (stored) files, those calls do work.
- However, using ZipFile.getEntries() works for both compressed and
- uncompressed files.
-
- Now, from some simple testing I did, it seems that the value of CRC-32 is
- independent of the compression setting. So, it should be easy to pass this
- information on to the output entry.
- */
- String name = inputEntry .getName();
- if ( ! (inputEntry .isDirectory() || name .endsWith( ".class" )) ) {
- try {
- InputStream input = zip.getInputStream( zip .getEntry( name ) );
- String className = ClassNameReader .getClassName( input );
- input .close();
- if ( className != null ) {
- name = className .replace( '.', '/' ) + ".class";
- }
- } catch( IOException ioe ) {}
- }
- ZipEntry outputEntry = new ZipEntry( name );
- outputEntry.setTime(inputEntry .getTime() );
- outputEntry.setExtra(inputEntry.getExtra());
- outputEntry.setComment(inputEntry.getComment());
+ private ZipEntry processEntry( ZipFile zip, ZipEntry inputEntry ) throws IOException{
+ /*
+ First, some notes.
+ On MRJ 2.2.2, getting the size, compressed size, and CRC32 from the
+ ZipInputStream does not work for compressed (deflated) files. Those calls return -1.
+ For uncompressed (stored) files, those calls do work.
+ However, using ZipFile.getEntries() works for both compressed and
+ uncompressed files.
+
+ Now, from some simple testing I did, it seems that the value of CRC-32 is
+ independent of the compression setting. So, it should be easy to pass this
+ information on to the output entry.
+ */
+ String name = inputEntry .getName();
+ if ( ! (inputEntry .isDirectory() || name .endsWith( ".class" )) ) {
+ try {
+ InputStream input = zip.getInputStream( zip .getEntry( name ) );
+ String className = ClassNameReader .getClassName( input );
+ input .close();
+ if ( className != null ) {
+ name = className .replace( '.', '/' ) + ".class";
+ }
+ } catch( IOException ioe ) {}
+ }
+ ZipEntry outputEntry = new ZipEntry( name );
+ outputEntry.setTime(inputEntry .getTime() );
+ outputEntry.setExtra(inputEntry.getExtra());
+ outputEntry.setComment(inputEntry.getComment());
outputEntry.setTime(inputEntry.getTime());
- if (compression){
- outputEntry.setMethod(ZipEntry.DEFLATED);
+ if (compression){
+ outputEntry.setMethod(ZipEntry.DEFLATED);
//Note, don't need to specify size or crc for compressed files.
- } else {
- outputEntry.setMethod(ZipEntry.STORED);
+ } else {
+ outputEntry.setMethod(ZipEntry.STORED);
outputEntry.setCrc(inputEntry.getCrc());
- outputEntry.setSize(inputEntry.getSize());
- }
- return outputEntry;
- }
-
+ outputEntry.setSize(inputEntry.getSize());
+ }
+ return outputEntry;
+ }
+
/*
* Necessary in the case where you add a entry that
* is not compressed.
*/
- private long calcChecksum(File f) throws IOException {
- BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
- return calcChecksum(in, f.length());
- }
+ private long calcChecksum(File f) throws IOException {
+ BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
+ return calcChecksum(in, f.length());
+ }
/*
* Necessary in the case where you add a entry that
* is not compressed.
*/
- private long calcChecksum(InputStream in, long size) throws IOException{
- CRC32 crc = new CRC32();
- int len = buffer.length;
- int count = -1;
- int haveRead = 0;
+ private long calcChecksum(InputStream in, long size) throws IOException{
+ CRC32 crc = new CRC32();
+ int len = buffer.length;
+ int count = -1;
+ int haveRead = 0;
while((count=in.read(buffer, 0, len)) > 0){
haveRead += count;
crc.update(buffer, 0, count);
}
in.close();
return crc.getValue();
- }
+ }
- private String outfile = null;
+ private String outfile = null;
- private Vector mergefiles = new Vector( 10 );
+ private Vector mergefiles = new Vector( 10 );
- private Vector addfiles = new Vector( 10 );
+ private Vector addfiles = new Vector( 10 );
- private boolean compression = false;
-
- byte[] buffer = new byte[8192];
+ private boolean compression = false;
+
+ byte[] buffer = new byte[8192];
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
index bebab2192..e7f83f290 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
@@ -137,11 +137,11 @@ public class JUnitTask extends Task {
}
public void setJvm(String value) {
- commandline.setVm(value);
+ commandline.setVm(value);
}
public Commandline.Argument createJvmarg() {
- return commandline.createVmArgument();
+ return commandline.createVmArgument();
}
public Path createClasspath() {
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index 4c6e39f39..5f97382dd 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -54,12 +54,12 @@
package org.apache.tools.ant.taskdefs.optional.net;
-import org.apache.tools.ant.*;
-import org.apache.tools.ant.types.*;
+import com.oroinc.net.ftp.*;
import java.io.*;
import java.net.*;
import java.util.*;
-import com.oroinc.net.ftp.*;
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.types.*;
/**
* Basic FTP client that performs the following actions:
@@ -79,7 +79,7 @@ public class FTP
{
protected final static int SEND_FILES = 0;
protected final static int GET_FILES = 1;
- protected final static int DEL_FILES = 2;
+ protected final static int DEL_FILES = 2;
protected final static int LIST_FILES = 3;
private String remotedir;
@@ -110,11 +110,11 @@ public class FTP
"retrieved",
"deleted",
"listed"
- };
-
+ };
+
protected class FTPDirectoryScanner extends DirectoryScanner {
protected FTPClient ftp = null;
-
+
public FTPDirectoryScanner(FTPClient ftp) {
super();
this.ftp = ftp;
@@ -197,7 +197,7 @@ public class FTP
throw new BuildException("Error while communicating with FTP server: ", e);
}
}
- }
+ }
/**
* Sets the remote directory where files will be placed. This may
@@ -343,7 +343,7 @@ public class FTP
*/
public void setListing(File listing) throws BuildException {
this.listing = listing;
- }
+ }
/**
@@ -385,8 +385,8 @@ public class FTP
ds = new FTPDirectoryScanner(ftp);
fs.setupDirectoryScanner(ds, project);
ds.scan();
- }
-
+ }
+
String[] dsfiles = ds.getIncludedFiles();
String dir = null;
if ((ds.getBasedir() == null) && ((action == SEND_FILES) || (action == GET_FILES))) {
@@ -410,29 +410,29 @@ public class FTP
for (int i = 0; i < dsfiles.length; i++)
{
switch (action) {
- case SEND_FILES: {
- sendFile(ftp, dir, dsfiles[i]);
- break;
- }
+ case SEND_FILES: {
+ sendFile(ftp, dir, dsfiles[i]);
+ break;
+ }
- case GET_FILES: {
- getFile(ftp, dir, dsfiles[i]);
- break;
- }
+ case GET_FILES: {
+ getFile(ftp, dir, dsfiles[i]);
+ break;
+ }
- case DEL_FILES: {
- delFile(ftp, dsfiles[i]);
- break;
- }
+ case DEL_FILES: {
+ delFile(ftp, dsfiles[i]);
+ break;
+ }
- case LIST_FILES: {
- listFile(ftp, bw, dsfiles[i]);
- break;
- }
+ case LIST_FILES: {
+ listFile(ftp, bw, dsfiles[i]);
+ break;
+ }
- default: {
- throw new BuildException("unknown ftp action " + action );
- }
+ default: {
+ throw new BuildException("unknown ftp action " + action );
+ }
}
}
@@ -516,8 +516,8 @@ public class FTP
(ftp.getReplyCode() != 550))
{
throw new BuildException(
- "could not create directory: " +
- ftp.getReplyString());
+ "could not create directory: " +
+ ftp.getReplyString());
}
dirCache.addElement(dir);
}
@@ -537,8 +537,8 @@ public class FTP
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()))
{
throw new BuildException(
- "could not date test remote file: " +
- ftp.getReplyString());
+ "could not date test remote file: " +
+ ftp.getReplyString());
}
if (files == null)
@@ -590,8 +590,8 @@ public class FTP
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()))
{
throw new BuildException(
- "could not transfer file: " +
- ftp.getReplyString());
+ "could not transfer file: " +
+ ftp.getReplyString());
}
log("File " + file.getAbsolutePath() + " copied to " + server,
@@ -619,7 +619,7 @@ public class FTP
* Delete a file from the remote host.
*/
protected void delFile(FTPClient ftp, String filename)
- throws IOException, BuildException {
+ throws IOException, BuildException {
if (verbose) {
log("deleting " + filename);
}
@@ -657,23 +657,23 @@ public class FTP
log("transferring " + filename + " to " + file.getAbsolutePath());
}
-
- File pdir = new File(file.getParent()); // stay 1.1 compatible
+
+ File pdir = new File(file.getParent()); // stay 1.1 compatible
if (!pdir.exists()) {
pdir.mkdirs();
- }
+ }
outstream = new BufferedOutputStream(new FileOutputStream(file));
ftp.retrieveFile(resolveFile(filename), outstream);
-
+
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()))
{
throw new BuildException(
-"could not transfer file: " +
- ftp.getReplyString());
+ "could not transfer file: " +
+ ftp.getReplyString());
}
-
+
log("File " + file.getAbsolutePath() + " copied from " + server,
- Project.MSG_VERBOSE);
+ Project.MSG_VERBOSE);
transferred++;
}
@@ -753,8 +753,8 @@ public class FTP
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()))
{
throw new BuildException(
- "could not set transfer type: " +
- ftp.getReplyString());
+ "could not set transfer type: " +
+ ftp.getReplyString());
}
}
@@ -765,8 +765,8 @@ public class FTP
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()))
{
throw new BuildException(
- "could not enter into passive mode: " +
- ftp.getReplyString());
+ "could not enter into passive mode: " +
+ ftp.getReplyString());
}
}
@@ -777,8 +777,8 @@ public class FTP
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()))
{
throw new BuildException(
- "could not change remote directory: " +
- ftp.getReplyString());
+ "could not change remote directory: " +
+ ftp.getReplyString());
}
}
@@ -793,18 +793,18 @@ public class FTP
finally
{
/*
- if (ftp != null && ftp.isConnected())
- {
- try
- {
- // this hangs - I don't know why.
- ftp.disconnect();
- }
- catch(IOException ex)
- {
- // ignore it
- }
- }
+ if (ftp != null && ftp.isConnected())
+ {
+ try
+ {
+ // this hangs - I don't know why.
+ ftp.disconnect();
+ }
+ catch(IOException ex)
+ {
+ // ignore it
+ }
+ }
*/
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
index b11985ed3..e28a8e29e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
@@ -54,13 +54,13 @@
package org.apache.tools.ant.taskdefs.optional.vss;
+
+import java.io.File;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
-import java.io.File;
-
/**
* A base class for creating tasks for executing commands on Visual SourceSafe.
*
@@ -149,7 +149,6 @@ public abstract class MSVSS extends Task {
return m_vssPath;
}
-
protected int run(Commandline cmd) {
try {
Execute exe = new Execute(new LogStreamHandler(this,
@@ -168,7 +167,7 @@ public abstract class MSVSS extends Task {
* Constant for the thing to execute
*/
private static final String SS_EXE = "ss";
- /** */
+ /** */
public static final String PROJECT_PREFIX = "$";
/**
@@ -188,25 +187,25 @@ public abstract class MSVSS extends Task {
*/
public static final String COMMAND_HISTORY = "History";
- /** */
+ /** */
public static final String FLAG_LOGIN = "-Y";
- /** */
+ /** */
public static final String FLAG_OVERRIDE_WORKING_DIR = "-GL";
- /** */
+ /** */
public static final String FLAG_AUTORESPONSE = "-I";
- /** */
+ /** */
public static final String FLAG_RECURSION = "-R";
- /** */
+ /** */
public static final String FLAG_VERSION = "-V";
- /** */
+ /** */
public static final String FLAG_VERSION_DATE = "-Vd";
- /** */
+ /** */
public static final String FLAG_VERSION_LABEL = "-VL";
- /** */
+ /** */
public static final String FLAG_WRITABLE = "-W";
- /** */
+ /** */
public static final String VALUE_NO = "-N";
- /** */
+ /** */
public static final String VALUE_YES = "-Y";
}
diff --git a/src/main/org/apache/tools/ant/types/DataType.java b/src/main/org/apache/tools/ant/types/DataType.java
index 4f5bb9669..bc6cdcee5 100644
--- a/src/main/org/apache/tools/ant/types/DataType.java
+++ b/src/main/org/apache/tools/ant/types/DataType.java
@@ -54,10 +54,10 @@
package org.apache.tools.ant.types;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
import java.util.Stack;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
/**
* Base class for those classes that can appear inside the build file
@@ -95,14 +95,14 @@ public abstract class DataType {
* in commenting what we are doing.
*/
public void setDescription( String desc ) {
- description=desc;
+ description=desc;
}
/**
* Return the description for the current data type.
*/
public String getDescription() {
- return description;
+ return description;
}
/**
@@ -166,7 +166,8 @@ public abstract class DataType {
* only attribute if it is set.
*/
protected BuildException tooManyAttributes() {
- return new BuildException("You must not specify more than one attribute when using refid");
+ return new BuildException( "You must not specify more than one attribute" +
+ " when using refid" );
}
/**