git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274859 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -527,8 +527,8 @@ public class ProjectHelper2 extends ProjectHelper { | |||
| String dup = project.getProperty(antFileProp); | |||
| if (dup != null && nameAttributeSet) { | |||
| File dupFile = new File(dup); | |||
| if (context.isIgnoringProjectTag() && | |||
| !dupFile.equals(context.getBuildFile())) { | |||
| if (context.isIgnoringProjectTag() | |||
| && !dupFile.equals(context.getBuildFile())) { | |||
| project.log("Duplicated project name in import. Project " | |||
| + context.getCurrentProjectName() + " defined first in " | |||
| + dup + " and again in " + context.getBuildFile(), | |||
| @@ -366,7 +366,8 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
| if (tag.equals("project")) { | |||
| new ProjectHandler(helperImpl, this).init(tag, attrs); | |||
| } else { | |||
| throw new SAXParseException("Config file is not of expected XML type", helperImpl.locator); | |||
| throw new SAXParseException("Config file is not of expected " | |||
| + "XML type", helperImpl.locator); | |||
| } | |||
| } | |||
| @@ -462,8 +463,9 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
| if ((new File(baseDir)).isAbsolute()) { | |||
| helperImpl.project.setBasedir(baseDir); | |||
| } else { | |||
| helperImpl.project.setBaseDir(helperImpl.project.resolveFile(baseDir, | |||
| helperImpl.buildFileParent)); | |||
| File resolvedBaseDir = helperImpl.project.resolveFile(baseDir, | |||
| helperImpl.buildFileParent); | |||
| helperImpl.project.setBaseDir(resolvedBaseDir); | |||
| } | |||
| } | |||
| } | |||
| @@ -577,7 +579,8 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
| } else if (key.equals("description")) { | |||
| description = value; | |||
| } else { | |||
| throw new SAXParseException("Unexpected attribute \"" + key + "\"", helperImpl.locator); | |||
| throw new SAXParseException("Unexpected attribute \"" | |||
| + key + "\"", helperImpl.locator); | |||
| } | |||
| } | |||
| @@ -731,7 +734,8 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
| * Must not be <code>null</code>. | |||
| */ | |||
| public TaskHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler, | |||
| TaskContainer container, RuntimeConfigurable parentWrapper, Target target) { | |||
| TaskContainer container, | |||
| RuntimeConfigurable parentWrapper, Target target) { | |||
| super(helperImpl, parentHandler); | |||
| this.container = container; | |||
| this.parentWrapper = parentWrapper; | |||
| @@ -975,7 +979,8 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
| * @param target The parent target of this element. | |||
| * Must not be <code>null</code>. | |||
| */ | |||
| public DataTypeHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler, Target target) { | |||
| public DataTypeHandler(ProjectHelperImpl helperImpl, | |||
| DocumentHandler parentHandler, Target target) { | |||
| super(helperImpl, parentHandler); | |||
| this.target = target; | |||
| } | |||
| @@ -135,6 +135,7 @@ public class MailLogger extends DefaultLogger { | |||
| try { | |||
| is.close(); | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| @@ -272,9 +273,11 @@ public class MailLogger extends DefaultLogger { | |||
| * @param subject mail subject | |||
| * @param message mail body | |||
| */ | |||
| private void sendMimeMail(Project project, String host, int port, String user, String password, boolean ssl, | |||
| String from, String replyToString, String toString, | |||
| String subject, String message) { | |||
| private void sendMimeMail(Project project, String host, int port, | |||
| String user, String password, boolean ssl, | |||
| String from, String replyToString, | |||
| String toString, String subject, | |||
| String message) { | |||
| // convert the replyTo string into a vector of emailaddresses | |||
| Mailer mailer = null; | |||
| try { | |||
| @@ -706,8 +706,8 @@ public abstract class AbstractCvsTask extends Task { | |||
| * level, AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL. | |||
| */ | |||
| public void setCompression(boolean usecomp) { | |||
| setCompressionLevel(usecomp ? | |||
| AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL : 0); | |||
| setCompressionLevel(usecomp | |||
| ? AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL : 0); | |||
| } | |||
| } | |||
| @@ -373,11 +373,11 @@ public class Ant extends Task { | |||
| // Are we trying to call the target in which we are defined (or | |||
| // the build file if this is a top level task)? | |||
| if (newProject.getBaseDir().equals(getProject().getBaseDir()) && | |||
| newProject.getProperty("ant.file").equals(getProject().getProperty("ant.file")) | |||
| if (newProject.getBaseDir().equals(getProject().getBaseDir()) | |||
| && newProject.getProperty("ant.file").equals(getProject().getProperty("ant.file")) | |||
| && getOwningTarget() != null | |||
| && (getOwningTarget().getName().equals("") || | |||
| getOwningTarget().getName().equals(target))) { | |||
| && (getOwningTarget().getName().equals("") | |||
| || getOwningTarget().getName().equals(target))) { | |||
| throw new BuildException("ant task calling its own parent " | |||
| + "target"); | |||
| } | |||
| @@ -69,6 +69,7 @@ import org.apache.tools.ant.IntrospectionHelper; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.TaskContainer; | |||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||
| import org.apache.tools.ant.types.Reference; | |||
| /** | |||
| * Creates a partial DTD for Ant from the currently known tasks. | |||
| @@ -307,12 +308,12 @@ public class AntStructure extends Task { | |||
| sb.append(lSep).append(" ").append(attrName).append(" "); | |||
| Class type = ih.getAttributeType(attrName); | |||
| if (type.equals(java.lang.Boolean.class) || | |||
| type.equals(java.lang.Boolean.TYPE)) { | |||
| if (type.equals(java.lang.Boolean.class) | |||
| || type.equals(java.lang.Boolean.TYPE)) { | |||
| sb.append(BOOLEAN).append(" "); | |||
| } else if (org.apache.tools.ant.types.Reference.class.isAssignableFrom(type)) { | |||
| } else if (Reference.class.isAssignableFrom(type)) { | |||
| sb.append("IDREF "); | |||
| } else if (org.apache.tools.ant.types.EnumeratedAttribute.class.isAssignableFrom(type)) { | |||
| } else if (EnumeratedAttribute.class.isAssignableFrom(type)) { | |||
| try { | |||
| EnumeratedAttribute ea = | |||
| (EnumeratedAttribute) type.newInstance(); | |||
| @@ -363,9 +364,8 @@ public class AntStructure extends Task { | |||
| for (int i = 0; i < length; i++) { | |||
| char c = s.charAt(i); | |||
| // XXX - we are ommitting CombiningChar and Extender here | |||
| if (!Character.isLetterOrDigit(c) && | |||
| c != '.' && c != '-' && | |||
| c != '_' && c != ':') { | |||
| if (!Character.isLetterOrDigit(c) | |||
| && c != '.' && c != '-' && c != '_' && c != ':') { | |||
| return false; | |||
| } | |||
| } | |||
| @@ -403,8 +403,8 @@ public class Checksum extends MatchingTask implements Condition { | |||
| if (file.exists()) { | |||
| if (property == null) { | |||
| File checksumFile = getChecksumFile(file); | |||
| if (forceOverwrite || isCondition || | |||
| (file.lastModified() > checksumFile.lastModified())) { | |||
| if (forceOverwrite || isCondition | |||
| || (file.lastModified() > checksumFile.lastModified())) { | |||
| includeFileMap.put(file, checksumFile); | |||
| } else { | |||
| log(file + " omitted as " + checksumFile + " is up to date.", | |||
| @@ -413,10 +413,12 @@ public class Checksum extends MatchingTask implements Condition { | |||
| // Read the checksum from disk. | |||
| String checksum = null; | |||
| try { | |||
| BufferedReader diskChecksumReader = new BufferedReader(new FileReader(checksumFile)); | |||
| BufferedReader diskChecksumReader | |||
| = new BufferedReader(new FileReader(checksumFile)); | |||
| checksum = diskChecksumReader.readLine(); | |||
| } catch (IOException e) { | |||
| throw new BuildException("Couldn't read checksum file " + checksumFile, e); | |||
| throw new BuildException("Couldn't read checksum file " | |||
| + checksumFile, e); | |||
| } | |||
| byte[] digest = decodeHex(checksum.toCharArray()); | |||
| allDigests.put(file, digest); | |||
| @@ -486,8 +488,8 @@ public class Checksum extends MatchingTask implements Condition { | |||
| if (destination instanceof java.lang.String) { | |||
| String prop = (String) destination; | |||
| if (isCondition) { | |||
| checksumMatches = checksumMatches && | |||
| checksum.equals(property); | |||
| checksumMatches | |||
| = checksumMatches && checksum.equals(property); | |||
| } else { | |||
| getProject().setNewProperty(prop, checksum); | |||
| } | |||
| @@ -503,8 +505,8 @@ public class Checksum extends MatchingTask implements Condition { | |||
| fis = null; | |||
| br.close(); | |||
| isr.close(); | |||
| checksumMatches = checksumMatches && | |||
| checksum.equals(suppliedChecksum); | |||
| checksumMatches = checksumMatches | |||
| && checksum.equals(suppliedChecksum); | |||
| } else { | |||
| checksumMatches = false; | |||
| } | |||
| @@ -68,7 +68,8 @@ import org.apache.tools.ant.types.PatternSet; | |||
| * | |||
| * @author costin@eng.sun.com | |||
| * @author Mariusz Nowostawski (Marni) | |||
| * <a href="mailto:mnowostawski@infoscience.otago.ac.nz">mnowostawski@infoscience.otago.ac.nz</a> | |||
| * <a href="mailto:mnowostawski@infoscience.otago.ac.nz"> | |||
| * mnowostawski@infoscience.otago.ac.nz</a> | |||
| * @author Stefan Bodewig | |||
| * | |||
| * @since Ant 1.1 | |||
| @@ -351,9 +351,8 @@ public class Copy extends Task { | |||
| destFile = new File(destDir, file.getName()); | |||
| } | |||
| if (forceOverwrite || | |||
| !destFile.exists() || | |||
| (file.lastModified() > destFile.lastModified())) { | |||
| if (forceOverwrite || !destFile.exists() | |||
| || (file.lastModified() > destFile.lastModified())) { | |||
| fileCopyMap.put(file.getAbsolutePath(), | |||
| destFile.getAbsolutePath()); | |||
| } else { | |||
| @@ -161,8 +161,8 @@ public class Copydir extends MatchingTask { | |||
| } else { | |||
| destFile = new File(to, filename); | |||
| } | |||
| if (forceOverwrite || | |||
| (srcFile.lastModified() > destFile.lastModified())) { | |||
| if (forceOverwrite | |||
| || (srcFile.lastModified() > destFile.lastModified())) { | |||
| filecopyList.put(srcFile.getAbsolutePath(), | |||
| destFile.getAbsolutePath()); | |||
| } | |||
| @@ -117,7 +117,7 @@ public class DefaultExcludes extends Task { | |||
| /** | |||
| * Pattern to remove from the default excludes. | |||
| * | |||
| * @param msg Sets the value for the pattern that | |||
| * @param remove Sets the value for the pattern that | |||
| * should nolonger be excluded. | |||
| */ | |||
| public void setRemove(String remove) { | |||
| @@ -478,8 +478,8 @@ public class Delete extends MatchingTask { | |||
| } | |||
| // delete the directory | |||
| if (dir != null && dir.exists() && dir.isDirectory() && | |||
| !usedMatchingTask) { | |||
| if (dir != null && dir.exists() && dir.isDirectory() | |||
| && !usedMatchingTask) { | |||
| /* | |||
| If verbosity is MSG_VERBOSE, that mean we are doing | |||
| regular logging (backwards as that sounds). In that | |||
| @@ -208,8 +208,8 @@ public class DependSet extends MatchingTask { | |||
| Project.MSG_WARN); | |||
| } | |||
| if (oldestTarget == null || | |||
| dest.lastModified() < oldestTargetTime) { | |||
| if (oldestTarget == null | |||
| || dest.lastModified() < oldestTargetTime) { | |||
| oldestTargetTime = dest.lastModified(); | |||
| oldestTarget = dest; | |||
| } | |||
| @@ -241,8 +241,8 @@ public class DependSet extends MatchingTask { | |||
| Project.MSG_WARN); | |||
| } | |||
| if (oldestTarget == null || | |||
| dest.lastModified() < oldestTargetTime) { | |||
| if (oldestTarget == null | |||
| || dest.lastModified() < oldestTargetTime) { | |||
| oldestTargetTime = dest.lastModified(); | |||
| oldestTarget = dest; | |||
| } | |||
| @@ -410,7 +410,7 @@ public class ExecuteOn extends ExecTask { | |||
| * Construct the command line for parallel execution. | |||
| * | |||
| * @param srcFiles The filenames to add to the commandline | |||
| * @param baseDir filenames are relative to this dir | |||
| * @param baseDirs filenames are relative to this dir | |||
| */ | |||
| protected String[] getCommandline(String[] srcFiles, File[] baseDirs) { | |||
| final char fileSeparator = File.separatorChar; | |||
| @@ -242,7 +242,7 @@ public class FixCRLF extends MatchingTask { | |||
| /** | |||
| * Specify how carriage return (CR) characters are to be handled. | |||
| * | |||
| * @param option valid values: | |||
| * @param attr valid values: | |||
| * <ul> | |||
| * <li>add: ensure that there is a CR before every LF | |||
| * <li>asis: leave CR characters alone | |||
| @@ -294,7 +294,8 @@ public abstract class JDBCTask extends Task { | |||
| log("Version = " + theVersion, Project.MSG_VERBOSE); | |||
| if (theVersion == null | |||
| || !(theVersion.startsWith(version) || theVersion.indexOf(" " + version) >= 0)) { | |||
| || !(theVersion.startsWith(version) | |||
| || theVersion.indexOf(" " + version) >= 0)) { | |||
| log("Not the required version: \"" + version + "\"", Project.MSG_VERBOSE); | |||
| return false; | |||
| } | |||
| @@ -317,10 +318,14 @@ public abstract class JDBCTask extends Task { | |||
| } | |||
| /** | |||
| * Creates a new Connection as using the driver, url, userid and password specified. | |||
| * Creates a new Connection as using the driver, url, userid and password | |||
| * specified. | |||
| * | |||
| * The calling method is responsible for closing the connection. | |||
| * | |||
| * @return Connection the newly created connection. | |||
| * @throws BuildException if the UserId/Password/Url is not set or there is no suitable driver or the driver fails to load. | |||
| * @throws BuildException if the UserId/Password/Url is not set or there | |||
| * is no suitable driver or the driver fails to load. | |||
| */ | |||
| protected Connection getConnection() throws BuildException { | |||
| if (userId == null) { | |||
| @@ -379,22 +384,23 @@ public abstract class JDBCTask extends Task { | |||
| loader = (AntClassLoader) loaderMap.get(driver); | |||
| } | |||
| if (loader == null) { | |||
| log( | |||
| "Loading " + driver + " using AntClassLoader with classpath " + classpath, | |||
| Project.MSG_VERBOSE); | |||
| log("Loading " + driver | |||
| + " using AntClassLoader with classpath " | |||
| + classpath, Project.MSG_VERBOSE); | |||
| loader = getProject().createClassLoader(classpath); | |||
| if (caching) { | |||
| loaderMap.put(driver, loader); | |||
| } | |||
| } else { | |||
| log( | |||
| "Loading " + driver + " using a cached AntClassLoader.", | |||
| log("Loading " + driver | |||
| + " using a cached AntClassLoader.", | |||
| Project.MSG_VERBOSE); | |||
| } | |||
| } | |||
| dc = loader.loadClass(driver); | |||
| } else { | |||
| log("Loading " + driver + " using system loader.", Project.MSG_VERBOSE); | |||
| log("Loading " + driver + " using system loader.", | |||
| Project.MSG_VERBOSE); | |||
| dc = Class.forName(driver); | |||
| } | |||
| driverInstance = (Driver) dc.newInstance(); | |||
| @@ -525,8 +525,8 @@ public class Jar extends Zip { | |||
| throw new BuildException("Unsupported encoding while reading " | |||
| + "manifest: " + e.getMessage(), e); | |||
| } | |||
| } else if (filesetManifestConfig != null && | |||
| !filesetManifestConfig.getValue().equals("skip")) { | |||
| } else if (filesetManifestConfig != null | |||
| && !filesetManifestConfig.getValue().equals("skip")) { | |||
| // we add this to our group of fileset manifests | |||
| log("Found manifest to merge in file " + file, | |||
| Project.MSG_VERBOSE); | |||
| @@ -1227,7 +1227,7 @@ public class Javadoc extends Task { | |||
| /** | |||
| * Create link to javadoc output at the given URL. | |||
| * | |||
| * @param link argument to configure | |||
| * @return link argument to configure | |||
| */ | |||
| public LinkArgument createLink() { | |||
| LinkArgument la = new LinkArgument(); | |||
| @@ -117,7 +117,9 @@ public class Jikes { | |||
| && args.length > 250) { | |||
| PrintWriter out = null; | |||
| try { | |||
| tmpFile = new File("jikes" + (new Random(System.currentTimeMillis())).nextLong()); | |||
| String tempFileName = "jikes" | |||
| + (new Random(System.currentTimeMillis())).nextLong(); | |||
| tmpFile = new File(tempFileName); | |||
| out = new PrintWriter(new FileWriter(tmpFile)); | |||
| for (int i = 0; i < args.length; i++) { | |||
| out.println(args[i]); | |||
| @@ -106,7 +106,8 @@ public final class LoadFile extends Task { | |||
| * Encoding to use for input, defaults to the platform's default | |||
| * encoding. <p> | |||
| * | |||
| * For a list of possible values see <a href="http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html"> | |||
| * For a list of possible values see | |||
| * <a href="http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html"> | |||
| * http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html | |||
| * </a>.</p> | |||
| * | |||
| @@ -106,7 +106,8 @@ public final class LoadProperties extends Task { | |||
| * Encoding to use for input, defaults to the platform's default | |||
| * encoding. <p> | |||
| * | |||
| * For a list of possible values see <a href="http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html"> | |||
| * For a list of possible values see | |||
| * <a href="http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html"> | |||
| * http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html | |||
| * </a>.</p> | |||
| * | |||
| @@ -636,6 +636,7 @@ public class Manifest { | |||
| /** | |||
| * Clone this section | |||
| * | |||
| * @return the cloned Section | |||
| * @since Ant 1.5.2 | |||
| */ | |||
| public Object clone() { | |||
| @@ -115,6 +115,9 @@ public class ManifestTask extends Task { | |||
| } | |||
| } | |||
| /** | |||
| * Default constructor | |||
| */ | |||
| public ManifestTask() { | |||
| mode = new Mode(); | |||
| mode.setValue("replace"); | |||
| @@ -288,8 +288,8 @@ public class Move extends Copy { | |||
| throws IOException, BuildException { | |||
| boolean renamed = true; | |||
| if ((getFilterSets() != null && getFilterSets().size() > 0) || | |||
| (getFilterChains() != null && getFilterChains().size() > 0)) { | |||
| if ((getFilterSets() != null && getFilterSets().size() > 0) | |||
| || (getFilterChains() != null && getFilterChains().size() > 0)) { | |||
| renamed = false; | |||
| } else { | |||
| if (!filtering) { | |||
| @@ -245,8 +245,8 @@ public class Parallel extends Task | |||
| if (firstException == null) { | |||
| firstException = t; | |||
| } | |||
| if (t instanceof BuildException && | |||
| firstLocation == Location.UNKNOWN_LOCATION) { | |||
| if (t instanceof BuildException | |||
| && firstLocation == Location.UNKNOWN_LOCATION) { | |||
| firstLocation = ((BuildException) t).getLocation(); | |||
| } | |||
| exceptionMessage.append(StringUtils.LINE_SEP); | |||
| @@ -101,8 +101,8 @@ import org.apache.tools.ant.types.Reference; | |||
| * @author <a href="mailto:glennm@ca.ibm.com">Glenn McAllister</a> | |||
| * @since Ant 1.1 | |||
| * | |||
| * @ant.attribute.group name="name" description="One of these, when using the name attribute" | |||
| * @ant.attribute.group name="noname" description="One of these, when not using the name attribute" | |||
| * @ant.attribute.group name="name" description="One of these, when using the name attribute" | |||
| * @ant.attribute.group name="noname" description="One of these, when not using the name attribute" | |||
| */ | |||
| public class Property extends Task { | |||
| @@ -172,8 +172,8 @@ public class Replace extends MatchingTask { | |||
| } | |||
| //Make sure property exists in property file | |||
| if (properties == null || | |||
| properties.getProperty(property) == null) { | |||
| if (properties == null | |||
| || properties.getProperty(property) == null) { | |||
| String message = "property \"" + property | |||
| + "\" was not found in " + propertyFile.getPath(); | |||
| throw new BuildException(message); | |||
| @@ -79,14 +79,15 @@ import org.apache.tools.ant.util.facade.FacadeTaskHelper; | |||
| * class and this class is a class nested into another class, you have to | |||
| * specify the classname in the form <code>Outer$$Inner</code> instead of | |||
| * <code>Outer.Inner</code>.</p> | |||
| * <p>It is possible to refine the set of files that are being rmiced. This can be | |||
| * done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, | |||
| * <p>It is possible to refine the set of files that are being rmiced. This can | |||
| * be done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, | |||
| * <i>excludesfile</i> and <i>defaultexcludes</i> | |||
| * attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to | |||
| * have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify | |||
| * attributes. With the <i>includes</i> or <i>includesfile</i> attribute you | |||
| * specify the files you want to have included by using patterns. The | |||
| * <i>exclude</i> or <i>excludesfile</i> attribute is used to specify | |||
| * the files you want to have excluded. This is also done with patterns. And | |||
| * finally with the <i>defaultexcludes</i> attribute, you can specify whether you | |||
| * want to use default exclusions or not. See the section on | |||
| * finally with the <i>defaultexcludes</i> attribute, you can specify whether | |||
| * you want to use default exclusions or not. See the section on | |||
| * directory based tasks</a>, on how the | |||
| * inclusion/exclusion of files works, and how to write patterns.</p> | |||
| * <p>This task forms an implicit FileSet and | |||
| @@ -124,8 +124,7 @@ public class Sync extends Task { | |||
| // If the destination directory didn't already exist, | |||
| // or was empty, then no previous file removal is necessary! | |||
| boolean noRemovalNecessary = !toDir.exists() || | |||
| toDir.list().length < 1; | |||
| boolean noRemovalNecessary = !toDir.exists() || toDir.list().length < 1; | |||
| // Copy all the necessary out-of-date files | |||
| log("PASS#1: Copying files to " + toDir, Project.MSG_DEBUG); | |||
| @@ -86,8 +86,10 @@ public class TaskOutputStream extends OutputStream { | |||
| */ | |||
| TaskOutputStream(Task task, int msgOutputLevel) { | |||
| System.err.println("As of Ant 1.2 released in October 2000, the TaskOutputStream class"); | |||
| System.err.println("is considered to be dead code by the Ant developers and is unmaintained."); | |||
| System.err.println("As of Ant 1.2 released in October 2000, the " | |||
| + "TaskOutputStream class"); | |||
| System.err.println("is considered to be dead code by the Ant " | |||
| + "developers and is unmaintained."); | |||
| System.err.println("Don\'t use it!"); | |||
| this.task = task; | |||
| @@ -210,8 +210,7 @@ public class Touch extends Task { | |||
| } | |||
| } | |||
| if (millis >= 0 && | |||
| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||
| if (millis >= 0 && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||
| log("modification time of files cannot be set in JDK 1.1", | |||
| Project.MSG_WARN); | |||
| return; | |||
| @@ -205,15 +205,14 @@ public class UpToDate extends Task implements Condition { | |||
| if (_sourceFile != null) { | |||
| if (mapperElement == null) { | |||
| upToDate = upToDate && | |||
| (_targetFile.lastModified() >= _sourceFile.lastModified()); | |||
| upToDate = upToDate | |||
| && (_targetFile.lastModified() >= _sourceFile.lastModified()); | |||
| } else { | |||
| SourceFileScanner sfs = new SourceFileScanner(this); | |||
| upToDate = upToDate && | |||
| (sfs.restrict(new String[] {_sourceFile.getAbsolutePath()}, | |||
| upToDate = upToDate | |||
| && (sfs.restrict(new String[] {_sourceFile.getAbsolutePath()}, | |||
| null, null, | |||
| mapperElement.getImplementation()) | |||
| .length == 0); | |||
| mapperElement.getImplementation()).length == 0); | |||
| } | |||
| } | |||
| return upToDate; | |||
| @@ -71,7 +71,9 @@ import org.apache.tools.zip.ZipOutputStream; | |||
| * <p>(The War task is a shortcut for specifying the particular layout of a WAR file. | |||
| * The same thing can be accomplished by using the <i>prefix</i> and <i>fullpath</i> | |||
| * attributes of zipfilesets in a Zip or Jar task.)</p> | |||
| * <p>The extended zipfileset element from the zip task (with attributes <i>prefix</i>, <i>fullpath</i>, and <i>src</i>) is available in the War task.</p> | |||
| * <p>The extended zipfileset element from the zip task | |||
| * (with attributes <i>prefix</i>, <i>fullpath</i>, and <i>src</i>) | |||
| * is available in the War task.</p> | |||
| * | |||
| * @author Stefan Bodewig | |||
| * | |||
| @@ -481,9 +481,9 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| } else { | |||
| outFile = new File(destDir, xmlFile + fileExt); | |||
| } | |||
| if (force || | |||
| inFile.lastModified() > outFile.lastModified() || | |||
| styleSheetLastModified > outFile.lastModified()) { | |||
| if (force | |||
| || inFile.lastModified() > outFile.lastModified() | |||
| || styleSheetLastModified > outFile.lastModified()) { | |||
| ensureDirectoryFor(outFile); | |||
| log("Processing " + inFile + " to " + outFile); | |||
| @@ -521,9 +521,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| Project.MSG_DEBUG); | |||
| log("Style file " + xslFile + " time: " + styleSheetLastModified, | |||
| Project.MSG_DEBUG); | |||
| if (force || | |||
| inFile.lastModified() > outFile.lastModified() || | |||
| styleSheetLastModified > outFile.lastModified()) { | |||
| if (force || inFile.lastModified() > outFile.lastModified() | |||
| || styleSheetLastModified > outFile.lastModified()) { | |||
| ensureDirectoryFor(outFile); | |||
| log("Processing " + inFile + " to " + outFile, | |||
| Project.MSG_INFO); | |||
| @@ -275,7 +275,8 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
| factory.setValidating(validate); | |||
| factory.setNamespaceAware(false); | |||
| Element topElement = factory.newDocumentBuilder().parse(configurationStream).getDocumentElement(); | |||
| Element topElement | |||
| = factory.newDocumentBuilder().parse(configurationStream).getDocumentElement(); | |||
| // Keep a hashtable of attributes added by this task. | |||
| // This task is allow to override its own properties | |||
| @@ -110,9 +110,9 @@ public class CompilerAdapterFactory { | |||
| if (compilerType.equalsIgnoreCase("extJavac")) { | |||
| return new JavacExternal(); | |||
| } | |||
| if (compilerType.equalsIgnoreCase("classic") || | |||
| compilerType.equalsIgnoreCase("javac1.1") || | |||
| compilerType.equalsIgnoreCase("javac1.2")) { | |||
| if (compilerType.equalsIgnoreCase("classic") | |||
| || compilerType.equalsIgnoreCase("javac1.1") | |||
| || compilerType.equalsIgnoreCase("javac1.2")) { | |||
| if (isClassicCompilerSupported) { | |||
| return new Javac12(); | |||
| } else { | |||
| @@ -125,9 +125,9 @@ public class CompilerAdapterFactory { | |||
| } | |||
| //on java<=1.3 the modern falls back to classic if it is not found | |||
| //but on java>=1.4 we just bail out early | |||
| if (compilerType.equalsIgnoreCase("modern") || | |||
| compilerType.equalsIgnoreCase("javac1.3") || | |||
| compilerType.equalsIgnoreCase("javac1.4")) { | |||
| if (compilerType.equalsIgnoreCase("modern") | |||
| || compilerType.equalsIgnoreCase("javac1.3") | |||
| || compilerType.equalsIgnoreCase("javac1.4")) { | |||
| // does the modern compiler exist? | |||
| if (doesModernCompilerExist()) { | |||
| return new Javac13(); | |||
| @@ -148,8 +148,8 @@ public class CompilerAdapterFactory { | |||
| } | |||
| } | |||
| if (compilerType.equalsIgnoreCase("jvc") || | |||
| compilerType.equalsIgnoreCase("microsoft")) { | |||
| if (compilerType.equalsIgnoreCase("jvc") | |||
| || compilerType.equalsIgnoreCase("microsoft")) { | |||
| return new Jvc(); | |||
| } | |||
| if (compilerType.equalsIgnoreCase("kjc")) { | |||
| @@ -158,8 +158,8 @@ public class CompilerAdapterFactory { | |||
| if (compilerType.equalsIgnoreCase("gcj")) { | |||
| return new Gcj(); | |||
| } | |||
| if (compilerType.equalsIgnoreCase("sj") || | |||
| compilerType.equalsIgnoreCase("symantec")) { | |||
| if (compilerType.equalsIgnoreCase("sj") | |||
| || compilerType.equalsIgnoreCase("symantec")) { | |||
| return new Sj(); | |||
| } | |||
| return resolveClassName(compilerType); | |||
| @@ -514,11 +514,11 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| * @since Ant 1.5 | |||
| */ | |||
| protected boolean assumeJava11() { | |||
| return "javac1.1".equals(attributes.getCompilerVersion()) || | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) || | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)); | |||
| return "javac1.1".equals(attributes.getCompilerVersion()) | |||
| || ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) | |||
| || ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)); | |||
| } | |||
| /** | |||
| @@ -526,11 +526,11 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| * @since Ant 1.5 | |||
| */ | |||
| protected boolean assumeJava12() { | |||
| return "javac1.2".equals(attributes.getCompilerVersion()) || | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) || | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)); | |||
| return "javac1.2".equals(attributes.getCompilerVersion()) | |||
| || ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) | |||
| || ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)); | |||
| } | |||
| /** | |||
| @@ -538,13 +538,13 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| * @since Ant 1.5 | |||
| */ | |||
| protected boolean assumeJava13() { | |||
| return "javac1.3".equals(attributes.getCompilerVersion()) || | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) || | |||
| ("modern".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) || | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)); | |||
| return "javac1.3".equals(attributes.getCompilerVersion()) | |||
| || ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) | |||
| || ("modern".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) | |||
| || ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)); | |||
| } | |||
| } | |||
| @@ -224,11 +224,11 @@ public class Os implements Condition { | |||
| isFamily = pathSep.equals(":") | |||
| && (!isFamily("mac") || osName.endsWith("x")); | |||
| } else if (family.equals("win9x")) { | |||
| isFamily = isFamily("windows") && | |||
| (osName.indexOf("95") >= 0 || | |||
| osName.indexOf("98") >= 0 || | |||
| osName.indexOf("me") >= 0 || | |||
| osName.indexOf("ce") >= 0); | |||
| isFamily = isFamily("windows") | |||
| && (osName.indexOf("95") >= 0 | |||
| || osName.indexOf("98") >= 0 | |||
| || osName.indexOf("me") >= 0 | |||
| || osName.indexOf("ce") >= 0); | |||
| } else if (family.equals("z/os")) { | |||
| isFamily = osName.indexOf("z/os") > -1 | |||
| || osName.indexOf("os/390") > -1; | |||
| @@ -84,7 +84,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the mail server | |||
| * | |||
| * @param host | |||
| * @param host the mail server name | |||
| */ | |||
| public void setHost(String host) { | |||
| this.host = host; | |||
| @@ -94,7 +94,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the smtp port | |||
| * | |||
| * @param port | |||
| * @param port the SMTP port | |||
| */ | |||
| public void setPort(int port) { | |||
| this.port = port; | |||
| @@ -103,7 +103,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the user for smtp auth | |||
| * | |||
| * @param user | |||
| * @param user the username | |||
| * @since ant 1.6 | |||
| */ | |||
| public void setUser(String user) { | |||
| @@ -113,7 +113,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the password for smtp auth | |||
| * | |||
| * @param password | |||
| * @param password the authentication password | |||
| * @since ant 1.6 | |||
| */ | |||
| public void setPassword(String password) { | |||
| @@ -123,7 +123,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets whether the user wants to send the mail through SSL | |||
| * | |||
| * @param SSL | |||
| * @param SSL if true use SSL transport | |||
| * @since ant 1.6 | |||
| */ | |||
| public void setSSL(boolean SSL) { | |||
| @@ -133,7 +133,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the message | |||
| * | |||
| * @param m | |||
| * @param m the message content | |||
| */ | |||
| public void setMessage(Message m) { | |||
| this.message = m; | |||
| @@ -143,7 +143,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the address to send from | |||
| * | |||
| * @param from | |||
| * @param from the sender | |||
| */ | |||
| public void setFrom(EmailAddress from) { | |||
| this.from = from; | |||
| @@ -153,7 +153,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the replyto addresses | |||
| * | |||
| * @param list | |||
| * @param list a vector of reployTo addresses | |||
| * @since ant 1.6 | |||
| */ | |||
| public void setReplyToList(Vector list) { | |||
| @@ -164,7 +164,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Set the to addresses | |||
| * | |||
| * @param list | |||
| * @param list a vector of recipient addresses | |||
| */ | |||
| public void setToList(Vector list) { | |||
| this.toList = list; | |||
| @@ -174,7 +174,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the cc addresses | |||
| * | |||
| * @param list | |||
| * @param list a vector of cc addresses | |||
| */ | |||
| public void setCcList(Vector list) { | |||
| this.ccList = list; | |||
| @@ -184,7 +184,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the bcc addresses | |||
| * | |||
| * @param list | |||
| * @param list a vector of the bcc addresses | |||
| */ | |||
| public void setBccList(Vector list) { | |||
| this.bccList = list; | |||
| @@ -194,7 +194,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the files to attach | |||
| * | |||
| * @param files | |||
| * @param files list of files to attach to the email. | |||
| */ | |||
| public void setFiles(Vector files) { | |||
| this.files = files; | |||
| @@ -204,7 +204,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the subject | |||
| * | |||
| * @param subject | |||
| * @param subject the subject line | |||
| */ | |||
| public void setSubject(String subject) { | |||
| this.subject = subject; | |||
| @@ -214,7 +214,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Sets the owning task | |||
| * | |||
| * @param task | |||
| * @param task the owning task instance | |||
| */ | |||
| public void setTask(Task task) { | |||
| this.task = task; | |||
| @@ -224,7 +224,7 @@ public abstract class Mailer { | |||
| /** | |||
| * Indicates whether filenames should be listed in the body | |||
| * | |||
| * @param b | |||
| * @param b if true list attached file names in the body content. | |||
| */ | |||
| public void setIncludeFileNames(boolean b) { | |||
| this.includeFileNames = b; | |||
| @@ -234,7 +234,7 @@ public abstract class Mailer { | |||
| /** | |||
| * This method should send the email | |||
| * | |||
| * @throws BuildException | |||
| * @throws BuildException if the email can't be sent. | |||
| */ | |||
| public abstract void send() | |||
| throws BuildException; | |||
| @@ -243,6 +243,8 @@ public abstract class Mailer { | |||
| * Returns the current Date in a format suitable for a SMTP date | |||
| * header. | |||
| * | |||
| * @return the current date in SMTP suitable format. | |||
| * | |||
| * @since Ant 1.5 | |||
| */ | |||
| protected final String getDate() { | |||
| @@ -146,7 +146,7 @@ public class Message extends ProjectComponent { | |||
| /** | |||
| * Prints the message onto an output stream | |||
| * | |||
| * @param out The print stream to write to | |||
| * @param ps The print stream to write to | |||
| * @throws IOException if an error occurs | |||
| */ | |||
| public void print(PrintStream ps) | |||
| @@ -798,7 +798,8 @@ public class IContract extends MatchingTask { | |||
| if (targetPrinter != null) { | |||
| targetPrinter.println(srcFile.getAbsolutePath()); | |||
| } | |||
| File classFile = new File(buildDir, files[i].substring(0, files[i].indexOf(".java")) + ".class"); | |||
| File classFile | |||
| = new File(buildDir, files[i].substring(0, files[i].indexOf(".java")) + ".class"); | |||
| if (srcFile.lastModified() > now) { | |||
| log("Warning: file modified in the future: " | |||
| @@ -119,7 +119,8 @@ import org.apache.tools.ant.util.regexp.Regexp; | |||
| * | |||
| * Attributes: | |||
| * | |||
| * file --> A single file to operation on (mutually exclusive with the fileset subelements) | |||
| * file --> A single file to operation on (mutually exclusive | |||
| * with the fileset subelements) | |||
| * match --> The Regular expression to match | |||
| * replace --> The Expression replacement string | |||
| * flags --> The options to give to the replacement | |||
| @@ -305,7 +305,8 @@ public class CCCheckin extends ClearCase { | |||
| /** | |||
| * Get the 'comment' command | |||
| * | |||
| * @param cmd containing the command line string with or without the comment flag and string appended | |||
| * @param cmd containing the command line string with or | |||
| * without the comment flag and string appended | |||
| */ | |||
| private void getCommentCommand(Commandline cmd) { | |||
| if (getComment() != null) { | |||
| @@ -322,7 +323,8 @@ public class CCCheckin extends ClearCase { | |||
| /** | |||
| * Get the 'commentfile' command | |||
| * | |||
| * @param cmd containing the command line string with or without the commentfile flag and file appended | |||
| * @param cmd containing the command line string with or | |||
| * without the commentfile flag and file appended | |||
| */ | |||
| private void getCommentFileCommand(Commandline cmd) { | |||
| if (getCommentFile() != null) { | |||
| @@ -367,9 +367,11 @@ public class CCCheckout extends ClearCase { | |||
| /** | |||
| * Get the 'out' command | |||
| * | |||
| * @return the 'out' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'out' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the out flag and path appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the out flag and path appended | |||
| */ | |||
| private void getOutCommand(Commandline cmd) { | |||
| if (getOut() != null) { | |||
| @@ -386,9 +388,11 @@ public class CCCheckout extends ClearCase { | |||
| /** | |||
| * Get the 'branch' command | |||
| * | |||
| * @return the 'branch' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'branch' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the branch flag and name appended | |||
| * @param CommandLine containing the command line string with or | |||
| without the branch flag and name appended | |||
| */ | |||
| private void getBranchCommand(Commandline cmd) { | |||
| if (getBranch() != null) { | |||
| @@ -406,9 +410,11 @@ public class CCCheckout extends ClearCase { | |||
| /** | |||
| * Get the 'comment' command | |||
| * | |||
| * @return the 'comment' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'comment' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the comment flag and string appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the comment flag and string appended | |||
| */ | |||
| private void getCommentCommand(Commandline cmd) { | |||
| if (getComment() != null) { | |||
| @@ -425,9 +431,11 @@ public class CCCheckout extends ClearCase { | |||
| /** | |||
| * Get the 'cfile' command | |||
| * | |||
| * @return the 'cfile' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'cfile' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the cfile flag and file appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the cfile flag and file appended | |||
| */ | |||
| private void getCommentFileCommand(Commandline cmd) { | |||
| if (getCommentFile() != null) { | |||
| @@ -288,7 +288,8 @@ private void checkOptions(Commandline cmd) { | |||
| /** | |||
| * Get the 'nusers' command | |||
| * | |||
| * @param cmd containing the command line string with or without the nusers flag and value appended | |||
| * @param cmd containing the command line string with or | |||
| * without the nusers flag and value appended | |||
| */ | |||
| private void getNusersCommand(Commandline cmd) { | |||
| if (getNusers() == null) { | |||
| @@ -307,7 +308,8 @@ private void checkOptions(Commandline cmd) { | |||
| /** | |||
| * Get the 'comment' command | |||
| * | |||
| * @param cmd containing the command line string with or without the comment flag and value appended | |||
| * @param cmd containing the command line string with or without the | |||
| * comment flag and value appended | |||
| */ | |||
| private void getCommentCommand(Commandline cmd) { | |||
| if (getComment() == null) { | |||
| @@ -326,7 +328,8 @@ private void checkOptions(Commandline cmd) { | |||
| /** | |||
| * Get the 'pname' command | |||
| * | |||
| * @param cmd containing the command line string with or without the pname flag and value appended | |||
| * @param cmd containing the command line string with or | |||
| * without the pname flag and value appended | |||
| */ | |||
| private void getPnameCommand(Commandline cmd) { | |||
| if (getPname() == null) { | |||
| @@ -345,7 +348,8 @@ private void checkOptions(Commandline cmd) { | |||
| /** | |||
| * Get the 'pname' command | |||
| * | |||
| * @param cmd containing the command line string with or without the pname flag and value appended | |||
| * @param cmd containing the command line string with or | |||
| * without the pname flag and value appended | |||
| */ | |||
| private void getObjselectCommand(Commandline cmd) { | |||
| if (getObjselect() == null) { | |||
| @@ -323,9 +323,11 @@ public class CCMkbl extends ClearCase { | |||
| /** | |||
| * Get the 'comment' command | |||
| * | |||
| * @return the 'comment' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'comment' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the comment flag and string appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the comment flag and string appended | |||
| */ | |||
| private void getCommentCommand(Commandline cmd) { | |||
| if (getComment() != null) { | |||
| @@ -342,9 +344,11 @@ public class CCMkbl extends ClearCase { | |||
| /** | |||
| * Get the 'commentfile' command | |||
| * | |||
| * @return the 'commentfile' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'commentfile' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the commentfile flag and file appended | |||
| * @param cmd CommandLine containing the command line string with or | |||
| * without the commentfile flag and file appended | |||
| */ | |||
| private void getCommentFileCommand(Commandline cmd) { | |||
| if (getCommentFile() != null) { | |||
| @@ -204,8 +204,8 @@ public class CCMklabel extends ClearCase { | |||
| * | |||
| * @param replace the status to set the flag to | |||
| */ | |||
| public void setReplace(boolean repl) { | |||
| m_Replace = repl; | |||
| public void setReplace(boolean replace) { | |||
| m_Replace = replace; | |||
| } | |||
| /** | |||
| @@ -240,8 +240,8 @@ public class CCMklabel extends ClearCase { | |||
| * | |||
| * @param version the status to set the flag to | |||
| */ | |||
| public void setVersion(String ver) { | |||
| m_Version = ver; | |||
| public void setVersion(String version) { | |||
| m_Version = version; | |||
| } | |||
| /** | |||
| @@ -328,9 +328,11 @@ public class CCMklabel extends ClearCase { | |||
| /** | |||
| * Get the 'version' command | |||
| * | |||
| * @return the 'version' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'version' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the version flag and string appended | |||
| * @param cmd CommandLine containing the command line string with or | |||
| * without the version flag and string appended | |||
| */ | |||
| private void getVersionCommand(Commandline cmd) { | |||
| if (getVersion() != null) { | |||
| @@ -347,9 +349,11 @@ public class CCMklabel extends ClearCase { | |||
| /** | |||
| * Get the 'comment' command | |||
| * | |||
| * @return the 'comment' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'comment' command if the attribute was | |||
| * specified, otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the comment flag and string appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the comment flag and string appended | |||
| */ | |||
| private void getCommentCommand(Commandline cmd) { | |||
| if (getComment() != null) { | |||
| @@ -366,9 +370,11 @@ public class CCMklabel extends ClearCase { | |||
| /** | |||
| * Get the 'commentfile' command | |||
| * | |||
| * @return the 'commentfile' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'commentfile' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the commentfile flag and file appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the commentfile flag and file appended | |||
| */ | |||
| private void getCommentFileCommand(Commandline cmd) { | |||
| if (getCommentFile() != null) { | |||
| @@ -385,9 +391,11 @@ public class CCMklabel extends ClearCase { | |||
| /** | |||
| * Get the type-name | |||
| * | |||
| * @return the 'type-name-specifier' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'type-name-specifier' command if the attribute | |||
| * was specified, otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the type-name | |||
| * @param CommandLine containing the command line string with or | |||
| * without the type-name | |||
| */ | |||
| private void getTypeCommand(Commandline cmd) { | |||
| String typenm = null; | |||
| @@ -85,22 +85,28 @@ import org.apache.tools.ant.types.Commandline; | |||
| * <tr> | |||
| * <tr> | |||
| * <td>global</td> | |||
| * <td>Either global or ordinary can be specified, not both. Creates a label type that is global to the VOB or to VOBs that use this VOB</td> | |||
| * <td>Either global or ordinary can be specified, not both. | |||
| * Creates a label type that is global to the VOB or to | |||
| * VOBs that use this VOB</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * <tr> | |||
| * <td>ordinary</td> | |||
| * <td>Either global or ordinary can be specified, not both. Creates a label type that can be used only in the current VOB. <B>Default</B></td> | |||
| * <td>Either global or ordinary can be specified, not both. | |||
| * Creates a label type that can be used only in the current | |||
| * VOB. <B>Default</B></td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * <tr> | |||
| * <td>pbranch</td> | |||
| * <td>Allows the label type to be used once per branch in a given element's version tree</td> | |||
| * <td>Allows the label type to be used once per branch in a given | |||
| * element's version tree</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * <tr> | |||
| * <td>shared</td> | |||
| * <td>Sets the way mastership is checked by ClearCase. See ClearCase documentation for details</td> | |||
| * <td>Sets the way mastership is checked by ClearCase. See ClearCase | |||
| * documentation for details</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * <tr> | |||
| @@ -110,7 +116,8 @@ import org.apache.tools.ant.types.Commandline; | |||
| * <tr> | |||
| * <tr> | |||
| * <td>commentfile</td> | |||
| * <td>Specify a file containing a comment. Only one of comment or cfile may be used.</td> | |||
| * <td>Specify a file containing a comment. Only one of comment or | |||
| * cfile may be used.</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </table> | |||
| @@ -319,8 +326,8 @@ public class CCMklbtype extends ClearCase { | |||
| * | |||
| * @param shared the status to set the flag to | |||
| */ | |||
| public void setShared(boolean shar) { | |||
| m_Shared = shar; | |||
| public void setShared(boolean shared) { | |||
| m_Shared = shared; | |||
| } | |||
| /** | |||
| @@ -372,9 +379,11 @@ public class CCMklbtype extends ClearCase { | |||
| /** | |||
| * Get the 'comment' command | |||
| * | |||
| * @return the 'comment' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'comment' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the comment flag and string appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the comment flag and string appended | |||
| */ | |||
| private void getCommentCommand(Commandline cmd) { | |||
| if (getComment() != null) { | |||
| @@ -391,9 +400,11 @@ public class CCMklbtype extends ClearCase { | |||
| /** | |||
| * Get the 'commentfile' command | |||
| * | |||
| * @return the 'commentfile' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'commentfile' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the commentfile flag and file appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the commentfile flag and file appended | |||
| */ | |||
| private void getCommentFileCommand(Commandline cmd) { | |||
| if (getCommentFile() != null) { | |||
| @@ -410,9 +421,11 @@ public class CCMklbtype extends ClearCase { | |||
| /** | |||
| * Get the type-name specifier | |||
| * | |||
| * @return the 'type-name-specifier' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'type-name-specifier' command if the attribute was | |||
| * specified, otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the type-name | |||
| * @param CommandLine containing the command line string with or | |||
| * without the type-name | |||
| */ | |||
| private String getTypeSpecifier() { | |||
| String typenm = null; | |||
| @@ -92,7 +92,8 @@ import org.apache.tools.ant.types.Commandline; | |||
| * <tr> | |||
| * <tr> | |||
| * <td>ignore</td> | |||
| * <td>Used with trigger types only. Forces removal of trigger type even if a pre-operation trigger would prevent its removal</td> | |||
| * <td>Used with trigger types only. Forces removal of trigger type | |||
| * even if a pre-operation trigger would prevent its removal</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * <tr> | |||
| @@ -107,7 +108,8 @@ import org.apache.tools.ant.types.Commandline; | |||
| * <tr> | |||
| * <tr> | |||
| * <td>commentfile</td> | |||
| * <td>Specify a file containing a comment. Only one of comment or cfile may be used.</td> | |||
| * <td>Specify a file containing a comment. Only one of comment or cfile | |||
| * may be used.</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </table> | |||
| @@ -336,9 +338,11 @@ public class CCRmtype extends ClearCase { | |||
| /** | |||
| * Get the 'comment' command | |||
| * | |||
| * @return the 'comment' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'comment' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the comment flag and string appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the comment flag and string appended | |||
| */ | |||
| private void getCommentCommand(Commandline cmd) { | |||
| if (getComment() != null) { | |||
| @@ -355,9 +359,11 @@ public class CCRmtype extends ClearCase { | |||
| /** | |||
| * Get the 'commentfile' command | |||
| * | |||
| * @return the 'commentfile' command if the attribute was specified, otherwise an empty string | |||
| * @return the 'commentfile' command if the attribute was specified, | |||
| * otherwise an empty string | |||
| * | |||
| * @param CommandLine containing the command line string with or without the commentfile flag and file appended | |||
| * @param CommandLine containing the command line string with or | |||
| * without the commentfile flag and file appended | |||
| */ | |||
| private void getCommentFileCommand(Commandline cmd) { | |||
| if (getCommentFile() != null) { | |||
| @@ -203,7 +203,8 @@ private void checkOptions(Commandline cmd) { | |||
| /** | |||
| * Get the 'comment' command | |||
| * | |||
| * @param cmd containing the command line string with or without the comment flag and value appended | |||
| * @param cmd containing the command line string with or without the | |||
| * comment flag and value appended | |||
| */ | |||
| private void getCommentCommand(Commandline cmd) { | |||
| if (getComment() == null) { | |||
| @@ -222,7 +223,8 @@ private void checkOptions(Commandline cmd) { | |||
| /** | |||
| * Get the 'pname' command | |||
| * | |||
| * @param cmd containing the command line string with or without the pname flag and value appended | |||
| * @param cmd containing the command line string with or without the | |||
| * pname flag and value appended | |||
| */ | |||
| private void getPnameCommand(Commandline cmd) { | |||
| if (getPname() == null) { | |||
| @@ -241,7 +243,8 @@ private void checkOptions(Commandline cmd) { | |||
| /** | |||
| * Get the 'pname' command | |||
| * | |||
| * @param cmd containing the command line string with or without the pname flag and value appended | |||
| * @param cmd containing the command line string with or without | |||
| * the pname flag and value appended | |||
| */ | |||
| private void getObjselectCommand(Commandline cmd) { | |||
| if (getObjselect() == null) { | |||
| @@ -100,12 +100,14 @@ import org.apache.tools.ant.types.Commandline; | |||
| * <tr> | |||
| * <tr> | |||
| * <td>currenttime</td> | |||
| * <td>Specifies that modification time should be written as the current time. Either currenttime or preservetime can be specified.</td> | |||
| * <td>Specifies that modification time should be written as the current | |||
| * time. Either currenttime or preservetime can be specified.</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * <tr> | |||
| * <td>preservetime</td> | |||
| * <td>Specifies that modification time should preserved from the VOB time. Either currenttime or preservetime can be specified.</td> | |||
| * <td>Specifies that modification time should preserved from the VOB | |||
| * time. Either currenttime or preservetime can be specified.</td> | |||
| * <td>No</td> | |||
| * <tr> | |||
| * </table> | |||
| @@ -147,7 +147,8 @@ public abstract class ClearCase extends Task { | |||
| protected int run(Commandline cmd) { | |||
| try { | |||
| Project aProj = getProject(); | |||
| Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); | |||
| Execute exe | |||
| = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); | |||
| exe.setAntRun(aProj); | |||
| exe.setWorkingDirectory(aProj.getBaseDir()); | |||
| exe.setCommandline(cmd.getCommandline()); | |||
| @@ -412,7 +412,8 @@ public class Depend extends MatchingTask { | |||
| if (!dependency.startsWith("java.") | |||
| && !dependency.startsWith("javax.")) { | |||
| URL classURL = loader.getResource(dependency.replace('.', '/') + ".class"); | |||
| URL classURL | |||
| = loader.getResource(dependency.replace('.', '/') + ".class"); | |||
| if (classURL != null) { | |||
| if (classURL.getProtocol().equals("jar")) { | |||
| String jarFilePath = classURL.getFile(); | |||
| @@ -524,8 +525,8 @@ public class Depend extends MatchingTask { | |||
| Project.MSG_VERBOSE); | |||
| ClassFileInfo topLevelClassInfo | |||
| = (ClassFileInfo) classFileInfoMap.get(topLevelClassName); | |||
| if (topLevelClassInfo != null && | |||
| topLevelClassInfo.absoluteFile.exists()) { | |||
| if (topLevelClassInfo != null | |||
| && topLevelClassInfo.absoluteFile.exists()) { | |||
| log("Deleting file " | |||
| + topLevelClassInfo.absoluteFile.getPath() | |||
| + " since one of its inner classes was removed", | |||
| @@ -618,7 +619,8 @@ public class Depend extends MatchingTask { | |||
| if (classpathFile.lastModified() | |||
| > info.absoluteFile.lastModified()) { | |||
| log("Class " + className | |||
| + " is out of date with respect to " + classpathFile, Project.MSG_DEBUG); | |||
| + " is out of date with respect to " | |||
| + classpathFile, Project.MSG_DEBUG); | |||
| outOfDateClasses.put(className, className); | |||
| break; | |||
| } | |||
| @@ -82,9 +82,12 @@ import org.apache.tools.ant.types.Path; | |||
| * whether the produced jar is valid or not. | |||
| * The supported options are: | |||
| * <ul> | |||
| * <li>debug (boolean) : turn on the debug mode for generation of stubs and skeletons (default:false)</li> | |||
| * <li>verify (boolean) : turn on the verification at the end of the jar production (default:true) </li> | |||
| * <li>verifyargs (String) : add optional argument to verify command (see vbj com.inprise.ejb.util.Verify)</li> | |||
| * <li>debug (boolean) : turn on the debug mode for generation of | |||
| * stubs and skeletons (default:false)</li> | |||
| * <li>verify (boolean) : turn on the verification at the end of the jar | |||
| * production (default:true) </li> | |||
| * <li>verifyargs (String) : add optional argument to verify command | |||
| * (see vbj com.inprise.ejb.util.Verify)</li> | |||
| * <li>basdtd (String) : location of the BAS DTD </li> | |||
| * <li>generateclient (boolean) : turn on the client jar file generation </li> | |||
| * <li>version (int) : tell what is the borland appserver version 4 or 5 </li> | |||
| @@ -92,7 +95,9 @@ import org.apache.tools.ant.types.Path; | |||
| * | |||
| *<PRE> | |||
| * | |||
| * <ejbjar srcdir="${build.classes}" basejarname="vsmp" descriptordir="${rsc.dir}/hrmanager"> | |||
| * <ejbjar srcdir="${build.classes}" | |||
| * basejarname="vsmp" | |||
| * descriptordir="${rsc.dir}/hrmanager"> | |||
| * <borland destdir="tstlib"> | |||
| * <classpath refid="classpath" /> | |||
| * </borland> | |||
| @@ -106,7 +111,8 @@ import org.apache.tools.ant.types.Path; | |||
| * @author <a href="mailto:benoit.moussaud@criltelecom.com">Benoit Moussaud</a> | |||
| * | |||
| */ | |||
| public class BorlandDeploymentTool extends GenericDeploymentTool implements ExecuteStreamHandler { | |||
| public class BorlandDeploymentTool extends GenericDeploymentTool | |||
| implements ExecuteStreamHandler { | |||
| public static final String PUBLICID_BORLAND_EJB | |||
| = "-//Inprise Corporation//DTD Enterprise JavaBeans 1.1//EN"; | |||
| @@ -150,7 +156,10 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||
| private int version = BAS; | |||
| /** Instance variable that determines whether it is necessary to verify the produced jar */ | |||
| /** | |||
| * Instance variable that determines whether it is necessary to verify the | |||
| * produced jar | |||
| */ | |||
| private boolean verify = true; | |||
| private String verifyArgs = ""; | |||
| @@ -383,7 +392,9 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||
| org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null; | |||
| log("generate client for " + sourceJar, Project.MSG_INFO); | |||
| try { | |||
| gentask = (BorlandGenerateClient) getTask().getProject().createTask("internal_bas_generateclient"); | |||
| Project project = getTask().getProject(); | |||
| gentask | |||
| = (BorlandGenerateClient) project.createTask("internal_bas_generateclient"); | |||
| gentask.setEjbjar(sourceJar); | |||
| gentask.setDebug(java2iiopdebug); | |||
| Path classpath = getCombinedClasspath(); | |||
| @@ -101,13 +101,13 @@ public class DDCreator extends MatchingTask { | |||
| * @exception BuildException if someting goes wrong with the build | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (descriptorDirectory == null || | |||
| !descriptorDirectory.isDirectory()) { | |||
| if (descriptorDirectory == null | |||
| || !descriptorDirectory.isDirectory()) { | |||
| throw new BuildException("descriptors directory " | |||
| + descriptorDirectory.getPath() + " is not valid"); | |||
| } | |||
| if (generatedFilesDirectory == null || | |||
| !generatedFilesDirectory.isDirectory()) { | |||
| if (generatedFilesDirectory == null | |||
| || !generatedFilesDirectory.isDirectory()) { | |||
| throw new BuildException("dest directory " | |||
| + generatedFilesDirectory.getPath() + " is not valid"); | |||
| } | |||
| @@ -168,7 +168,8 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| if (fileDTD.exists()) { | |||
| if (publicId != null) { | |||
| fileDTDs.put(publicId, fileDTD); | |||
| owningTask.log("Mapped publicId " + publicId + " to file " + fileDTD, Project.MSG_VERBOSE); | |||
| owningTask.log("Mapped publicId " + publicId + " to file " | |||
| + fileDTD, Project.MSG_VERBOSE); | |||
| } | |||
| return; | |||
| } | |||
| @@ -176,7 +177,8 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| if (getClass().getResource(location) != null) { | |||
| if (publicId != null) { | |||
| resourceDTDs.put(publicId, location); | |||
| owningTask.log("Mapped publicId " + publicId + " to resource " + location, Project.MSG_VERBOSE); | |||
| owningTask.log("Mapped publicId " + publicId + " to resource " | |||
| + location, Project.MSG_VERBOSE); | |||
| } | |||
| } | |||
| @@ -198,7 +200,8 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| File dtdFile = (File) fileDTDs.get(publicId); | |||
| if (dtdFile != null) { | |||
| try { | |||
| owningTask.log("Resolved " + publicId + " to local file " + dtdFile, Project.MSG_VERBOSE); | |||
| owningTask.log("Resolved " + publicId + " to local file " | |||
| + dtdFile, Project.MSG_VERBOSE); | |||
| return new InputSource(new FileInputStream(dtdFile)); | |||
| } catch (FileNotFoundException ex) { | |||
| // ignore | |||
| @@ -209,7 +212,8 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| if (dtdResourceName != null) { | |||
| InputStream is = this.getClass().getResourceAsStream(dtdResourceName); | |||
| if (is != null) { | |||
| owningTask.log("Resolved " + publicId + " to local resource " + dtdResourceName, Project.MSG_VERBOSE); | |||
| owningTask.log("Resolved " + publicId + " to local resource " | |||
| + dtdResourceName, Project.MSG_VERBOSE); | |||
| return new InputSource(is); | |||
| } | |||
| } | |||
| @@ -218,15 +222,16 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| if (dtdUrl != null) { | |||
| try { | |||
| InputStream is = dtdUrl.openStream(); | |||
| owningTask.log("Resolved " + publicId + " to url " + dtdUrl, Project.MSG_VERBOSE); | |||
| owningTask.log("Resolved " + publicId + " to url " | |||
| + dtdUrl, Project.MSG_VERBOSE); | |||
| return new InputSource(is); | |||
| } catch (IOException ioe) { | |||
| //ignore | |||
| } | |||
| } | |||
| owningTask.log("Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity", | |||
| Project.MSG_INFO); | |||
| owningTask.log("Could not resolve ( publicId: " + publicId | |||
| + ", systemId: " + systemId + ") to a local entity", Project.MSG_INFO); | |||
| return null; | |||
| } | |||
| @@ -341,17 +346,19 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| protected void processElement() { | |||
| if (inEJBRef || | |||
| (parseState != STATE_IN_ENTITY && parseState != STATE_IN_SESSION && parseState != STATE_IN_MESSAGE)) { | |||
| if (inEJBRef | |||
| || (parseState != STATE_IN_ENTITY | |||
| && parseState != STATE_IN_SESSION | |||
| && parseState != STATE_IN_MESSAGE)) { | |||
| return; | |||
| } | |||
| if (currentElement.equals(HOME_INTERFACE) || | |||
| currentElement.equals(REMOTE_INTERFACE) || | |||
| currentElement.equals(LOCAL_INTERFACE) || | |||
| currentElement.equals(LOCAL_HOME_INTERFACE) || | |||
| currentElement.equals(BEAN_CLASS) || | |||
| currentElement.equals(PK_CLASS)) { | |||
| if (currentElement.equals(HOME_INTERFACE) | |||
| || currentElement.equals(REMOTE_INTERFACE) | |||
| || currentElement.equals(LOCAL_INTERFACE) | |||
| || currentElement.equals(LOCAL_HOME_INTERFACE) | |||
| || currentElement.equals(BEAN_CLASS) | |||
| || currentElement.equals(PK_CLASS)) { | |||
| // Get the filename into a String object | |||
| File classFile = null; | |||
| @@ -359,8 +366,8 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| // If it's a primitive wrapper then we shouldn't try and put | |||
| // it into the jar, so ignore it. | |||
| if (!className.startsWith("java.") && | |||
| !className.startsWith("javax.")) { | |||
| if (!className.startsWith("java.") | |||
| && !className.startsWith("javax.")) { | |||
| // Translate periods into path separators, add .class to the | |||
| // name, create the File object and add it to the Hashtable. | |||
| className = className.replace('.', File.separatorChar); | |||
| @@ -456,8 +456,8 @@ public class EjbJar extends MatchingTask { | |||
| */ | |||
| public void setNaming(NamingScheme namingScheme) { | |||
| config.namingScheme = namingScheme; | |||
| if (!config.namingScheme.getValue().equals(NamingScheme.BASEJARNAME) && | |||
| config.baseJarName != null) { | |||
| if (!config.namingScheme.getValue().equals(NamingScheme.BASEJARNAME) | |||
| && config.baseJarName != null) { | |||
| throw new BuildException("The basejarname attribute is not " | |||
| + "compatible with the " | |||
| + config.namingScheme.getValue() + " naming scheme"); | |||
| @@ -578,8 +578,8 @@ public class EjbJar extends MatchingTask { | |||
| if (config.namingScheme == null) { | |||
| config.namingScheme = new NamingScheme(); | |||
| config.namingScheme.setValue(NamingScheme.DESCRIPTOR); | |||
| } else if (config.namingScheme.getValue().equals(NamingScheme.BASEJARNAME) && | |||
| config.baseJarName == null) { | |||
| } else if (config.namingScheme.getValue().equals(NamingScheme.BASEJARNAME) | |||
| && config.baseJarName == null) { | |||
| throw new BuildException("The basejarname attribute must " | |||
| + "be specified with the basejarname naming scheme"); | |||
| } | |||
| @@ -112,19 +112,19 @@ public class Ejbc extends MatchingTask { | |||
| * @exception BuildException if someting goes wrong with the build | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (descriptorDirectory == null || | |||
| !descriptorDirectory.isDirectory()) { | |||
| if (descriptorDirectory == null | |||
| || !descriptorDirectory.isDirectory()) { | |||
| throw new BuildException("descriptors directory " | |||
| + descriptorDirectory.getPath() + " is not valid"); | |||
| } | |||
| if (generatedFilesDirectory == null || | |||
| !generatedFilesDirectory.isDirectory()) { | |||
| if (generatedFilesDirectory == null | |||
| || !generatedFilesDirectory.isDirectory()) { | |||
| throw new BuildException("dest directory " | |||
| + generatedFilesDirectory.getPath() + " is not valid"); | |||
| } | |||
| if (sourceDirectory == null || | |||
| !sourceDirectory.isDirectory()) { | |||
| if (sourceDirectory == null | |||
| || !sourceDirectory.isDirectory()) { | |||
| throw new BuildException("src directory " | |||
| + sourceDirectory.getPath() + " is not valid"); | |||
| } | |||
| @@ -171,11 +171,16 @@ public class EjbcHelper { | |||
| DeploymentDescriptor dd = (DeploymentDescriptor) ois.readObject(); | |||
| fis.close(); | |||
| String homeInterfacePath = dd.getHomeInterfaceClassName().replace('.', '/') + ".java"; | |||
| String remoteInterfacePath = dd.getRemoteInterfaceClassName().replace('.', '/') + ".java"; | |||
| String homeInterfacePath | |||
| = dd.getHomeInterfaceClassName().replace('.', '/') + ".java"; | |||
| String remoteInterfacePath | |||
| = dd.getRemoteInterfaceClassName().replace('.', '/') + ".java"; | |||
| String primaryKeyClassPath = null; | |||
| if (dd instanceof EntityDescriptor) { | |||
| primaryKeyClassPath = ((EntityDescriptor) dd).getPrimaryKeyClassName().replace('.', '/') + ".java";; | |||
| primaryKeyClassPath | |||
| = ((EntityDescriptor) dd).getPrimaryKeyClassName(); | |||
| primaryKeyClassPath | |||
| = primaryKeyClassPath.replace('.', '/') + ".java";; | |||
| } | |||
| File homeInterfaceSource = new File(sourceDirectory, homeInterfacePath); | |||
| @@ -197,8 +202,9 @@ public class EjbcHelper { | |||
| = new File(generatedFilesDirectory, beanClassBase + "EOImpl_WLStub.class"); | |||
| // if the implementation classes don;t exist regenerate | |||
| if (!ejbImplentationClass.exists() || !homeImplementationClass.exists() || | |||
| !beanStubClass.exists()) { | |||
| if (!ejbImplentationClass.exists() | |||
| || !homeImplementationClass.exists() | |||
| || !beanStubClass.exists()) { | |||
| return true; | |||
| } | |||
| @@ -212,18 +218,19 @@ public class EjbcHelper { | |||
| classModificationTime = beanStubClass.lastModified(); | |||
| } | |||
| if (descriptorFile.lastModified() > classModificationTime || | |||
| homeInterfaceSource.lastModified() > classModificationTime || | |||
| remoteInterfaceSource.lastModified() > classModificationTime) { | |||
| if (descriptorFile.lastModified() > classModificationTime | |||
| || homeInterfaceSource.lastModified() > classModificationTime | |||
| || remoteInterfaceSource.lastModified() > classModificationTime) { | |||
| return true; | |||
| } | |||
| if (primaryKeyClassSource != null && | |||
| primaryKeyClassSource.lastModified() > classModificationTime) { | |||
| if (primaryKeyClassSource != null | |||
| && primaryKeyClassSource.lastModified() > classModificationTime) { | |||
| return true; | |||
| } | |||
| } catch (Throwable descriptorLoadException) { | |||
| System.out.println("Exception occurred reading " + descriptorFile.getName() + " - continuing"); | |||
| System.out.println("Exception occurred reading " | |||
| + descriptorFile.getName() + " - continuing"); | |||
| // any problems - just regenerate | |||
| return true; | |||
| } finally { | |||
| @@ -251,7 +258,8 @@ public class EjbcHelper { | |||
| } else { | |||
| System.out.println(descriptorFile.getName() + " is up to date"); | |||
| } | |||
| manifest += "Name: " + descriptorName.replace('\\', '/') + "\nEnterprise-Bean: True\n\n"; | |||
| manifest += "Name: " + descriptorName.replace('\\', '/') | |||
| + "\nEnterprise-Bean: True\n\n"; | |||
| } | |||
| FileWriter fw = new FileWriter(manifestFile); | |||
| @@ -549,7 +549,8 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| * look like much, we use a SAXParser and an inner class to | |||
| * get hold of all the classfile names for the descriptor. | |||
| */ | |||
| descriptorStream = new FileInputStream(new File(config.descriptorDir, descriptorFileName)); | |||
| descriptorStream | |||
| = new FileInputStream(new File(config.descriptorDir, descriptorFileName)); | |||
| saxParser.parse(new InputSource(descriptorStream), handler); | |||
| ejbFiles = handler.getFiles(); | |||
| @@ -660,9 +661,9 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| if (config.namingScheme.getValue().equals(EjbJar.NamingScheme.DESCRIPTOR)) { | |||
| ddPrefix = baseName + config.baseNameTerminator; | |||
| } else if (config.namingScheme.getValue().equals(EjbJar.NamingScheme.BASEJARNAME) || | |||
| config.namingScheme.getValue().equals(EjbJar.NamingScheme.EJB_NAME) || | |||
| config.namingScheme.getValue().equals(EjbJar.NamingScheme.DIRECTORY)) { | |||
| } else if (config.namingScheme.getValue().equals(EjbJar.NamingScheme.BASEJARNAME) | |||
| || config.namingScheme.getValue().equals(EjbJar.NamingScheme.EJB_NAME) | |||
| || config.namingScheme.getValue().equals(EjbJar.NamingScheme.DIRECTORY)) { | |||
| String canonicalDescriptor = descriptorFileName.replace('\\', '/'); | |||
| int index = canonicalDescriptor.lastIndexOf('/'); | |||
| if (index == -1) { | |||
| @@ -797,8 +798,8 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| String defaultManifest = "/org/apache/tools/ant/defaultManifest.mf"; | |||
| in = this.getClass().getResourceAsStream(defaultManifest); | |||
| if (in == null) { | |||
| throw new BuildException("Could not find default manifest: " + defaultManifest, | |||
| getLocation()); | |||
| throw new BuildException("Could not find " | |||
| + "default manifest: " + defaultManifest); | |||
| } | |||
| } | |||
| @@ -842,7 +843,8 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| if (entryIndex < 0) { | |||
| entryName = innerfiles[i]; | |||
| } else { | |||
| entryName = entryName.substring(0, entryIndex) + File.separatorChar + innerfiles[i]; | |||
| entryName = entryName.substring(0, entryIndex) | |||
| + File.separatorChar + innerfiles[i]; | |||
| } | |||
| // link the file | |||
| entryFile = new File(config.srcDir, entryName); | |||
| @@ -93,7 +93,9 @@ public class JbossDeploymentTool extends GenericDeploymentTool { | |||
| if (jbossDD.exists()) { | |||
| ejbFiles.put(META_DIR + JBOSS_DD, jbossDD); | |||
| } else { | |||
| log("Unable to locate jboss deployment descriptor. It was expected to be in " + jbossDD.getPath(), Project.MSG_WARN); | |||
| log("Unable to locate jboss deployment descriptor. " | |||
| + "It was expected to be in " + jbossDD.getPath(), | |||
| Project.MSG_WARN); | |||
| return; | |||
| } | |||
| String descriptorFileName = JBOSS_CMP10D; | |||
| @@ -62,8 +62,9 @@ import org.apache.tools.ant.types.Path; | |||
| /** | |||
| * Starts a WebLogic server. | |||
| * A number of parameters are used to control the operation of the weblogic instance. Note that the task, | |||
| * and hence ant, will not complete until the weblogic instance is stopped.</p> | |||
| * A number of parameters are used to control the operation of the weblogic | |||
| * instance. Note that the task, and hence ant, will not complete until the | |||
| * weblogic instance is stopped.</p> | |||
| * | |||
| * @author Conor MacNeill, Cortex ebusiness Pty Limited | |||
| */ | |||
| @@ -73,8 +74,9 @@ public class WLRun extends Task { | |||
| protected static final String DEFAULT_PROPERTIES_FILE = "weblogic.properties"; | |||
| /** | |||
| * The classpath to be used when running the Java VM. It must contain the weblogic | |||
| * classes <b>and</b> the implementation classes of the home and remote interfaces. | |||
| * The classpath to be used when running the Java VM. It must contain the | |||
| * weblogic classes <b>and</b> the implementation classes of the home and | |||
| * remote interfaces. | |||
| */ | |||
| private Path classpath; | |||
| @@ -487,7 +487,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| saxParserFactory.setValidating(true); | |||
| SAXParser saxParser = saxParserFactory.newSAXParser(); | |||
| DescriptorHandler handler = getWeblogicDescriptorHandler(ejbDescriptor.getParentFile()); | |||
| DescriptorHandler handler | |||
| = getWeblogicDescriptorHandler(ejbDescriptor.getParentFile()); | |||
| saxParser.parse(new InputSource | |||
| (new FileInputStream(weblogicDD)), | |||
| @@ -570,7 +571,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| } else if (PUBLICID_EJB20.equals(publicId)) { | |||
| ejbcClassName = COMPILER_EJB20; | |||
| } else { | |||
| log("Unrecognized publicId " + publicId + " - using EJB 1.1 compiler", Project.MSG_WARN); | |||
| log("Unrecognized publicId " + publicId | |||
| + " - using EJB 1.1 compiler", Project.MSG_WARN); | |||
| ejbcClassName = COMPILER_EJB11; | |||
| } | |||
| } | |||
| @@ -747,7 +749,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| if (genericEntry.getName().endsWith(".class")) { | |||
| //File are different see if its an object or an interface | |||
| String classname = genericEntry.getName().replace(File.separatorChar, '.'); | |||
| String classname | |||
| = genericEntry.getName().replace(File.separatorChar, '.'); | |||
| classname = classname.substring(0, classname.lastIndexOf(".class")); | |||
| @@ -755,7 +758,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| if (genclass.isInterface()) { | |||
| //Interface changed rebuild jar. | |||
| log("Interface " + genclass.getName() + " has changed", Project.MSG_VERBOSE); | |||
| log("Interface " + genclass.getName() | |||
| + " has changed", Project.MSG_VERBOSE); | |||
| rebuild = true; | |||
| break; | |||
| } else { | |||
| @@ -766,7 +770,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| // is it the manifest. If so ignore it | |||
| if (!genericEntry.getName().equals("META-INF/MANIFEST.MF")) { | |||
| //File other then class changed rebuild | |||
| log("Non class file " + genericEntry.getName() + " has changed", Project.MSG_VERBOSE); | |||
| log("Non class file " + genericEntry.getName() | |||
| + " has changed", Project.MSG_VERBOSE); | |||
| rebuild = true; | |||
| break; | |||
| } | |||
| @@ -775,7 +780,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| } else { | |||
| // a file doesnt exist rebuild | |||
| log("File " + filepath + " not present in weblogic jar", Project.MSG_VERBOSE); | |||
| log("File " + filepath + " not present in weblogic jar", | |||
| Project.MSG_VERBOSE); | |||
| rebuild = true; | |||
| break; | |||
| } | |||
| @@ -798,8 +804,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| InputStream is; | |||
| JarEntry je = (JarEntry) e.nextElement(); | |||
| if (je.getCompressedSize() == -1 || | |||
| je.getCompressedSize() == je.getSize()) { | |||
| if (je.getCompressedSize() == -1 | |||
| || je.getCompressedSize() == je.getSize()) { | |||
| newJarStream.setLevel(0); | |||
| } else { | |||
| newJarStream.setLevel(9); | |||
| @@ -807,7 +813,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| // Update with changed Bean class | |||
| if (replaceEntries.containsKey(je.getName())) { | |||
| log("Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE); | |||
| log("Updating Bean class from generic Jar " | |||
| + je.getName(), Project.MSG_VERBOSE); | |||
| // Use the entry from the generic jar | |||
| je = (JarEntry) replaceEntries.get(je.getName()); | |||
| is = genericJar.getInputStream(je); | |||
| @@ -61,7 +61,8 @@ import org.apache.tools.ant.Project; | |||
| public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||
| private static final String TL_DTD_LOC = "http://www.objectpeople.com/tlwl/dtd/toplink-cmp_2_5_1.dtd"; | |||
| private static final String TL_DTD_LOC | |||
| = "http://www.objectpeople.com/tlwl/dtd/toplink-cmp_2_5_1.dtd"; | |||
| private String toplinkDescriptor; | |||
| private String toplinkDTD; | |||
| @@ -76,9 +77,12 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||
| /** | |||
| * Setter used to store the location of the toplink DTD file. | |||
| * This is expected to be an URL (file or otherwise). If running this on NT using a file URL, the safest | |||
| * thing would be to not use a drive spec in the URL and make sure the file resides on the drive that | |||
| * ANT is running from. This will keep the setting in the build XML platform independent. | |||
| * This is expected to be an URL (file or otherwise). If running | |||
| * this on NT using a file URL, the safest thing would be to not use a | |||
| * drive spec in the URL and make sure the file resides on the drive that | |||
| * ANT is running from. This will keep the setting in the build XML | |||
| * platform independent. | |||
| * | |||
| * @param inString the string to use as the DTD location. | |||
| */ | |||
| public void setToplinkdtd(String inString) { | |||
| @@ -88,11 +92,11 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||
| protected DescriptorHandler getDescriptorHandler(File srcDir) { | |||
| DescriptorHandler handler = super.getDescriptorHandler(srcDir); | |||
| if (toplinkDTD != null) { | |||
| handler.registerDTD("-//The Object People, Inc.//DTD TOPLink for WebLogic CMP 2.5.1//EN", | |||
| toplinkDTD); | |||
| handler.registerDTD("-//The Object People, Inc.//" | |||
| + "DTD TOPLink for WebLogic CMP 2.5.1//EN", toplinkDTD); | |||
| } else { | |||
| handler.registerDTD("-//The Object People, Inc.//DTD TOPLink for WebLogic CMP 2.5.1//EN", | |||
| TL_DTD_LOC); | |||
| handler.registerDTD("-//The Object People, Inc.//" | |||
| + "DTD TOPLink for WebLogic CMP 2.5.1//EN", TL_DTD_LOC); | |||
| } | |||
| return handler; | |||
| } | |||
| @@ -85,11 +85,13 @@ import org.apache.tools.ant.util.FileUtils; | |||
| * <li>Map.mapxmi</li> | |||
| * <li>Schema.dbxmi</li> | |||
| * </ul> | |||
| * In terms of WebSphere, the generation of container code and stubs is called <code>deployment</code>. | |||
| * This step can be performed by the websphere element as part of the jar generation process. If the | |||
| * switch <code>ejbdeploy</code> is on, the ejbdeploy tool from the websphere toolset is called for | |||
| * every ejb-jar. Unfortunately, this step only works, if you use the ibm jdk. Otherwise, the rmic | |||
| * (called by ejbdeploy) throws a ClassFormatError. Be sure to switch ejbdeploy off, if run ant with | |||
| * In terms of WebSphere, the generation of container code and stubs is | |||
| * called <code>deployment</code>. This step can be performed by the websphere | |||
| * element as part of the jar generation process. If the switch | |||
| * <code>ejbdeploy</code> is on, the ejbdeploy tool from the websphere toolset | |||
| * is called for every ejb-jar. Unfortunately, this step only works, if you | |||
| * use the ibm jdk. Otherwise, the rmic (called by ejbdeploy) throws a | |||
| * ClassFormatError. Be sure to switch ejbdeploy off, if run ant with | |||
| * sun jdk. | |||
| * | |||
| * @author <a href="mailto:msahu@interkeel.com">Maneesh Sahu</a> | |||
| @@ -98,7 +100,6 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| /** | |||
| * Enumerated attribute with the values for the database vendor types | |||
| * | |||
| * @author Conor MacNeill | |||
| */ | |||
| public static class DBVendor extends EnumeratedAttribute { | |||
| public String[] getValues() { | |||
| @@ -600,7 +601,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| javaTask.createArg().setValue(tempdir); | |||
| javaTask.createArg().setValue(destJar.getPath()); | |||
| javaTask.createArg().setLine(getOptions()); | |||
| if (getCombinedClasspath() != null && getCombinedClasspath().toString().length() > 0) { | |||
| if (getCombinedClasspath() != null | |||
| && getCombinedClasspath().toString().length() > 0) { | |||
| javaTask.createArg().setValue("-cp"); | |||
| javaTask.createArg().setValue(getCombinedClasspath().toString()); | |||
| } | |||
| @@ -669,7 +671,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| if (ejbdeploy) { | |||
| String home = getTask().getProject().getProperty("websphere.home"); | |||
| if (home == null) { | |||
| throw new BuildException("The 'websphere.home' property must be set when 'ejbdeploy=true'"); | |||
| throw new BuildException("The 'websphere.home' property must " | |||
| + "be set when 'ejbdeploy=true'"); | |||
| } | |||
| websphereHome = getTask().getProject().resolveFile(home); | |||
| } | |||
| @@ -709,8 +712,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| JarOutputStream newJarStream = null; | |||
| try { | |||
| log("Checking if websphere Jar needs to be rebuilt for jar " + websphereJarFile.getName(), | |||
| Project.MSG_VERBOSE); | |||
| log("Checking if websphere Jar needs to be rebuilt for jar " | |||
| + websphereJarFile.getName(), Project.MSG_VERBOSE); | |||
| // Only go forward if the generic and the websphere file both exist | |||
| if (genericJarFile.exists() && genericJarFile.isFile() | |||
| && websphereJarFile.exists() && websphereJarFile.isFile()) { | |||
| @@ -747,12 +750,13 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| JarEntry genericEntry = (JarEntry) genericEntries.get(filepath); | |||
| JarEntry wasEntry = (JarEntry) wasEntries.get(filepath); | |||
| if ((genericEntry.getCrc() != wasEntry.getCrc()) || | |||
| (genericEntry.getSize() != wasEntry.getSize())) { | |||
| if ((genericEntry.getCrc() != wasEntry.getCrc()) | |||
| || (genericEntry.getSize() != wasEntry.getSize())) { | |||
| if (genericEntry.getName().endsWith(".class")) { | |||
| //File are different see if its an object or an interface | |||
| String classname = genericEntry.getName().replace(File.separatorChar, '.'); | |||
| String classname | |||
| = genericEntry.getName().replace(File.separatorChar, '.'); | |||
| classname = classname.substring(0, classname.lastIndexOf(".class")); | |||
| @@ -760,7 +764,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| if (genclass.isInterface()) { | |||
| //Interface changed rebuild jar. | |||
| log("Interface " + genclass.getName() + " has changed", Project.MSG_VERBOSE); | |||
| log("Interface " + genclass.getName() | |||
| + " has changed", Project.MSG_VERBOSE); | |||
| rebuild = true; | |||
| break; | |||
| } else { | |||
| @@ -771,7 +776,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| // is it the manifest. If so ignore it | |||
| if (!genericEntry.getName().equals("META-INF/MANIFEST.MF")) { | |||
| //File other then class changed rebuild | |||
| log("Non class file " + genericEntry.getName() + " has changed", Project.MSG_VERBOSE); | |||
| log("Non class file " + genericEntry.getName() | |||
| + " has changed", Project.MSG_VERBOSE); | |||
| rebuild = true; | |||
| } | |||
| break; | |||
| @@ -780,7 +786,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| } else { | |||
| // a file doesn't exist rebuild | |||
| log("File " + filepath + " not present in websphere jar", Project.MSG_VERBOSE); | |||
| log("File " + filepath + " not present in websphere jar", | |||
| Project.MSG_VERBOSE); | |||
| rebuild = true; | |||
| break; | |||
| } | |||
| @@ -803,8 +810,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| InputStream is; | |||
| JarEntry je = (JarEntry) e.nextElement(); | |||
| if (je.getCompressedSize() == -1 || | |||
| je.getCompressedSize() == je.getSize()) { | |||
| if (je.getCompressedSize() == -1 | |||
| || je.getCompressedSize() == je.getSize()) { | |||
| newJarStream.setLevel(0); | |||
| } else { | |||
| newJarStream.setLevel(9); | |||
| @@ -830,7 +837,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| is.close(); | |||
| } | |||
| } else { | |||
| log("websphere Jar rebuild needed due to changed interface or XML", Project.MSG_VERBOSE); | |||
| log("websphere Jar rebuild needed due to changed " | |||
| + "interface or XML", Project.MSG_VERBOSE); | |||
| } | |||
| } else { | |||
| rebuild = true; | |||
| @@ -344,15 +344,12 @@ public class Translate extends MatchingTask { | |||
| Locale locale = new Locale(bundleLanguage, | |||
| bundleCountry, | |||
| bundleVariant); | |||
| String language = locale.getLanguage().length() > 0 ? | |||
| "_" + locale.getLanguage() : | |||
| ""; | |||
| String country = locale.getCountry().length() > 0 ? | |||
| "_" + locale.getCountry() : | |||
| ""; | |||
| String variant = locale.getVariant().length() > 0 ? | |||
| "_" + locale.getVariant() : | |||
| ""; | |||
| String language = locale.getLanguage().length() > 0 | |||
| ? "_" + locale.getLanguage() : ""; | |||
| String country = locale.getCountry().length() > 0 | |||
| ? "_" + locale.getCountry() : ""; | |||
| String variant = locale.getVariant().length() > 0 | |||
| ? "_" + locale.getVariant() : ""; | |||
| String bundleFile = bundle + language + country + variant; | |||
| processBundle(bundleFile, 0, false); | |||
| @@ -369,15 +366,12 @@ public class Translate extends MatchingTask { | |||
| //using default file encoding scheme. | |||
| locale = Locale.getDefault(); | |||
| language = locale.getLanguage().length() > 0 ? | |||
| "_" + locale.getLanguage() : | |||
| ""; | |||
| country = locale.getCountry().length() > 0 ? | |||
| "_" + locale.getCountry() : | |||
| ""; | |||
| variant = locale.getVariant().length() > 0 ? | |||
| "_" + locale.getVariant() : | |||
| ""; | |||
| language = locale.getLanguage().length() > 0 | |||
| ? "_" + locale.getLanguage() : ""; | |||
| country = locale.getCountry().length() > 0 | |||
| ? "_" + locale.getCountry() : ""; | |||
| variant = locale.getVariant().length() > 0 | |||
| ? "_" + locale.getVariant() : ""; | |||
| bundleEncoding = System.getProperty("file.encoding"); | |||
| bundleFile = bundle + language + country + variant; | |||
| @@ -530,20 +524,23 @@ public class Translate extends MatchingTask { | |||
| // is there a startToken | |||
| // and there is still stuff following the startToken | |||
| int startIndex = line.indexOf(startToken); | |||
| while (startIndex >= 0 && (startIndex + startToken.length()) <= line.length()) { | |||
| while (startIndex >= 0 | |||
| && (startIndex + startToken.length()) <= line.length()) { | |||
| // the new value, this needs to be here | |||
| // because it is required to calculate the next position to search from | |||
| // at the end of the loop | |||
| String replace = null; | |||
| // we found a starttoken, is there an endtoken following? | |||
| // start at token+tokenlength because start and end token may be indentical | |||
| // start at token+tokenlength because start and end | |||
| // token may be indentical | |||
| int endIndex = line.indexOf(endToken, startIndex + startToken.length()); | |||
| if (endIndex < 0) { | |||
| startIndex += 1; | |||
| } else { | |||
| // grab the token | |||
| String token = line.substring(startIndex + startToken.length(), endIndex); | |||
| String token | |||
| = line.substring(startIndex + startToken.length(), endIndex); | |||
| // If there is a white space or = or :, then | |||
| // it isn't to be treated as a valid key. | |||
| @@ -317,7 +317,8 @@ public class VAJAntToolGUI extends Frame { | |||
| getFileDialog().setFile("*.xml"); | |||
| getFileDialog().show(); | |||
| if (!getFileDialog().getFile().equals("")) { | |||
| getBuildFileTextField().setText(getFileDialog().getDirectory() + getFileDialog().getFile()); | |||
| getBuildFileTextField().setText(getFileDialog().getDirectory() | |||
| + getFileDialog().getFile()); | |||
| } | |||
| } | |||
| // dispose and exit application | |||
| @@ -394,10 +395,12 @@ public class VAJAntToolGUI extends Frame { | |||
| * PropertyChangeListener method | |||
| */ | |||
| public void propertyChange(java.beans.PropertyChangeEvent evt) { | |||
| if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && (evt.getPropertyName().equals("projectName"))) { | |||
| if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() | |||
| && (evt.getPropertyName().equals("projectName"))) { | |||
| connectProjectNameToLabel(); | |||
| } | |||
| if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && (evt.getPropertyName().equals("buildFileName"))) { | |||
| if (evt.getSource() == VAJAntToolGUI.this.getBuildInfo() | |||
| && (evt.getPropertyName().equals("buildFileName"))) { | |||
| connectBuildFileNameToTextField(); | |||
| } | |||
| } | |||
| @@ -453,9 +456,8 @@ public class VAJAntToolGUI extends Frame { | |||
| } | |||
| /** | |||
| * AntMake constructor called by VAJAntTool integration. | |||
| * @param buildInfo VAJBuildInfo | |||
| * @param newBuildInfo VAJBuildInfo | |||
| */ | |||
| public VAJAntToolGUI(VAJBuildInfo newBuildInfo) { | |||
| super(); | |||
| setBuildInfo(newBuildInfo); | |||
| @@ -570,7 +572,8 @@ public class VAJAntToolGUI extends Frame { | |||
| iAboutContactLabel = new Label(); | |||
| iAboutContactLabel.setName("AboutContactLabel"); | |||
| iAboutContactLabel.setAlignment(java.awt.Label.CENTER); | |||
| iAboutContactLabel.setText("contact: wolf.siberski@tui.de or christoph.wilhelms@tui.de"); | |||
| iAboutContactLabel.setText("contact: wolf.siberski@tui.de or " | |||
| + "christoph.wilhelms@tui.de"); | |||
| } catch (Throwable iExc) { | |||
| handleException(iExc); | |||
| } | |||
| @@ -971,8 +974,10 @@ public class VAJAntToolGUI extends Frame { | |||
| iMessageCommandPanel = new Panel(); | |||
| iMessageCommandPanel.setName("MessageCommandPanel"); | |||
| iMessageCommandPanel.setLayout(new FlowLayout()); | |||
| getMessageCommandPanel().add(getMessageClearLogButton(), getMessageClearLogButton().getName()); | |||
| getMessageCommandPanel().add(getMessageOkButton(), getMessageOkButton().getName()); | |||
| getMessageCommandPanel().add(getMessageClearLogButton(), | |||
| getMessageClearLogButton().getName()); | |||
| getMessageCommandPanel().add(getMessageOkButton(), | |||
| getMessageOkButton().getName()); | |||
| } catch (Throwable iExc) { | |||
| handleException(iExc); | |||
| } | |||
| @@ -1011,7 +1016,9 @@ public class VAJAntToolGUI extends Frame { | |||
| iMessageFrame.setBounds(0, 0, 750, 250); | |||
| iMessageFrame.setTitle("Message Log"); | |||
| iMessageFrame.add(getMessageContentPanel(), "Center"); | |||
| iMessageFrame.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (iMessageFrame.getSize().width / 2), (java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2)); | |||
| iMessageFrame.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) | |||
| - (iMessageFrame.getSize().width / 2), | |||
| (java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2)); | |||
| } catch (Throwable iExc) { | |||
| handleException(iExc); | |||
| } | |||
| @@ -1150,19 +1157,25 @@ public class VAJAntToolGUI extends Frame { | |||
| constraintsTargetList.insets = new Insets(4, 4, 4, 4); | |||
| getOptionenPanel().add(getTargetList(), constraintsTargetList); | |||
| GridBagConstraints constraintsMessageOutputLevelLabel = new GridBagConstraints(); | |||
| constraintsMessageOutputLevelLabel.gridx = 0; constraintsMessageOutputLevelLabel.gridy = 4; | |||
| GridBagConstraints constraintsMessageOutputLevelLabel | |||
| = new GridBagConstraints(); | |||
| constraintsMessageOutputLevelLabel.gridx = 0; | |||
| constraintsMessageOutputLevelLabel.gridy = 4; | |||
| constraintsMessageOutputLevelLabel.anchor = GridBagConstraints.WEST; | |||
| constraintsMessageOutputLevelLabel.insets = new Insets(4, 4, 4, 4); | |||
| getOptionenPanel().add(getMessageOutputLevelLabel(), constraintsMessageOutputLevelLabel); | |||
| getOptionenPanel().add(getMessageOutputLevelLabel(), | |||
| constraintsMessageOutputLevelLabel); | |||
| GridBagConstraints constraintsMessageOutputLevelChoice = new GridBagConstraints(); | |||
| constraintsMessageOutputLevelChoice.gridx = 1; constraintsMessageOutputLevelChoice.gridy = 4; | |||
| GridBagConstraints constraintsMessageOutputLevelChoice | |||
| = new GridBagConstraints(); | |||
| constraintsMessageOutputLevelChoice.gridx = 1; | |||
| constraintsMessageOutputLevelChoice.gridy = 4; | |||
| constraintsMessageOutputLevelChoice.fill = GridBagConstraints.HORIZONTAL; | |||
| constraintsMessageOutputLevelChoice.anchor = GridBagConstraints.WEST; | |||
| constraintsMessageOutputLevelChoice.weightx = 1.0; | |||
| constraintsMessageOutputLevelChoice.insets = new Insets(4, 4, 4, 4); | |||
| getOptionenPanel().add(getMessageOutputLevelChoice(), constraintsMessageOutputLevelChoice); | |||
| getOptionenPanel().add(getMessageOutputLevelChoice(), | |||
| constraintsMessageOutputLevelChoice); | |||
| } catch (Throwable iExc) { | |||
| handleException(iExc); | |||
| } | |||
| @@ -1333,7 +1346,10 @@ public class VAJAntToolGUI extends Frame { | |||
| } catch (Throwable iExc) { | |||
| handleException(iExc); | |||
| } | |||
| setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (getSize().width / 2), (java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (getSize().height)); | |||
| setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) | |||
| - (getSize().width / 2), | |||
| (java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2) | |||
| - (getSize().height)); | |||
| if ((getTargetList().getItemCount() == 0) || (getTargetList().getSelectedIndex() < 0)) { | |||
| getBuildButton().setEnabled(false); | |||
| } | |||
| @@ -1373,8 +1389,10 @@ public class VAJAntToolGUI extends Frame { | |||
| // Select the log-level given by BuildInfo | |||
| getMessageOutputLevelChoice().select(iBuildInfo.getOutputMessageLevel()); | |||
| fillList(); | |||
| // BuildInfo can conly be saved to a VAJ project if tool API is called via the projects context-menu | |||
| if ((iBuildInfo.getVAJProjectName() == null) || (iBuildInfo.getVAJProjectName().equals(""))) { | |||
| // BuildInfo can conly be saved to a VAJ project if tool API | |||
| // is called via the projects context-menu | |||
| if ((iBuildInfo.getVAJProjectName() == null) | |||
| || (iBuildInfo.getVAJProjectName().equals(""))) { | |||
| getSaveMenuItem().setEnabled(false); | |||
| } | |||
| } catch (Throwable iExc) { | |||
| @@ -74,12 +74,15 @@ import java.util.Iterator; | |||
| import java.util.Vector; | |||
| /** | |||
| * A MatchingTask which relies on <A HREF="http://java.sun.com/products/java-media/jai">JAI (Java Advanced Imaging)</A> | |||
| * A MatchingTask which relies on | |||
| * <A HREF="http://java.sun.com/products/java-media/jai">JAI (Java Advanced Imaging)</A> | |||
| * to perform image manipulation operations on existing images. The | |||
| * operations are represented as ImageOperation DataType objects. | |||
| * The operations are arranged to conform to the Chaining Model | |||
| * of JAI. | |||
| * Check out the <A HREF="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/">JAI Programming Guide</A> | |||
| * Check out the | |||
| * <A HREF="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/"> | |||
| * JAI Programming Guide</A> | |||
| * | |||
| * @see org.apache.tools.ant.types.optional.image.ImageOperation | |||
| * @see org.apache.tools.ant.types.DataType | |||
| @@ -121,7 +124,9 @@ public class Image extends MatchingTask { | |||
| } | |||
| /** | |||
| * Set the image encoding type. <A HREF="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Encode.doc.html#56610">See this table in the JAI Programming Guide</A>. | |||
| * Set the image encoding type. | |||
| * <A HREF="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Encode.doc.html#56610"> | |||
| * See this table in the JAI Programming Guide</A>. | |||
| */ | |||
| public void setEncoding(String encoding) { | |||
| str_encoding = encoding; | |||
| @@ -144,7 +149,7 @@ public class Image extends MatchingTask { | |||
| /** | |||
| * Sets the destination directory for manipulated images. | |||
| * @param destination The destination directory | |||
| * @param destDir The destination directory | |||
| */ | |||
| public void setDestDir(File destDir) { | |||
| this.destDir = destDir; | |||
| @@ -284,7 +289,8 @@ public class Image extends MatchingTask { | |||
| ArrayList filesToRemove = new ArrayList(); | |||
| for (Iterator i = filesList.iterator(); i.hasNext();) { | |||
| File f = (File) i.next(); | |||
| File new_file = new File(destDir.getAbsolutePath() + File.separator + f.getName()); | |||
| File new_file = new File(destDir.getAbsolutePath() | |||
| + File.separator + f.getName()); | |||
| if (new_file.exists()) { | |||
| filesToRemove.add(f); | |||
| } | |||
| @@ -89,7 +89,8 @@ public class JonasHotDeploymentTool extends GenericHotDeploymentTool implements | |||
| /** | |||
| * All the valid actions that weblogic.deploy permits * | |||
| */ | |||
| private static final String[] VALID_ACTIONS = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||
| private static final String[] VALID_ACTIONS | |||
| = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||
| /** | |||
| * Description of the Field | |||
| @@ -134,8 +134,8 @@ public class ServerDeploy extends Task { | |||
| * <p>This method calls the deploy() method on each of the vendor-specific tools | |||
| * in the <code>vendorTools</code> collection. This performs the actual | |||
| * process of deployment on each tool. | |||
| * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete, or | |||
| * a failure occurs in the deployment process. | |||
| * @exception org.apache.tools.ant.BuildException if the attributes | |||
| * are invalid or incomplete, or a failure occurs in the deployment process. | |||
| */ | |||
| public void execute() throws BuildException { | |||
| for (Enumeration enum = vendorTools.elements(); | |||
| @@ -72,12 +72,14 @@ import org.apache.tools.ant.taskdefs.Java; | |||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool | |||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | |||
| */ | |||
| public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool implements HotDeploymentTool { | |||
| public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool | |||
| implements HotDeploymentTool { | |||
| /** The classname of the tool to run **/ | |||
| private static final String WEBLOGIC_DEPLOY_CLASS_NAME = "weblogic.deploy"; | |||
| /** All the valid actions that weblogic.deploy permits **/ | |||
| private static final String[] VALID_ACTIONS = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||
| private static final String[] VALID_ACTIONS | |||
| = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||
| /** Represents the "-debug" flag from weblogic.deploy **/ | |||
| private boolean debug; | |||
| @@ -540,7 +540,8 @@ public class JDependTask extends Task { | |||
| commandline.createArgument().setValue(f.getPath()); | |||
| } | |||
| Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN), watchdog); | |||
| Execute execute = new Execute(new LogStreamHandler(this, | |||
| Project.MSG_INFO, Project.MSG_WARN), watchdog); | |||
| execute.setCommandline(commandline.getCommandline()); | |||
| if (getDir() != null) { | |||
| execute.setWorkingDirectory(getDir()); | |||
| @@ -201,7 +201,8 @@ public class jlink extends Object { | |||
| jlink linker = new jlink(); | |||
| linker.setOutfile(args[0]); | |||
| //To maintain compatibility with the command-line version, we will only add files to be merged. | |||
| // 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]); | |||
| } | |||
| @@ -250,7 +251,8 @@ public class jlink extends Object { | |||
| //It was the duplicate entry. | |||
| continue; | |||
| } else { | |||
| //I hate to admit it, but we don't know what happened here. Throw the Exception. | |||
| // I hate to admit it, but we don't know what happened | |||
| // here. Throw the Exception. | |||
| throw ex; | |||
| } | |||
| } | |||
| @@ -273,7 +275,8 @@ public class jlink extends Object { | |||
| /* | |||
| * Adds contents of a directory to the output. | |||
| */ | |||
| private void addDirContents(ZipOutputStream output, File dir, String prefix, boolean compress) throws IOException { | |||
| 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) { | |||
| @@ -310,7 +313,8 @@ public class jlink extends Object { | |||
| } catch (IOException ioe) { | |||
| } | |||
| } | |||
| System.out.println("From " + file.getPath() + " and prefix " + prefix + ", creating entry " + prefix + name); | |||
| System.out.println("From " + file.getPath() + " and prefix " + prefix | |||
| + ", creating entry " + prefix + name); | |||
| return (prefix + name); | |||
| } | |||
| @@ -318,7 +322,8 @@ public class jlink extends Object { | |||
| /* | |||
| * Adds a file to the output stream. | |||
| */ | |||
| private void addFile(ZipOutputStream output, File file, String prefix, boolean compress) throws IOException { | |||
| private void addFile(ZipOutputStream output, File file, String prefix, | |||
| boolean compress) throws IOException { | |||
| //Make sure file exists | |||
| if (!file.exists()) { | |||
| return; | |||
| @@ -339,7 +344,8 @@ public class jlink extends Object { | |||
| /* | |||
| * A convenience method that several other methods might call. | |||
| */ | |||
| private void addToOutputStream(ZipOutputStream output, InputStream input, ZipEntry ze) throws IOException { | |||
| private void addToOutputStream(ZipOutputStream output, InputStream input, | |||
| ZipEntry ze) throws IOException { | |||
| try { | |||
| output.putNextEntry(ze); | |||
| } catch (ZipException zipEx) { | |||
| @@ -81,8 +81,8 @@ public class Jasper41Mangler implements JspMangler { | |||
| int end = jspUri.length(); | |||
| StringBuffer modifiedClassName; | |||
| modifiedClassName = new StringBuffer(jspUri.length() - start); | |||
| if (!Character.isJavaIdentifierStart(jspUri.charAt(start)) || | |||
| jspUri.charAt(start) == '_') { | |||
| if (!Character.isJavaIdentifierStart(jspUri.charAt(start)) | |||
| || jspUri.charAt(start) == '_') { | |||
| // If the first char is not a start of Java identifier or is _ | |||
| // prepend a '_'. | |||
| modifiedClassName.append('_'); | |||
| @@ -74,16 +74,19 @@ import org.apache.tools.ant.types.Path; | |||
| * | |||
| * required attributes | |||
| * src : root of source tree for JSP, ie, the document root for your weblogic server | |||
| * dest : root of destination directory, what you have set as WorkingDir in the weblogic properties | |||
| * dest : root of destination directory, what you have set as | |||
| * WorkingDir in the weblogic properties | |||
| * package : start package name under which your JSP's would be compiled | |||
| * | |||
| * other attributes | |||
| * classpath | |||
| * | |||
| * A classpath should be set which contains the weblogic classes as well as all application classes | |||
| * referenced by the JSP. The system classpath is also appended when the jspc is called, so you may | |||
| * choose to put everything in the classpath while calling Ant. However, since presumably the JSP's will reference | |||
| * classes being build by Ant, it would be better to explicitly add the classpath in the task | |||
| * A classpath should be set which contains the weblogic classes as well as all | |||
| * application classes referenced by the JSP. The system classpath is also | |||
| * appended when the jspc is called, so you may choose to put everything in | |||
| * the classpath while calling Ant. However, since presumably the JSP's will | |||
| * reference classes being build by Ant, it would be better to explicitly add | |||
| * the classpath in the task | |||
| * | |||
| * The task checks timestamps on the JSP's and the generated classes, and compiles | |||
| * only those files that have changed. | |||
| @@ -92,13 +95,15 @@ import org.apache.tools.ant.types.Path; | |||
| * <b> _dirName/_fileName.class for dirname/fileName.jsp </b> | |||
| * | |||
| * Limitation: It compiles the files thru the Classic compiler only. | |||
| * Limitation: Since it is my experience that weblogic jspc throws out of memory error on being given too | |||
| * many files at one go, it is called multiple times with one jsp file each. | |||
| * Limitation: Since it is my experience that weblogic jspc throws out of | |||
| * memory error on being given too many files at one go, it is | |||
| * called multiple times with one jsp file each. | |||
| * | |||
| * <pre> | |||
| * example | |||
| * <target name="jspcompile" depends="compile"> | |||
| * <wljspc src="c:\\weblogic\\myserver\\public_html" dest="c:\\weblogic\\myserver\\serverclasses" package="myapp.jsp"> | |||
| * <wljspc src="c:\\weblogic\\myserver\\public_html" | |||
| * dest="c:\\weblogic\\myserver\\serverclasses" package="myapp.jsp"> | |||
| * <classpath> | |||
| * <pathelement location="${weblogic.classpath}" /> | |||
| * <pathelement path="${compile.dest}" /> | |||
| @@ -305,8 +310,8 @@ public class WLJspc extends MatchingTask { | |||
| } | |||
| String filePath = pack + File.separator + "_"; | |||
| int startingIndex | |||
| = files[i].lastIndexOf(File.separator) != -1 ? files[i].lastIndexOf(File.separator) + 1 : 0; | |||
| int startingIndex = files[i].lastIndexOf(File.separator) != -1 | |||
| ? files[i].lastIndexOf(File.separator) + 1 : 0; | |||
| int endingIndex = files[i].indexOf(".jsp"); | |||
| if (endingIndex == -1) { | |||
| log("Skipping " + files[i] + ". Not a JSP", | |||
| @@ -63,12 +63,13 @@ import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.FileSet; | |||
| /** | |||
| * <p> Create then run <code>JUnitTest</code>'s based on the list of files given by the fileset attribute. | |||
| * <p> Create then run <code>JUnitTest</code>'s based on the list of files | |||
| * given by the fileset attribute. | |||
| * | |||
| * <p> Every <code>.java</code> or <code>.class</code> file in the fileset is | |||
| * assumed to be a testcase. | |||
| * A <code>JUnitTest</code> is created for each of these named classes with basic setup | |||
| * inherited from the parent <code>BatchTest</code>. | |||
| * A <code>JUnitTest</code> is created for each of these named classes with | |||
| * basic setup inherited from the parent <code>BatchTest</code>. | |||
| * | |||
| * @author <a href="mailto:jeff.martin@synamic.co.uk">Jeff Martin</a> | |||
| * @author Stefan Bodewig | |||
| @@ -181,11 +181,11 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { | |||
| output.write(results.toString()); | |||
| output.flush(); | |||
| } finally { | |||
| if (out != System.out && | |||
| out != System.err) { | |||
| if (out != System.out && out != System.err) { | |||
| try { | |||
| out.close(); | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| @@ -167,8 +167,8 @@ public final class DOMUtil { | |||
| final int len = childList.getLength(); | |||
| for (int i = 0; i < len; i++) { | |||
| Node child = childList.item(i); | |||
| if (child != null && child.getNodeType() == Node.ELEMENT_NODE && | |||
| child.getNodeName().equals(tagname)) { | |||
| if (child != null && child.getNodeType() == Node.ELEMENT_NODE | |||
| && child.getNodeName().equals(tagname)) { | |||
| return (Element) child; | |||
| } | |||
| } | |||
| @@ -63,14 +63,16 @@ import org.apache.tools.ant.types.EnumeratedAttribute; | |||
| /** | |||
| * <p> A wrapper for the implementations of <code>JUnitResultFormatter</code>. | |||
| * In particular, used as a nested <code><formatter></code> element in a <code><junit></code> task. | |||
| * In particular, used as a nested <code><formatter></code> element in | |||
| * a <code><junit></code> task. | |||
| * <p> For example, | |||
| * <code><pre> | |||
| * <junit printsummary="no" haltonfailure="yes" fork="false"> | |||
| * <formatter type="plain" usefile="false" /> | |||
| * <test name="org.apache.ecs.InternationalCharTest" /> | |||
| * </junit></pre></code> | |||
| * adds a <code>plain</code> type implementation (<code>PlainJUnitResultFormatter</code>) to display the results of the test. | |||
| * adds a <code>plain</code> type implementation | |||
| * (<code>PlainJUnitResultFormatter</code>) to display the results of the test. | |||
| * | |||
| * <p> Either the <code>type</code> or the <code>classname</code> attribute | |||
| * must be set. | |||
| @@ -104,7 +106,8 @@ public class FormatterElement { | |||
| * <li> The <code>plain</code> type (the default) uses a <code>PlainJUnitResultFormatter</code>. | |||
| * </ul> | |||
| * | |||
| * <p> Sets <code>classname</code> attribute - so you can't use that attribute if you use this one. | |||
| * <p> Sets <code>classname</code> attribute - so you can't use that | |||
| * attribute if you use this one. | |||
| */ | |||
| public void setType(TypeAttribute type) { | |||
| if ("xml".equals(type.getValue())) { | |||
| @@ -202,8 +205,8 @@ public class FormatterElement { | |||
| public boolean shouldUse(Task t) { | |||
| if (ifProperty != null && t.getProject().getProperty(ifProperty) == null) { | |||
| return false; | |||
| } else if (unlessProperty != null && | |||
| t.getProject().getProperty(unlessProperty) != null) { | |||
| } else if (unlessProperty != null | |||
| && t.getProject().getProperty(unlessProperty) != null) { | |||
| return false; | |||
| } | |||
| @@ -681,8 +681,7 @@ public class JUnitTask extends Task { | |||
| // forked test | |||
| File propsFile = | |||
| FileUtils.newFileUtils().createTempFile("junit", ".properties", | |||
| tmpDir != null ? tmpDir : | |||
| getProject().getBaseDir()); | |||
| tmpDir != null ? tmpDir : getProject().getBaseDir()); | |||
| cmd.createArgument().setValue("propsfile=" | |||
| + propsFile.getAbsolutePath()); | |||
| Hashtable p = getProject().getProperties(); | |||
| @@ -178,8 +178,8 @@ public class JUnitTest extends BaseTest implements Cloneable { | |||
| public boolean shouldRun(Project p) { | |||
| if (ifProperty != null && p.getProperty(ifProperty) == null) { | |||
| return false; | |||
| } else if (unlessProperty != null && | |||
| p.getProperty(unlessProperty) != null) { | |||
| } else if (unlessProperty != null | |||
| && p.getProperty(unlessProperty) != null) { | |||
| return false; | |||
| } | |||
| @@ -108,8 +108,8 @@ public class JUnitVersionHelper { | |||
| getNameMethod = t.getClass().getMethod("name", | |||
| new Class [0]); | |||
| } | |||
| if (getNameMethod != null && | |||
| getNameMethod.getReturnType() == String.class) { | |||
| if (getNameMethod != null | |||
| && getNameMethod.getReturnType() == String.class) { | |||
| return (String) getNameMethod.invoke(t, new Object[0]); | |||
| } | |||
| } catch (Throwable e) { | |||
| @@ -278,15 +278,19 @@ public class XMLResultAggregator extends Task implements XMLConstants { | |||
| addTestSuite(rootElement, elem); | |||
| } else { | |||
| // issue a warning. | |||
| log("the file " + files[i] + " is not a valid testsuite XML document", Project.MSG_WARN); | |||
| log("the file " + files[i] | |||
| + " is not a valid testsuite XML document", | |||
| Project.MSG_WARN); | |||
| } | |||
| } catch (SAXException e) { | |||
| // a testcase might have failed and write a zero-length document, | |||
| // It has already failed, but hey.... mm. just put a warning | |||
| log("The file " + files[i] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN); | |||
| log("The file " + files[i] + " is not a valid XML document. " | |||
| + "It is possibly corrupted.", Project.MSG_WARN); | |||
| log(StringUtils.getStackTrace(e), Project.MSG_DEBUG); | |||
| } catch (IOException e) { | |||
| log("Error while accessing file " + files[i] + ": " + e.getMessage(), Project.MSG_ERR); | |||
| log("Error while accessing file " + files[i] + ": " | |||
| + e.getMessage(), Project.MSG_ERR); | |||
| } | |||
| } | |||
| return rootElement; | |||
| @@ -123,7 +123,8 @@ abstract class XalanExecutor { | |||
| xalan1missing.printStackTrace(new PrintWriter(swr)); | |||
| caller.task.log("Didn't find Xalan1.", Project.MSG_DEBUG); | |||
| caller.task.log(swr.toString(), Project.MSG_DEBUG); | |||
| throw new BuildException("Could not find xalan2 nor xalan1 in the classpath. Check http://xml.apache.org/xalan-j"); | |||
| throw new BuildException("Could not find xalan2 nor xalan1 " | |||
| + "in the classpath. Check http://xml.apache.org/xalan-j"); | |||
| } | |||
| } | |||
| String version = getXalanVersion(procVersion); | |||
| @@ -335,7 +335,8 @@ public abstract class AbstractMetamataTask extends Task { | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| ds.scan(); | |||
| String[] f = ds.getIncludedFiles(); | |||
| log(i + ") Adding " + f.length + " files from directory " + ds.getBasedir(), Project.MSG_VERBOSE); | |||
| log(i + ") Adding " + f.length + " files from directory " | |||
| + ds.getBasedir(), Project.MSG_VERBOSE); | |||
| for (int j = 0; j < f.length; j++) { | |||
| String pathname = f[j]; | |||
| if (pathname.endsWith(".java")) { | |||
| @@ -68,10 +68,11 @@ import org.apache.tools.ant.types.Path; | |||
| /** | |||
| * Invokes the Metamata Audit/ Webgain Quality Analyzer on a set of Java files. | |||
| * <p> | |||
| * <i>maudit</i> performs static analysis of the Java source code and byte code files to find and report | |||
| * errors of style and potential problems related to performance, maintenance and robustness. | |||
| * As a convenience, a stylesheet is given in <tt>etc</tt> directory, so that an HTML report | |||
| * can be generated from the XML file. | |||
| * <i>maudit</i> performs static analysis of the Java source code and byte | |||
| * code files to find and report errors of style and potential problems related | |||
| * to performance, maintenance and robustness. As a convenience, a stylesheet | |||
| * is given in <tt>etc</tt> directory, so that an HTML report can be generated | |||
| * from the XML file. | |||
| * | |||
| * @author <a href="mailto:sbailliez@apache.org">Stephane Bailliez</a> | |||
| */ | |||
| @@ -310,10 +311,12 @@ public class MAudit extends AbstractMetamataTask { | |||
| protected void checkOptions() throws BuildException { | |||
| super.checkOptions(); | |||
| if (unused && searchPath == null) { | |||
| throw new BuildException("'searchpath' element must be set when looking for 'unused' declarations."); | |||
| throw new BuildException("'searchpath' element must be set when " | |||
| + "looking for 'unused' declarations."); | |||
| } | |||
| if (!unused && searchPath != null) { | |||
| log("'searchpath' element ignored. 'unused' attribute is disabled.", Project.MSG_WARN); | |||
| log("'searchpath' element ignored. 'unused' attribute is disabled.", | |||
| Project.MSG_WARN); | |||
| } | |||
| if (rulesPath != null) { | |||
| cmdl.createClasspath(getProject()).addExisting(rulesPath); | |||
| @@ -167,18 +167,24 @@ class MAuditStreamHandler implements ExecuteStreamHandler { | |||
| Enumeration keys = auditedFiles.keys(); | |||
| Hashtable filemapping = task.getFileMapping(); | |||
| final Date now = new Date(); | |||
| rootElement.setAttribute("snapshot_created", DateUtils.format(now, DateUtils.ISO8601_DATETIME_PATTERN)); | |||
| rootElement.setAttribute("elapsed_time", String.valueOf(now.getTime() - program_start.getTime())); | |||
| rootElement.setAttribute("program_start", DateUtils.format(now, DateUtils.ISO8601_DATETIME_PATTERN)); | |||
| rootElement.setAttribute("audited", String.valueOf(filemapping.size())); | |||
| rootElement.setAttribute("reported", String.valueOf(auditedFiles.size())); | |||
| rootElement.setAttribute("snapshot_created", | |||
| DateUtils.format(now, DateUtils.ISO8601_DATETIME_PATTERN)); | |||
| rootElement.setAttribute("elapsed_time", | |||
| String.valueOf(now.getTime() - program_start.getTime())); | |||
| rootElement.setAttribute("program_start", | |||
| DateUtils.format(now, DateUtils.ISO8601_DATETIME_PATTERN)); | |||
| rootElement.setAttribute("audited", | |||
| String.valueOf(filemapping.size())); | |||
| rootElement.setAttribute("reported", | |||
| String.valueOf(auditedFiles.size())); | |||
| int errors = 0; | |||
| while (keys.hasMoreElements()) { | |||
| String filepath = (String) keys.nextElement(); | |||
| Vector v = (Vector) auditedFiles.get(filepath); | |||
| String fullclassname = (String) filemapping.get(filepath); | |||
| if (fullclassname == null) { | |||
| task.getProject().log("Could not find class mapping for " + filepath, Project.MSG_WARN); | |||
| task.getProject().log("Could not find class mapping for " | |||
| + filepath, Project.MSG_WARN); | |||
| continue; | |||
| } | |||
| int pos = fullclassname.lastIndexOf('.'); | |||
| @@ -177,11 +177,14 @@ Format Options | |||
| throw new BuildException("Output XML file must be set via 'tofile' attribute."); | |||
| } | |||
| if (path == null && fileSets.size() == 0) { | |||
| throw new BuildException("Must set either paths (path element) or files (fileset element)"); | |||
| throw new BuildException("Must set either paths (path element) " | |||
| + "or files (fileset element)"); | |||
| } | |||
| // I don't accept dirs and files at the same time, I cannot recognize the semantic in the result | |||
| // I don't accept dirs and files at the same time, | |||
| // I cannot recognize the semantic in the result | |||
| if (path != null && fileSets.size() > 0) { | |||
| throw new BuildException("Cannot set paths (path element) and files (fileset element) at the same time"); | |||
| throw new BuildException("Cannot set paths (path element) and " | |||
| + "files (fileset element) at the same time"); | |||
| } | |||
| tmpFile = createTmpFile(); | |||
| } | |||
| @@ -172,7 +172,8 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler { | |||
| attr.addAttribute("", "company", "company", "CDATA", "metamata"); | |||
| attr.addAttribute("", "snapshot_created", "snapshot_created", "CDATA", | |||
| DateUtils.format(now, DateUtils.ISO8601_DATETIME_PATTERN)); | |||
| // attr.addAttribute("", "elapsed_time", "elapsed_time", "CDATA", String.valueOf(now.getTime() - program_start.getTime())); | |||
| // attr.addAttribute("", "elapsed_time", "elapsed_time", "CDATA", | |||
| // String.valueOf(now.getTime() - program_start.getTime())); | |||
| attr.addAttribute("", "program_start", "program_start", "CDATA", | |||
| DateUtils.format(new Date(), DateUtils.ISO8601_DATETIME_PATTERN)); | |||
| metricsHandler.startElement("", "metrics", "metrics", attr); | |||
| @@ -424,7 +425,8 @@ class MetricsElement { | |||
| // there should be exactly 14 tokens (1 name + 13 metrics), if not, there is a problem ! | |||
| if (metrics.size() != 14) { | |||
| throw new ParseException("Could not parse the following line as a metrics: -->" + line + "<--", -1); | |||
| throw new ParseException("Could not parse the following line as " | |||
| + "a metrics: -->" + line + "<--", -1); | |||
| } | |||
| // remove the first token it's made of the indentation string and the | |||
| @@ -226,8 +226,8 @@ public class RExecTask extends Task { | |||
| Calendar endTime = Calendar.getInstance(); | |||
| endTime.add(Calendar.SECOND, timeout.intValue()); | |||
| while (sb.toString().indexOf(s) == -1) { | |||
| while (Calendar.getInstance().before(endTime) && | |||
| is.available() == 0) { | |||
| while (Calendar.getInstance().before(endTime) | |||
| && is.available() == 0) { | |||
| Thread.sleep(250); | |||
| } | |||
| if (is.available() == 0) { | |||
| @@ -270,8 +270,8 @@ public class SetProxy extends Task { | |||
| //for Java1.1 we need to tell the system that the settings are new | |||
| if (settingsChanged && | |||
| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||
| if (settingsChanged | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||
| legacyResetProxySettingsCall(enablingProxy); | |||
| } | |||
| } | |||
| @@ -524,7 +524,7 @@ public class Pvcs extends org.apache.tools.ant.Task { | |||
| * should be set to the bin directory of the PVCS installation containing | |||
| * the executables mentioned before. If this attribute isn't specified the | |||
| * tag expects the executables to be found using the PATH environment variable. | |||
| * @param ws String | |||
| * @param bin PVCS bin directory | |||
| * @todo use a File setter and resolve paths. | |||
| */ | |||
| public void setPvcsbin(String bin) { | |||
| @@ -241,8 +241,8 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { | |||
| // Because of the way I create the full target path, there | |||
| // must be NO slash at the end of targetFolder and folderName | |||
| // However, if the slash or backslash is the only character, leave it alone | |||
| if ((getTargetFolder().endsWith("/") || | |||
| getTargetFolder().endsWith("\\")) | |||
| if ((getTargetFolder().endsWith("/") | |||
| || getTargetFolder().endsWith("\\")) | |||
| && getTargetFolder().length() > 1) { | |||
| setTargetFolder(getTargetFolder().substring(0, getTargetFolder().length() - 1)); | |||
| } | |||
| @@ -453,7 +453,8 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { | |||
| // Replace the projectName in the file's absolute path to the viewName. | |||
| // This makes the root target of a checkout operation equal to: | |||
| // targetFolder + dirName | |||
| StringTokenizer pathTokenizer = new StringTokenizer(rootSourceFolder.getFolderHierarchy(), delim); | |||
| StringTokenizer pathTokenizer | |||
| = new StringTokenizer(rootSourceFolder.getFolderHierarchy(), delim); | |||
| String currentToken = null; | |||
| boolean foundRoot = false; | |||
| @@ -500,7 +501,8 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { | |||
| Folder[] subfolders = f.getSubFolders(); | |||
| for (int i = 0; i < subfolders.length; i++) { | |||
| runFolder(s, p, v, t, subfolders[i], new java.io.File(tgt, subfolders[i].getName())); | |||
| runFolder(s, p, v, t, subfolders[i], | |||
| new java.io.File(tgt, subfolders[i].getName())); | |||
| } | |||
| } | |||
| } | |||
| @@ -881,7 +883,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { | |||
| /** | |||
| * Sets the <CODE>targetFolder</CODE> attribute to the given value. | |||
| * | |||
| * @param target The target path on the local machine to check out to. | |||
| * @param targetFolder The target path on the local machine to check out to. | |||
| * @see #getTargetFolder() | |||
| */ | |||
| public void setTargetFolder(String targetFolder) { | |||
| @@ -988,7 +990,8 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { | |||
| * <BR> | |||
| * Separate multiple inlcude filters by <I>spaces</I> , not commas as Ant | |||
| * uses. For example, if you want to check out all .java and .class\ | |||
| * files, you would put the following line in your program: <CODE>setIncludes("*.java *.class");</CODE> | |||
| * files, you would put the following line in your program: | |||
| * <CODE>setIncludes("*.java *.class");</CODE> | |||
| * Finally, note that filters have no effect on the <B>directories</B> | |||
| * that are scanned; you could not check out files from directories with | |||
| * names beginning only with "build," for instance. Of course, you could | |||
| @@ -1042,7 +1045,8 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { | |||
| * <BR> | |||
| * Separate multiple exlcude filters by <I>spaces</I> , not commas as Ant | |||
| * uses. For example, if you want to check out all files except .XML and | |||
| * .HTML files, you would put the following line in your program: <CODE>setExcludes("*.XML *.HTML");</CODE> | |||
| * .HTML files, you would put the following line in your program: | |||
| * <CODE>setExcludes("*.XML *.HTML");</CODE> | |||
| * Finally, note that filters have no effect on the <B>directories</B> | |||
| * that are scanned; you could not skip over all files in directories | |||
| * whose names begin with "project," for instance. <BR> | |||
| @@ -331,11 +331,9 @@ public class ScriptDef extends Task { | |||
| /** | |||
| * Execute the script. | |||
| * | |||
| * @param scriptConfig the RuntimeConfigurable which contains the attribute | |||
| * definitions for the script task instance. | |||
| * @param attributes collection of attributes | |||
| * | |||
| * @param elements a list of UnknownElements which contain the configuration | |||
| * of the nested elements of the script instance. | |||
| * @param elements a list of nested element values. | |||
| */ | |||
| public void executeScript(Map attributes, Map elements) { | |||
| try { | |||
| @@ -130,7 +130,8 @@ public class CovMerge extends CovBase { | |||
| cmdl.createArgument().setValue(tofile.getPath()); | |||
| } | |||
| LogStreamHandler handler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); | |||
| LogStreamHandler handler | |||
| = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); | |||
| Execute exec = new Execute(handler); | |||
| log(cmdl.describeCommand(), Project.MSG_VERBOSE); | |||
| exec.setCommandline(cmdl.getCommandline()); | |||
| @@ -294,13 +294,15 @@ public class CovReport extends CovBase { | |||
| } | |||
| // use the custom handler for stdin issues | |||
| LogStreamHandler handler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); | |||
| LogStreamHandler handler | |||
| = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN); | |||
| Execute exec = new Execute(handler); | |||
| log(cmdl.describeCommand(), Project.MSG_VERBOSE); | |||
| exec.setCommandline(cmdl.getCommandline()); | |||
| int exitValue = exec.execute(); | |||
| if (exitValue != 0) { | |||
| throw new BuildException("JProbe Coverage Report failed (" + exitValue + ")"); | |||
| throw new BuildException("JProbe Coverage Report failed (" | |||
| + exitValue + ")"); | |||
| } | |||
| log("coveragePath: " + coveragePath, Project.MSG_VERBOSE); | |||
| log("format: " + format, Project.MSG_VERBOSE); | |||
| @@ -396,7 +398,8 @@ public class CovReport extends CovBase { | |||
| Result res = new StreamResult("file:///" + tofile.toString()); | |||
| transformer.transform(src, res); | |||
| } catch (Exception e) { | |||
| throw new BuildException("Error while performing enhanced XML report from file " + tofile, e); | |||
| throw new BuildException("Error while performing enhanced XML " | |||
| + "report from file " + tofile, e); | |||
| } | |||
| } | |||
| } | |||
| @@ -109,7 +109,8 @@ public class ReportFilters { | |||
| result = result && !matcher.matches(methodname); | |||
| } else { | |||
| //not possible | |||
| throw new IllegalArgumentException("Invalid filter element: " + filter.getClass().getName()); | |||
| throw new IllegalArgumentException("Invalid filter element: " | |||
| + filter.getClass().getName()); | |||
| } | |||
| } | |||
| return result; | |||
| @@ -94,7 +94,10 @@ public class XMLReport { | |||
| /** parsed document */ | |||
| private Document report; | |||
| /** mapping of class names to <code>ClassFile</code>s from the reference classpath. It is used to filter the JProbe report. */ | |||
| /** | |||
| * mapping of class names to <code>ClassFile</code>s from the reference | |||
| * classpath. It is used to filter the JProbe report. | |||
| */ | |||
| private Hashtable classFiles; | |||
| /** mapping package name / package node for faster access */ | |||
| @@ -160,7 +163,8 @@ public class XMLReport { | |||
| for (int k = methodlen - 1; k > -1; k--) { | |||
| Element meth = (Element) methods.item(k); | |||
| StringBuffer methodname = new StringBuffer(meth.getAttribute("name")); | |||
| methodname.delete(methodname.toString().indexOf("("), methodname.toString().length()); | |||
| methodname.delete(methodname.toString().indexOf("("), | |||
| methodname.toString().length()); | |||
| String signature = classname + "." + methodname + "()"; | |||
| if (filters.accept(signature)) { | |||
| log("kept method:" + signature); | |||
| @@ -280,8 +284,8 @@ public class XMLReport { | |||
| MethodInfo method = methods[i]; | |||
| String methodSig = getMethodSignature(method); | |||
| Element methodNode = (Element) methodNodeList.get(methodSig); | |||
| if (methodNode != null && | |||
| Utils.isAbstract(method.getAccessFlags())) { | |||
| if (methodNode != null | |||
| && Utils.isAbstract(method.getAccessFlags())) { | |||
| log("\tRemoving abstract method " + methodSig); | |||
| classNode.removeChild(methodNode); | |||
| } | |||
| @@ -441,7 +445,8 @@ public class XMLReport { | |||
| int pkg_total_methods = 0; | |||
| int pkg_hit_lines = 0; | |||
| int pkg_total_lines = 0; | |||
| //System.out.println("Processing package '" + pkgname + "': " + classes.length + " classes"); | |||
| //System.out.println("Processing package '" + pkgname + "': " | |||
| // + classes.length + " classes"); | |||
| for (int j = 0; j < classes.length; j++) { | |||
| Element clazz = classes[j]; | |||
| String classname = clazz.getAttribute("name"); | |||
| @@ -457,7 +462,8 @@ public class XMLReport { | |||
| pkg_hit_lines += Integer.parseInt(covdata.getAttribute("hit_lines")); | |||
| pkg_total_lines += Integer.parseInt(covdata.getAttribute("total_lines")); | |||
| } catch (NumberFormatException e) { | |||
| log("Error parsing '" + classname + "' (" + j + "/" + classes.length + ") in package '" + pkgname + "'"); | |||
| log("Error parsing '" + classname + "' (" + j + "/" | |||
| + classes.length + ") in package '" + pkgname + "'"); | |||
| throw e; | |||
| } | |||
| } | |||
| @@ -493,7 +499,8 @@ public class XMLReport { | |||
| } | |||
| } | |||
| } | |||
| throw new NoSuchElementException("Could not find 'cov.data' element in parent '" + parent.getNodeName() + "'"); | |||
| throw new NoSuchElementException("Could not find 'cov.data' " | |||
| + "element in parent '" + parent.getNodeName() + "'"); | |||
| } | |||
| protected Hashtable getMethods(Element clazz) { | |||
| @@ -340,7 +340,8 @@ final class DirectoryLoader implements ClassPathLoader.FileLoader { | |||
| * @param recurse tells whether or not the listing is recursive. | |||
| * @return the list instance that was passed as the <tt>list</tt> argument. | |||
| */ | |||
| private static Vector listFilesTo(Vector list, File directory, FilenameFilter filter, boolean recurse) { | |||
| private static Vector listFilesTo(Vector list, File directory, | |||
| FilenameFilter filter, boolean recurse) { | |||
| String[] files = directory.list(filter); | |||
| for (int i = 0; i < files.length; i++) { | |||
| list.addElement(new File(directory, files[i])); | |||
| @@ -201,7 +201,8 @@ public class Utils { | |||
| // think about it. | |||
| //ooooops should never happen | |||
| //throw new IllegalArgumentException("Invalid descriptor symbol: '" + i + "' in '" + descriptor + "'"); | |||
| //throw new IllegalArgumentException("Invalid descriptor | |||
| // symbol: '" + i + "' in '" + descriptor + "'"); | |||
| } | |||
| sb.append(dim.toString()); | |||
| return ++i; | |||