git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272441 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -67,8 +67,7 @@ import org.apache.tools.ant.util.FileUtils; | |||||
| * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a> | * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a> | ||||
| */ | */ | ||||
| public abstract class BaseFilterReader | public abstract class BaseFilterReader | ||||
| extends FilterReader | |||||
| { | |||||
| extends FilterReader { | |||||
| /** Have the parameters passed been interpreted? */ | /** Have the parameters passed been interpreted? */ | ||||
| private boolean initialized = false; | private boolean initialized = false; | ||||
| @@ -65,8 +65,7 @@ import org.apache.tools.ant.types.Parameterizable; | |||||
| */ | */ | ||||
| public abstract class BaseParamFilterReader | public abstract class BaseParamFilterReader | ||||
| extends BaseFilterReader | extends BaseFilterReader | ||||
| implements Parameterizable | |||||
| { | |||||
| implements Parameterizable { | |||||
| /** The passed in parameter array. */ | /** The passed in parameter array. */ | ||||
| private Parameter[] parameters; | private Parameter[] parameters; | ||||
| @@ -86,8 +86,7 @@ import java.lang.reflect.Method; | |||||
| */ | */ | ||||
| public final class ClassConstants | public final class ClassConstants | ||||
| extends BaseFilterReader | extends BaseFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** Data that must be read from, if not null. */ | /** Data that must be read from, if not null. */ | ||||
| private String queuedData = null; | private String queuedData = null; | ||||
| @@ -74,8 +74,7 @@ import org.apache.tools.ant.Project; | |||||
| */ | */ | ||||
| public final class ExpandProperties | public final class ExpandProperties | ||||
| extends BaseFilterReader | extends BaseFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** Data that must be read from, if not null. */ | /** Data that must be read from, if not null. */ | ||||
| private String queuedData = null; | private String queuedData = null; | ||||
| @@ -76,8 +76,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| */ | */ | ||||
| public final class HeadFilter | public final class HeadFilter | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** Lines key to represent the number of lines to be returned. */ | /** Lines key to represent the number of lines to be returned. */ | ||||
| private static final String LINES_KEY = "lines"; | private static final String LINES_KEY = "lines"; | ||||
| @@ -84,8 +84,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| */ | */ | ||||
| public final class LineContains | public final class LineContains | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** contains key */ | /** contains key */ | ||||
| private static final String CONTAINS_KEY = "contains"; | private static final String CONTAINS_KEY = "contains"; | ||||
| @@ -84,8 +84,7 @@ import org.apache.tools.ant.util.regexp.Regexp; | |||||
| */ | */ | ||||
| public final class LineContainsRegExp | public final class LineContainsRegExp | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** contains key */ | /** contains key */ | ||||
| private static final String REGEXP_KEY = "regexp"; | private static final String REGEXP_KEY = "regexp"; | ||||
| @@ -76,8 +76,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| */ | */ | ||||
| public final class PrefixLines | public final class PrefixLines | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** prefix key */ | /** prefix key */ | ||||
| private static final String PREFIX_KEY = "prefix"; | private static final String PREFIX_KEY = "prefix"; | ||||
| @@ -81,8 +81,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| */ | */ | ||||
| public final class ReplaceTokens | public final class ReplaceTokens | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** Default begin token character. */ | /** Default begin token character. */ | ||||
| private static final char DEFAULT_BEGIN_TOKEN = '@'; | private static final char DEFAULT_BEGIN_TOKEN = '@'; | ||||
| @@ -63,8 +63,7 @@ import java.io.StringReader; | |||||
| * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a> | * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a> | ||||
| */ | */ | ||||
| public class StringInputStream | public class StringInputStream | ||||
| extends InputStream | |||||
| { | |||||
| extends InputStream { | |||||
| /** Source string is stored as a StringReader */ | /** Source string is stored as a StringReader */ | ||||
| private StringReader in; | private StringReader in; | ||||
| @@ -65,8 +65,7 @@ import java.io.Reader; | |||||
| */ | */ | ||||
| public final class StripJavaComments | public final class StripJavaComments | ||||
| extends BaseFilterReader | extends BaseFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| private int readAheadCh = -1; | private int readAheadCh = -1; | ||||
| private boolean inString = false; | private boolean inString = false; | ||||
| @@ -72,8 +72,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| */ | */ | ||||
| public final class StripLineBreaks | public final class StripLineBreaks | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** | /** | ||||
| * Linebreaks. What do to on funny IBM mainframes with odd line endings? | * Linebreaks. What do to on funny IBM mainframes with odd line endings? | ||||
| */ | */ | ||||
| @@ -87,8 +87,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| */ | */ | ||||
| public final class StripLineComments | public final class StripLineComments | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** The type that param recognizes to set the comments. */ | /** The type that param recognizes to set the comments. */ | ||||
| private static final String COMMENTS_KEY = "comment"; | private static final String COMMENTS_KEY = "comment"; | ||||
| @@ -76,8 +76,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| */ | */ | ||||
| public final class TabsToSpaces | public final class TabsToSpaces | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** The default tab length is 8 */ | /** The default tab length is 8 */ | ||||
| private static final int DEFAULT_TAB_LENGTH = 8; | private static final int DEFAULT_TAB_LENGTH = 8; | ||||
| @@ -76,8 +76,7 @@ import org.apache.tools.ant.types.Parameter; | |||||
| */ | */ | ||||
| public final class TailFilter | public final class TailFilter | ||||
| extends BaseParamFilterReader | extends BaseParamFilterReader | ||||
| implements ChainableReader | |||||
| { | |||||
| implements ChainableReader { | |||||
| /** The name that param recognizes to set the number of lines. */ | /** The name that param recognizes to set the number of lines. */ | ||||
| private static final String LINES_KEY = "lines"; | private static final String LINES_KEY = "lines"; | ||||
| @@ -330,36 +330,29 @@ public abstract class AbstractCvsTask extends Task { | |||||
| + "Command line was [" | + "Command line was [" | ||||
| + actualCommandLine + "]", location); | + actualCommandLine + "]", location); | ||||
| } | } | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException(e, location); | throw new BuildException(e, location); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | ||||
| } | } | ||||
| } | |||||
| catch (BuildException e) { | |||||
| } catch (BuildException e) { | |||||
| if (failOnError) { | if (failOnError) { | ||||
| throw(e); | throw(e); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| Throwable t = e.getException(); | Throwable t = e.getException(); | ||||
| if (t == null) { | if (t == null) { | ||||
| t = e; | t = e; | ||||
| } | } | ||||
| log("Caught exception: " + t.getMessage(), Project.MSG_WARN); | log("Caught exception: " + t.getMessage(), Project.MSG_WARN); | ||||
| } | } | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException(e, location); | throw new BuildException(e, location); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | ||||
| } | } | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| // | // | ||||
| // condition used to be if(output == null) outputStream.close(). This is | // condition used to be if(output == null) outputStream.close(). This is | ||||
| // not appropriate. Check if the stream itself is not null, then close(). | // not appropriate. Check if the stream itself is not null, then close(). | ||||
| @@ -607,8 +600,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| this.configureCommandline(c); | this.configureCommandline(c); | ||||
| if (insertAtStart) { | if (insertAtStart) { | ||||
| vecCommandlines.insertElementAt(c, 0); | vecCommandlines.insertElementAt(c, 0); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| vecCommandlines.addElement(c); | vecCommandlines.addElement(c); | ||||
| } | } | ||||
| } | } | ||||
| @@ -216,8 +216,7 @@ public class Ant extends Task { | |||||
| logger.setOutputPrintStream(out); | logger.setOutputPrintStream(out); | ||||
| logger.setErrorPrintStream(out); | logger.setErrorPrintStream(out); | ||||
| newProject.addBuildListener(logger); | newProject.addBuildListener(logger); | ||||
| } | |||||
| catch (IOException ex) { | |||||
| } catch (IOException ex) { | |||||
| log("Ant: Can't set output to " + output); | log("Ant: Can't set output to " + output); | ||||
| } | } | ||||
| } | } | ||||
| @@ -90,8 +90,7 @@ public class BZip2 extends Pack { | |||||
| try { | try { | ||||
| // close up | // close up | ||||
| zOut.close(); | zOut.close(); | ||||
| } | |||||
| catch (IOException e) {} | |||||
| } catch (IOException e) {} | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -182,8 +182,7 @@ public class CallTarget extends Task { | |||||
| protected void handleOutput(String line) { | protected void handleOutput(String line) { | ||||
| if (callee != null) { | if (callee != null) { | ||||
| callee.handleOutput(line); | callee.handleOutput(line); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| super.handleOutput(line); | super.handleOutput(line); | ||||
| } | } | ||||
| } | } | ||||
| @@ -196,8 +195,7 @@ public class CallTarget extends Task { | |||||
| protected void handleErrorOutput(String line) { | protected void handleErrorOutput(String line) { | ||||
| if (callee != null) { | if (callee != null) { | ||||
| callee.handleErrorOutput(line); | callee.handleErrorOutput(line); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| super.handleErrorOutput(line); | super.handleErrorOutput(line); | ||||
| } | } | ||||
| } | } | ||||
| @@ -227,8 +227,7 @@ public class DependSet extends MatchingTask { | |||||
| log(targetFiles[i] + " does not exist.", Project.MSG_VERBOSE); | log(targetFiles[i] + " does not exist.", Project.MSG_VERBOSE); | ||||
| upToDate = false; | upToDate = false; | ||||
| continue; | continue; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| allTargets.addElement(dest); | allTargets.addElement(dest); | ||||
| } | } | ||||
| if (dest.lastModified() > now) { | if (dest.lastModified() > now) { | ||||
| @@ -118,8 +118,7 @@ public class Ear extends Jar { | |||||
| protected void initZipOutputStream(ZipOutputStream zOut) | protected void initZipOutputStream(ZipOutputStream zOut) | ||||
| throws IOException, BuildException | |||||
| { | |||||
| throws IOException, BuildException { | |||||
| // If no webxml file is specified, it's an error. | // If no webxml file is specified, it's an error. | ||||
| if (deploymentDescriptor == null && !isInUpdateMode()) { | if (deploymentDescriptor == null && !isInUpdateMode()) { | ||||
| throw new BuildException("appxml attribute is required", location); | throw new BuildException("appxml attribute is required", location); | ||||
| @@ -129,8 +128,7 @@ public class Ear extends Jar { | |||||
| } | } | ||||
| protected void zipFile(File file, ZipOutputStream zOut, String vPath) | protected void zipFile(File file, ZipOutputStream zOut, String vPath) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| // If the file being added is META-INF/application.xml, we | // If the file being added is META-INF/application.xml, we | ||||
| // warn if it's not the one specified in the "appxml" | // warn if it's not the one specified in the "appxml" | ||||
| // attribute - or if it's being added twice, meaning the same | // attribute - or if it's being added twice, meaning the same | ||||
| @@ -120,8 +120,7 @@ public class Exec extends Task { | |||||
| if (!dir.equals(project.resolveFile("."))) { | if (!dir.equals(project.resolveFile("."))) { | ||||
| if (myos.toLowerCase().indexOf("nt") >= 0) { | if (myos.toLowerCase().indexOf("nt") >= 0) { | ||||
| command = "cmd /c cd " + dir + " && " + command; | command = "cmd /c cd " + dir + " && " + command; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| String ant = project.getProperty("ant.home"); | String ant = project.getProperty("ant.home"); | ||||
| if (ant == null) { | if (ant == null) { | ||||
| throw new BuildException("Property 'ant.home' not found", location); | throw new BuildException("Property 'ant.home' not found", location); | ||||
| @@ -237,9 +236,7 @@ public class Exec extends Task { | |||||
| this.parent = parent; | this.parent = parent; | ||||
| } | } | ||||
| public void pumpStream() | |||||
| throws IOException | |||||
| { | |||||
| public void pumpStream() throws IOException { | |||||
| byte[] buf = new byte[BUFFER_SIZE]; | byte[] buf = new byte[BUFFER_SIZE]; | ||||
| if (!endOfStream) { | if (!endOfStream) { | ||||
| String line = din.readLine(); | String line = din.readLine(); | ||||
| @@ -113,28 +113,24 @@ public class Execute { | |||||
| // Try using a JDK 1.3 launcher | // Try using a JDK 1.3 launcher | ||||
| try { | try { | ||||
| vmLauncher = new Java13CommandLauncher(); | vmLauncher = new Java13CommandLauncher(); | ||||
| } | |||||
| catch (NoSuchMethodException exc) { | |||||
| } catch (NoSuchMethodException exc) { | |||||
| // Ignore and keep trying | // Ignore and keep trying | ||||
| } | } | ||||
| if (Os.isFamily("mac")) { | if (Os.isFamily("mac")) { | ||||
| // Mac | // Mac | ||||
| shellLauncher = new MacCommandLauncher(new CommandLauncher()); | shellLauncher = new MacCommandLauncher(new CommandLauncher()); | ||||
| } | |||||
| else if (Os.isFamily("os/2")) { | |||||
| } else if (Os.isFamily("os/2")) { | |||||
| // OS/2 - use same mechanism as Windows 2000 | // OS/2 - use same mechanism as Windows 2000 | ||||
| shellLauncher = new WinNTCommandLauncher(new CommandLauncher()); | shellLauncher = new WinNTCommandLauncher(new CommandLauncher()); | ||||
| } | |||||
| else if (Os.isFamily("windows")) { | |||||
| } else if (Os.isFamily("windows")) { | |||||
| // Windows. Need to determine which JDK we're running in | // Windows. Need to determine which JDK we're running in | ||||
| CommandLauncher baseLauncher; | CommandLauncher baseLauncher; | ||||
| if (System.getProperty("java.version").startsWith("1.1")) { | if (System.getProperty("java.version").startsWith("1.1")) { | ||||
| // JDK 1.1 | // JDK 1.1 | ||||
| baseLauncher = new Java11CommandLauncher(); | baseLauncher = new Java11CommandLauncher(); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // JDK 1.2 | // JDK 1.2 | ||||
| baseLauncher = new CommandLauncher(); | baseLauncher = new CommandLauncher(); | ||||
| } | } | ||||
| @@ -142,27 +138,23 @@ public class Execute { | |||||
| if (!Os.isFamily("win9x")) { | if (!Os.isFamily("win9x")) { | ||||
| // Windows XP/2000/NT | // Windows XP/2000/NT | ||||
| shellLauncher = new WinNTCommandLauncher(baseLauncher); | shellLauncher = new WinNTCommandLauncher(baseLauncher); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // Windows 98/95 - need to use an auxiliary script | // Windows 98/95 - need to use an auxiliary script | ||||
| shellLauncher = new ScriptCommandLauncher("bin/antRun.bat", baseLauncher); | shellLauncher = new ScriptCommandLauncher("bin/antRun.bat", baseLauncher); | ||||
| } | } | ||||
| } | |||||
| else if (Os.isFamily("netware")) { | |||||
| } else if (Os.isFamily("netware")) { | |||||
| // NetWare. Need to determine which JDK we're running in | // NetWare. Need to determine which JDK we're running in | ||||
| CommandLauncher baseLauncher; | CommandLauncher baseLauncher; | ||||
| if (System.getProperty("java.version").startsWith("1.1")) { | if (System.getProperty("java.version").startsWith("1.1")) { | ||||
| // JDK 1.1 | // JDK 1.1 | ||||
| baseLauncher = new Java11CommandLauncher(); | baseLauncher = new Java11CommandLauncher(); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // JDK 1.2 | // JDK 1.2 | ||||
| baseLauncher = new CommandLauncher(); | baseLauncher = new CommandLauncher(); | ||||
| } | } | ||||
| shellLauncher = new PerlScriptCommandLauncher("bin/antRun.pl", baseLauncher); | shellLauncher = new PerlScriptCommandLauncher("bin/antRun.pl", baseLauncher); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // Generic | // Generic | ||||
| shellLauncher = new ScriptCommandLauncher("bin/antRun", new CommandLauncher()); | shellLauncher = new ScriptCommandLauncher("bin/antRun", new CommandLauncher()); | ||||
| } | } | ||||
| @@ -198,12 +190,10 @@ public class Execute { | |||||
| // contain embedded new lines). | // contain embedded new lines). | ||||
| if (var == null) { | if (var == null) { | ||||
| var = lineSep + line; | var = lineSep + line; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| var += lineSep + line; | var += lineSep + line; | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // New env var...append the previous one if we have it. | // New env var...append the previous one if we have it. | ||||
| if (var != null) { | if (var != null) { | ||||
| procEnvironment.addElement(var); | procEnvironment.addElement(var); | ||||
| @@ -215,8 +205,7 @@ public class Execute { | |||||
| if (var != null) { | if (var != null) { | ||||
| procEnvironment.addElement(var); | procEnvironment.addElement(var); | ||||
| } | } | ||||
| } | |||||
| catch (java.io.IOException exc) { | |||||
| } catch (java.io.IOException exc) { | |||||
| exc.printStackTrace(); | exc.printStackTrace(); | ||||
| // Just try to see how much we got | // Just try to see how much we got | ||||
| } | } | ||||
| @@ -229,31 +218,26 @@ public class Execute { | |||||
| // Not sure | // Not sure | ||||
| String[] cmd = {"cmd", "/c", "set" }; | String[] cmd = {"cmd", "/c", "set" }; | ||||
| return cmd; | return cmd; | ||||
| } | |||||
| else if (Os.isFamily("windows")) { | |||||
| } else if (Os.isFamily("windows")) { | |||||
| // Determine if we're running under XP/2000/NT or 98/95 | // Determine if we're running under XP/2000/NT or 98/95 | ||||
| if (!Os.isFamily("win9x")) { | if (!Os.isFamily("win9x")) { | ||||
| // Windows XP/2000/NT | // Windows XP/2000/NT | ||||
| String[] cmd = {"cmd", "/c", "set" }; | String[] cmd = {"cmd", "/c", "set" }; | ||||
| return cmd; | return cmd; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // Windows 98/95 | // Windows 98/95 | ||||
| String[] cmd = {"command.com", "/c", "set" }; | String[] cmd = {"command.com", "/c", "set" }; | ||||
| return cmd; | return cmd; | ||||
| } | } | ||||
| } | |||||
| else if (Os.isFamily("unix")) { | |||||
| } else if (Os.isFamily("unix")) { | |||||
| // Generic UNIX | // Generic UNIX | ||||
| // Alternatively one could use: /bin/sh -c env | // Alternatively one could use: /bin/sh -c env | ||||
| String[] cmd = {"/usr/bin/env"}; | String[] cmd = {"/usr/bin/env"}; | ||||
| return cmd; | return cmd; | ||||
| } | |||||
| else if (Os.isFamily("netware")) { | |||||
| } else if (Os.isFamily("netware")) { | |||||
| String[] cmd = {"env"}; | String[] cmd = {"env"}; | ||||
| return cmd; | return cmd; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // MAC OS 9 and previous | // MAC OS 9 and previous | ||||
| // TODO: I have no idea how to get it, someone must fix it | // TODO: I have no idea how to get it, someone must fix it | ||||
| String[] cmd = null; | String[] cmd = null; | ||||
| @@ -528,8 +512,7 @@ public class Execute { | |||||
| throw new BuildException(cmdline[0] | throw new BuildException(cmdline[0] | ||||
| + " failed with return code " + retval, task.getLocation()); | + " failed with return code " + retval, task.getLocation()); | ||||
| } | } | ||||
| } | |||||
| catch (java.io.IOException exc) { | |||||
| } catch (java.io.IOException exc) { | |||||
| throw new BuildException("Could not launch " + cmdline[0] + ": " | throw new BuildException("Could not launch " + cmdline[0] + ": " | ||||
| + exc, task.getLocation()); | + exc, task.getLocation()); | ||||
| } | } | ||||
| @@ -540,8 +523,7 @@ public class Execute { | |||||
| * a general purpose command launcher which can only launch commands in | * a general purpose command launcher which can only launch commands in | ||||
| * the current working directory. | * the current working directory. | ||||
| */ | */ | ||||
| private static class CommandLauncher | |||||
| { | |||||
| private static class CommandLauncher { | |||||
| /** | /** | ||||
| * Launches the given command in a new process. | * Launches the given command in a new process. | ||||
| * | * | ||||
| @@ -610,10 +592,8 @@ public class Execute { | |||||
| * A command launcher for JDK/JRE 1.3 (and higher). Uses the built-in | * A command launcher for JDK/JRE 1.3 (and higher). Uses the built-in | ||||
| * Runtime.exec() command | * Runtime.exec() command | ||||
| */ | */ | ||||
| private static class Java13CommandLauncher extends CommandLauncher | |||||
| { | |||||
| public Java13CommandLauncher() throws NoSuchMethodException | |||||
| { | |||||
| private static class Java13CommandLauncher extends CommandLauncher { | |||||
| public Java13CommandLauncher() throws NoSuchMethodException { | |||||
| // Locate method Runtime.exec(String[] cmdarray, | // Locate method Runtime.exec(String[] cmdarray, | ||||
| // String[] envp, File dir) | // String[] envp, File dir) | ||||
| _execWithCWD = Runtime.class.getMethod("exec", | _execWithCWD = Runtime.class.getMethod("exec", | ||||
| @@ -624,9 +604,8 @@ public class Execute { | |||||
| * Launches the given command in a new process, in the given working | * Launches the given command in a new process, in the given working | ||||
| * directory | * directory | ||||
| */ | */ | ||||
| public Process exec(Project project, String[] cmd, String[] env, File workingDir) | |||||
| throws IOException | |||||
| { | |||||
| public Process exec(Project project, String[] cmd, String[] env, | |||||
| File workingDir) throws IOException { | |||||
| try { | try { | ||||
| if (project != null) { | if (project != null) { | ||||
| project.log("Execute:Java13CommandLauncher: " + | project.log("Execute:Java13CommandLauncher: " + | ||||
| @@ -635,20 +614,16 @@ public class Execute { | |||||
| Object[] arguments = { cmd, env, workingDir }; | Object[] arguments = { cmd, env, workingDir }; | ||||
| return (Process) _execWithCWD.invoke(Runtime.getRuntime(), | return (Process) _execWithCWD.invoke(Runtime.getRuntime(), | ||||
| arguments); | arguments); | ||||
| } | |||||
| catch (InvocationTargetException exc) { | |||||
| } catch (InvocationTargetException exc) { | |||||
| Throwable realexc = exc.getTargetException(); | Throwable realexc = exc.getTargetException(); | ||||
| if (realexc instanceof ThreadDeath) { | if (realexc instanceof ThreadDeath) { | ||||
| throw (ThreadDeath) realexc; | throw (ThreadDeath) realexc; | ||||
| } | |||||
| else if (realexc instanceof IOException) { | |||||
| } else if (realexc instanceof IOException) { | |||||
| throw (IOException) realexc; | throw (IOException) realexc; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| throw new BuildException("Unable to execute command", realexc); | throw new BuildException("Unable to execute command", realexc); | ||||
| } | } | ||||
| } | |||||
| catch (Exception exc) { | |||||
| } catch (Exception exc) { | |||||
| // IllegalAccess, IllegalArgument, ClassCast | // IllegalAccess, IllegalArgument, ClassCast | ||||
| throw new BuildException("Unable to execute command", exc); | throw new BuildException("Unable to execute command", exc); | ||||
| } | } | ||||
| @@ -662,10 +637,8 @@ public class Execute { | |||||
| * | * | ||||
| * Sub-classes override exec(args, env, workdir) | * Sub-classes override exec(args, env, workdir) | ||||
| */ | */ | ||||
| private static class CommandLauncherProxy extends CommandLauncher | |||||
| { | |||||
| CommandLauncherProxy(CommandLauncher launcher) | |||||
| { | |||||
| private static class CommandLauncherProxy extends CommandLauncher { | |||||
| CommandLauncherProxy(CommandLauncher launcher) { | |||||
| _launcher = launcher; | _launcher = launcher; | ||||
| } | } | ||||
| @@ -673,8 +646,8 @@ public class Execute { | |||||
| * Launches the given command in a new process. Delegates this | * Launches the given command in a new process. Delegates this | ||||
| * method to the proxied launcher | * method to the proxied launcher | ||||
| */ | */ | ||||
| public Process exec(Project project, String[] cmd, String[] env) throws IOException | |||||
| { | |||||
| public Process exec(Project project, String[] cmd, String[] env) | |||||
| throws IOException { | |||||
| return _launcher.exec(project, cmd, env); | return _launcher.exec(project, cmd, env); | ||||
| } | } | ||||
| @@ -686,10 +659,8 @@ public class Execute { | |||||
| * launching commands in directories other than the current working | * launching commands in directories other than the current working | ||||
| * directory. | * directory. | ||||
| */ | */ | ||||
| private static class WinNTCommandLauncher extends CommandLauncherProxy | |||||
| { | |||||
| WinNTCommandLauncher(CommandLauncher launcher) | |||||
| { | |||||
| private static class WinNTCommandLauncher extends CommandLauncherProxy { | |||||
| WinNTCommandLauncher(CommandLauncher launcher) { | |||||
| super(launcher); | super(launcher); | ||||
| } | } | ||||
| @@ -697,8 +668,8 @@ public class Execute { | |||||
| * Launches the given command in a new process, in the given working | * Launches the given command in a new process, in the given working | ||||
| * directory. | * directory. | ||||
| */ | */ | ||||
| public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException | |||||
| { | |||||
| public Process exec(Project project, String[] cmd, String[] env, | |||||
| File workingDir) throws IOException { | |||||
| File commandDir = workingDir; | File commandDir = workingDir; | ||||
| if (workingDir == null) { | if (workingDir == null) { | ||||
| if (project != null) { | if (project != null) { | ||||
| @@ -728,10 +699,8 @@ public class Execute { | |||||
| * A command launcher for Mac that uses a dodgy mechanism to change | * A command launcher for Mac that uses a dodgy mechanism to change | ||||
| * working directory before launching commands. | * working directory before launching commands. | ||||
| */ | */ | ||||
| private static class MacCommandLauncher extends CommandLauncherProxy | |||||
| { | |||||
| MacCommandLauncher(CommandLauncher launcher) | |||||
| { | |||||
| private static class MacCommandLauncher extends CommandLauncherProxy { | |||||
| MacCommandLauncher(CommandLauncher launcher) { | |||||
| super(launcher); | super(launcher); | ||||
| } | } | ||||
| @@ -739,8 +708,8 @@ public class Execute { | |||||
| * Launches the given command in a new process, in the given working | * Launches the given command in a new process, in the given working | ||||
| * directory | * directory | ||||
| */ | */ | ||||
| public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException | |||||
| { | |||||
| public Process exec(Project project, String[] cmd, String[] env, | |||||
| File workingDir) throws IOException { | |||||
| if (workingDir == null) { | if (workingDir == null) { | ||||
| return exec(project, cmd, env); | return exec(project, cmd, env); | ||||
| } | } | ||||
| @@ -748,8 +717,7 @@ public class Execute { | |||||
| System.getProperties().put("user.dir", workingDir.getAbsolutePath()); | System.getProperties().put("user.dir", workingDir.getAbsolutePath()); | ||||
| try { | try { | ||||
| return exec(project, cmd, env); | return exec(project, cmd, env); | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| System.getProperties().put("user.dir", antWorkingDirectory); | System.getProperties().put("user.dir", antWorkingDirectory); | ||||
| } | } | ||||
| } | } | ||||
| @@ -759,10 +727,8 @@ public class Execute { | |||||
| * A command launcher that uses an auxiliary script to launch commands | * A command launcher that uses an auxiliary script to launch commands | ||||
| * in directories other than the current working directory. | * in directories other than the current working directory. | ||||
| */ | */ | ||||
| private static class ScriptCommandLauncher extends CommandLauncherProxy | |||||
| { | |||||
| ScriptCommandLauncher(String script, CommandLauncher launcher) | |||||
| { | |||||
| private static class ScriptCommandLauncher extends CommandLauncherProxy { | |||||
| ScriptCommandLauncher(String script, CommandLauncher launcher) { | |||||
| super(launcher); | super(launcher); | ||||
| _script = script; | _script = script; | ||||
| } | } | ||||
| @@ -771,8 +737,8 @@ public class Execute { | |||||
| * Launches the given command in a new process, in the given working | * Launches the given command in a new process, in the given working | ||||
| * directory | * directory | ||||
| */ | */ | ||||
| public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException | |||||
| { | |||||
| public Process exec(Project project, String[] cmd, String[] env, | |||||
| File workingDir) throws IOException { | |||||
| if (project == null) { | if (project == null) { | ||||
| if (workingDir == null) { | if (workingDir == null) { | ||||
| return exec(project, cmd, env); | return exec(project, cmd, env); | ||||
| @@ -783,7 +749,8 @@ public class Execute { | |||||
| // Locate the auxiliary script | // Locate the auxiliary script | ||||
| String antHome = project.getProperty("ant.home"); | String antHome = project.getProperty("ant.home"); | ||||
| if (antHome == null) { | if (antHome == null) { | ||||
| throw new IOException("Cannot locate antRun script: Property 'ant.home' not found"); | |||||
| throw new IOException("Cannot locate antRun script: " | |||||
| + "Property 'ant.home' not found"); | |||||
| } | } | ||||
| String antRun = project.resolveFile(antHome + File.separator + _script).toString(); | String antRun = project.resolveFile(antHome + File.separator + _script).toString(); | ||||
| @@ -808,10 +775,9 @@ public class Execute { | |||||
| * A command launcher that uses an auxiliary perl script to launch commands | * A command launcher that uses an auxiliary perl script to launch commands | ||||
| * in directories other than the current working directory. | * in directories other than the current working directory. | ||||
| */ | */ | ||||
| private static class PerlScriptCommandLauncher extends CommandLauncherProxy | |||||
| { | |||||
| PerlScriptCommandLauncher(String script, CommandLauncher launcher) | |||||
| { | |||||
| private static class PerlScriptCommandLauncher | |||||
| extends CommandLauncherProxy { | |||||
| PerlScriptCommandLauncher(String script, CommandLauncher launcher) { | |||||
| super(launcher); | super(launcher); | ||||
| _script = script; | _script = script; | ||||
| } | } | ||||
| @@ -820,19 +786,21 @@ public class Execute { | |||||
| * Launches the given command in a new process, in the given working | * Launches the given command in a new process, in the given working | ||||
| * directory | * directory | ||||
| */ | */ | ||||
| public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException | |||||
| { | |||||
| public Process exec(Project project, String[] cmd, String[] env, | |||||
| File workingDir) throws IOException { | |||||
| if (project == null) { | if (project == null) { | ||||
| if (workingDir == null) { | if (workingDir == null) { | ||||
| return exec(project, cmd, env); | return exec(project, cmd, env); | ||||
| } | } | ||||
| throw new IOException("Cannot locate antRun script: No project provided"); | |||||
| throw new IOException("Cannot locate antRun script: " | |||||
| + "No project provided"); | |||||
| } | } | ||||
| // Locate the auxiliary script | // Locate the auxiliary script | ||||
| String antHome = project.getProperty("ant.home"); | String antHome = project.getProperty("ant.home"); | ||||
| if (antHome == null) { | if (antHome == null) { | ||||
| throw new IOException("Cannot locate antRun script: Property 'ant.home' not found"); | |||||
| throw new IOException("Cannot locate antRun script: " | |||||
| + "Property 'ant.home' not found"); | |||||
| } | } | ||||
| String antRun = project.resolveFile(antHome + File.separator + _script).toString(); | String antRun = project.resolveFile(antHome + File.separator + _script).toString(); | ||||
| @@ -166,8 +166,7 @@ public class Expand extends MatchingTask { | |||||
| if (zis != null) { | if (zis != null) { | ||||
| try { | try { | ||||
| zis.close(); | zis.close(); | ||||
| } | |||||
| catch (IOException e) {} | |||||
| } catch (IOException e) {} | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -455,8 +455,7 @@ public class FixCRLF extends MatchingTask { | |||||
| // End of multiLineComment on this line | // End of multiLineComment on this line | ||||
| endComment += 2; // Include the end token | endComment += 2; // Include the end token | ||||
| lines.setState(LOOKING); | lines.setState(LOOKING); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| endComment = linelen; | endComment = linelen; | ||||
| } | } | ||||
| @@ -489,8 +488,7 @@ public class FixCRLF extends MatchingTask { | |||||
| tablength - | tablength - | ||||
| (line.getColumn() | (line.getColumn() | ||||
| % tablength)); | % tablength)); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| line.incColumn(); | line.incColumn(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -548,8 +546,7 @@ public class FixCRLF extends MatchingTask { | |||||
| try { | try { | ||||
| lines.close(); | lines.close(); | ||||
| lines = null; | lines = null; | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| throw new BuildException("Unable to close source file " | throw new BuildException("Unable to close source file " | ||||
| + srcFile); | + srcFile); | ||||
| } | } | ||||
| @@ -627,8 +624,7 @@ public class FixCRLF extends MatchingTask { | |||||
| * before the terminator is found. | * before the terminator is found. | ||||
| */ | */ | ||||
| private void nextStateChange(OneLiner.BufferLine bufline) | private void nextStateChange(OneLiner.BufferLine bufline) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| int eol = bufline.length(); | int eol = bufline.length(); | ||||
| int ptr = bufline.getNext(); | int ptr = bufline.getNext(); | ||||
| @@ -650,8 +646,7 @@ public class FixCRLF extends MatchingTask { | |||||
| bufline.setState(IN_MULTI_COMMENT); | bufline.setState(IN_MULTI_COMMENT); | ||||
| bufline.setLookahead(--ptr); | bufline.setLookahead(--ptr); | ||||
| return; | return; | ||||
| } | |||||
| else if (bufline.getChar(ptr) == '/') { | |||||
| } else if (bufline.getChar(ptr) == '/') { | |||||
| bufline.setState(IN_SINGLE_COMMENT); | bufline.setState(IN_SINGLE_COMMENT); | ||||
| bufline.setLookahead(--ptr); | bufline.setLookahead(--ptr); | ||||
| return; | return; | ||||
| @@ -680,8 +675,7 @@ public class FixCRLF extends MatchingTask { | |||||
| * before the terminator is found. | * before the terminator is found. | ||||
| */ | */ | ||||
| private void endOfCharConst(OneLiner.BufferLine bufline, char terminator) | private void endOfCharConst(OneLiner.BufferLine bufline, char terminator) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| int ptr = bufline.getNext(); | int ptr = bufline.getNext(); | ||||
| int eol = bufline.length(); | int eol = bufline.length(); | ||||
| char c; | char c; | ||||
| @@ -689,8 +683,7 @@ public class FixCRLF extends MatchingTask { | |||||
| while (ptr < eol) { | while (ptr < eol) { | ||||
| if ((c = bufline.getChar(ptr++)) == '\\') { | if ((c = bufline.getChar(ptr++)) == '\\') { | ||||
| ptr++; | ptr++; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| if (c == terminator) { | if (c == terminator) { | ||||
| bufline.setLookahead(ptr); | bufline.setLookahead(ptr); | ||||
| return; | return; | ||||
| @@ -714,8 +707,7 @@ public class FixCRLF extends MatchingTask { | |||||
| * @param BufferedWriter outWriter Sink for the processed string | * @param BufferedWriter outWriter Sink for the processed string | ||||
| */ | */ | ||||
| private void notInConstant(OneLiner.BufferLine bufline, int end, | private void notInConstant(OneLiner.BufferLine bufline, int end, | ||||
| BufferedWriter outWriter) | |||||
| { | |||||
| BufferedWriter outWriter) { | |||||
| // N.B. both column and string index are zero-based | // N.B. both column and string index are zero-based | ||||
| // Process a string not part of a constant; | // Process a string not part of a constant; | ||||
| // i.e. convert tabs<->spaces as required | // i.e. convert tabs<->spaces as required | ||||
| @@ -747,8 +739,7 @@ public class FixCRLF extends MatchingTask { | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| throw new BuildException(e); | throw new BuildException(e); | ||||
| } // end of try-catch | } // end of try-catch | ||||
| } | |||||
| else { // tabs == ADD | |||||
| } else { // tabs == ADD | |||||
| int tabCol; | int tabCol; | ||||
| linebuf2.setLength(0); | linebuf2.setLength(0); | ||||
| place = 0; | place = 0; | ||||
| @@ -780,8 +771,7 @@ public class FixCRLF extends MatchingTask { | |||||
| linebuf2.append(linestring.substring( | linebuf2.append(linestring.substring( | ||||
| place, ++tabCol - placediff)); | place, ++tabCol - placediff)); | ||||
| linebuf2.append('\t'); | linebuf2.append('\t'); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| linebuf2.append(linestring.substring( | linebuf2.append(linestring.substring( | ||||
| place, nextStop - placediff)); | place, nextStop - placediff)); | ||||
| } // end of else | } // end of else | ||||
| @@ -819,8 +809,7 @@ public class FixCRLF extends MatchingTask { | |||||
| private boolean reachedEof = false; | private boolean reachedEof = false; | ||||
| public OneLiner(File srcFile) | public OneLiner(File srcFile) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| try { | try { | ||||
| reader = new BufferedReader | reader = new BufferedReader | ||||
| (getReader(srcFile), INBUFLEN); | (getReader(srcFile), INBUFLEN); | ||||
| @@ -924,14 +913,12 @@ public class FixCRLF extends MatchingTask { | |||||
| this.state = state; | this.state = state; | ||||
| } | } | ||||
| public boolean hasMoreElements() | |||||
| { | |||||
| public boolean hasMoreElements() { | |||||
| return !reachedEof; | return !reachedEof; | ||||
| } | } | ||||
| public Object nextElement() | public Object nextElement() | ||||
| throws NoSuchElementException | |||||
| { | |||||
| throws NoSuchElementException { | |||||
| if (!hasMoreElements()) { | if (!hasMoreElements()) { | ||||
| throw new NoSuchElementException("OneLiner"); | throw new NoSuchElementException("OneLiner"); | ||||
| } | } | ||||
| @@ -955,8 +942,7 @@ public class FixCRLF extends MatchingTask { | |||||
| private String eolStr; | private String eolStr; | ||||
| public BufferLine(String line, String eolStr) | public BufferLine(String line, String eolStr) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| next = 0; | next = 0; | ||||
| column = 0; | column = 0; | ||||
| this.line = line; | this.line = line; | ||||
| @@ -87,8 +87,9 @@ public class GZip extends Pack { | |||||
| try { | try { | ||||
| // close up | // close up | ||||
| zOut.close(); | zOut.close(); | ||||
| } catch (IOException e) { | |||||
| // do nothing | |||||
| } | } | ||||
| catch (IOException e) {} | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -137,8 +137,7 @@ public class GenerateKey extends Task { | |||||
| int start = 0; | int start = 0; | ||||
| while (-1 != end) | |||||
| { | |||||
| while (-1 != end) { | |||||
| sb.append(string.substring(start, end)); | sb.append(string.substring(start, end)); | ||||
| sb.append("\\,"); | sb.append("\\,"); | ||||
| start = end + 1; | start = end + 1; | ||||
| @@ -306,8 +305,7 @@ public class GenerateKey extends Task { | |||||
| sb.append("-keypass \""); | sb.append("-keypass \""); | ||||
| if (null != keypass) { | if (null != keypass) { | ||||
| sb.append(keypass); | sb.append(keypass); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| sb.append(storepass); | sb.append(storepass); | ||||
| } | } | ||||
| sb.append("\" "); | sb.append("\" "); | ||||
| @@ -150,8 +150,7 @@ public class Get extends Task { | |||||
| Class.forName("sun.misc.BASE64Encoder").newInstance(); | Class.forName("sun.misc.BASE64Encoder").newInstance(); | ||||
| encoding = encoder.encode (up.getBytes()); | encoding = encoder.encode (up.getBytes()); | ||||
| } | |||||
| catch (Exception ex) { // sun's base64 encoder isn't available | |||||
| } catch (Exception ex) { // sun's base64 encoder isn't available | |||||
| Base64Converter encoder = new Base64Converter(); | Base64Converter encoder = new Base64Converter(); | ||||
| encoding = encoder.encode(up.getBytes()); | encoding = encoder.encode(up.getBytes()); | ||||
| } | } | ||||
| @@ -339,8 +338,7 @@ public class Get extends Task { | |||||
| * <a HREF="gg@grtmail.com">Gautam Guliani</a> | * <a HREF="gg@grtmail.com">Gautam Guliani</a> | ||||
| *********************************************************************/ | *********************************************************************/ | ||||
| class Base64Converter | |||||
| { | |||||
| class Base64Converter { | |||||
| public final char [ ] alphabet = { | public final char [ ] alphabet = { | ||||
| 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 to 7 | 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 to 7 | ||||
| @@ -353,13 +351,11 @@ public class Get extends Task { | |||||
| '4', '5', '6', '7', '8', '9', '+', '/' }; // 56 to 63 | '4', '5', '6', '7', '8', '9', '+', '/' }; // 56 to 63 | ||||
| public String encode(String s) | |||||
| { | |||||
| public String encode(String s) { | |||||
| return encode (s.getBytes()); | return encode (s.getBytes()); | ||||
| } | } | ||||
| public String encode(byte[ ] octetString) | |||||
| { | |||||
| public String encode(byte[ ] octetString) { | |||||
| int bits24; | int bits24; | ||||
| int bits6; | int bits6; | ||||
| @@ -384,8 +380,7 @@ public class Get extends Task { | |||||
| out[outIndex++] = alphabet[bits6]; | out[outIndex++] = alphabet[bits6]; | ||||
| } | } | ||||
| if (octetString.length - i == 2) | |||||
| { | |||||
| if (octetString.length - i == 2) { | |||||
| // store the octets | // store the octets | ||||
| bits24 = (octetString[i] & 0xFF) << 16; | bits24 = (octetString[i] & 0xFF) << 16; | ||||
| bits24 |= (octetString[i + 1] & 0xFF) << 8; | bits24 |= (octetString[i + 1] & 0xFF) << 8; | ||||
| @@ -398,9 +393,7 @@ public class Get extends Task { | |||||
| // padding | // padding | ||||
| out[outIndex++] = '='; | out[outIndex++] = '='; | ||||
| } | |||||
| else if (octetString.length - i == 1) | |||||
| { | |||||
| } else if (octetString.length - i == 1) { | |||||
| // store the octets | // store the octets | ||||
| bits24 = (octetString[i] & 0xFF) << 16; | bits24 = (octetString[i] & 0xFF) << 16; | ||||
| bits6 = (bits24 & 0x00FC0000) >> 18; | bits6 = (bits24 & 0x00FC0000) >> 18; | ||||
| @@ -151,10 +151,9 @@ public class Input extends Task { | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| throw new BuildException("Failed to read input from Console.", e); | throw new BuildException("Failed to read input from Console.", e); | ||||
| } | } | ||||
| } | |||||
| // not quite the original intention of this task but for the sake | |||||
| // of testing ;-) | |||||
| else { | |||||
| } else { | |||||
| // not quite the original intention of this task but for the sake | |||||
| // of testing ;-) | |||||
| if (accept != null && (!accept.contains(input))) { | if (accept != null && (!accept.contains(input))) { | ||||
| throw new BuildException("Invalid input please reenter."); | throw new BuildException("Invalid input please reenter."); | ||||
| } | } | ||||
| @@ -163,8 +162,7 @@ public class Input extends Task { | |||||
| if (addproperty != null) { | if (addproperty != null) { | ||||
| if (project.getProperty(addproperty) == null) { | if (project.getProperty(addproperty) == null) { | ||||
| project.setProperty(addproperty, input); | project.setProperty(addproperty, input); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log("Override ignored for " + addproperty, Project.MSG_VERBOSE); | log("Override ignored for " + addproperty, Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } | } | ||||
| @@ -176,8 +176,7 @@ public class Jar extends Zip { | |||||
| try { | try { | ||||
| r = new FileReader(manifestFile); | r = new FileReader(manifestFile); | ||||
| newManifest = getManifest(r); | newManifest = getManifest(r); | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| throw new BuildException("Unable to read manifest file: " | throw new BuildException("Unable to read manifest file: " | ||||
| + manifestFile | + manifestFile | ||||
| + " (" + e.getMessage() + ")", e); | + " (" + e.getMessage() + ")", e); | ||||
| @@ -185,8 +184,7 @@ public class Jar extends Zip { | |||||
| if (r != null) { | if (r != null) { | ||||
| try { | try { | ||||
| r.close(); | r.close(); | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| // do nothing | // do nothing | ||||
| } | } | ||||
| } | } | ||||
| @@ -199,13 +197,11 @@ public class Jar extends Zip { | |||||
| Manifest newManifest = null; | Manifest newManifest = null; | ||||
| try { | try { | ||||
| newManifest = new Manifest(r); | newManifest = new Manifest(r); | ||||
| } | |||||
| catch (ManifestException e) { | |||||
| } catch (ManifestException e) { | |||||
| log("Manifest is invalid: " + e.getMessage(), Project.MSG_ERR); | log("Manifest is invalid: " + e.getMessage(), Project.MSG_ERR); | ||||
| throw new BuildException("Invalid Manifest: " + manifestFile, | throw new BuildException("Invalid Manifest: " + manifestFile, | ||||
| e, getLocation()); | e, getLocation()); | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| throw new BuildException("Unable to read manifest file" | throw new BuildException("Unable to read manifest file" | ||||
| + " (" + e.getMessage() + ")", e); | + " (" + e.getMessage() + ")", e); | ||||
| } | } | ||||
| @@ -225,8 +221,7 @@ public class Jar extends Zip { | |||||
| } | } | ||||
| protected void initZipOutputStream(ZipOutputStream zOut) | protected void initZipOutputStream(ZipOutputStream zOut) | ||||
| throws IOException, BuildException | |||||
| { | |||||
| throws IOException, BuildException { | |||||
| String ls = System.getProperty("line.separator"); | String ls = System.getProperty("line.separator"); | ||||
| try { | try { | ||||
| @@ -240,14 +235,12 @@ public class Jar extends Zip { | |||||
| finalManifest.merge(filesetManifest); | finalManifest.merge(filesetManifest); | ||||
| finalManifest.merge(configuredManifest); | finalManifest.merge(configuredManifest); | ||||
| finalManifest.merge(manifest, !mergeManifestsMain); | finalManifest.merge(manifest, !mergeManifestsMain); | ||||
| } | |||||
| else if (configuredManifest != null) { | |||||
| } else if (configuredManifest != null) { | |||||
| // configuredManifest is the final merge | // configuredManifest is the final merge | ||||
| finalManifest.merge(filesetManifest); | finalManifest.merge(filesetManifest); | ||||
| finalManifest.merge(configuredManifest, | finalManifest.merge(configuredManifest, | ||||
| !mergeManifestsMain); | !mergeManifestsMain); | ||||
| } | |||||
| else if (filesetManifest != null) { | |||||
| } else if (filesetManifest != null) { | |||||
| // filesetManifest is the final (and only) merge | // filesetManifest is the final (and only) merge | ||||
| finalManifest.merge(filesetManifest, !mergeManifestsMain); | finalManifest.merge(filesetManifest, !mergeManifestsMain); | ||||
| } | } | ||||
| @@ -280,12 +273,10 @@ public class Jar extends Zip { | |||||
| super.zipFile(bais, zOut, "META-INF/MANIFEST.MF", | super.zipFile(bais, zOut, "META-INF/MANIFEST.MF", | ||||
| System.currentTimeMillis(), null); | System.currentTimeMillis(), null); | ||||
| super.initZipOutputStream(zOut); | super.initZipOutputStream(zOut); | ||||
| } | |||||
| catch (ManifestException e) { | |||||
| } catch (ManifestException e) { | |||||
| log("Manifest is invalid: " + e.getMessage(), Project.MSG_ERR); | log("Manifest is invalid: " + e.getMessage(), Project.MSG_ERR); | ||||
| throw new BuildException("Invalid Manifest", e, getLocation()); | throw new BuildException("Invalid Manifest", e, getLocation()); | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| System.getProperties().put("line.separator", ls); | System.getProperties().put("line.separator", ls); | ||||
| } | } | ||||
| } | } | ||||
| @@ -355,8 +346,7 @@ public class Jar extends Zip { | |||||
| * Overriden from Zip class to deal with manifests | * Overriden from Zip class to deal with manifests | ||||
| */ | */ | ||||
| protected void zipFile(File file, ZipOutputStream zOut, String vPath) | protected void zipFile(File file, ZipOutputStream zOut, String vPath) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| if ("META-INF/MANIFEST.MF".equalsIgnoreCase(vPath)) { | if ("META-INF/MANIFEST.MF".equalsIgnoreCase(vPath)) { | ||||
| filesetManifest(file, null); | filesetManifest(file, null); | ||||
| } else { | } else { | ||||
| @@ -369,8 +359,7 @@ public class Jar extends Zip { | |||||
| */ | */ | ||||
| protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath, | protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath, | ||||
| long lastModified, File file) | long lastModified, File file) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| if ("META-INF/MANIFEST.MF".equalsIgnoreCase(vPath)) { | if ("META-INF/MANIFEST.MF".equalsIgnoreCase(vPath)) { | ||||
| filesetManifest(file, is); | filesetManifest(file, is); | ||||
| } else { | } else { | ||||
| @@ -385,31 +374,26 @@ public class Jar extends Zip { | |||||
| log("Found manifest " + file, Project.MSG_VERBOSE); | log("Found manifest " + file, Project.MSG_VERBOSE); | ||||
| if (is != null) { | if (is != null) { | ||||
| manifest = getManifest(new InputStreamReader(is)); | manifest = getManifest(new InputStreamReader(is)); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| manifest = getManifest(file); | manifest = getManifest(file); | ||||
| } | } | ||||
| } | |||||
| else if (mergeManifests) { | |||||
| } else if (mergeManifests) { | |||||
| // we add this to our group of fileset manifests | // we add this to our group of fileset manifests | ||||
| log("Found manifest to merge in file " + file, | log("Found manifest to merge in file " + file, | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| try | |||||
| { | |||||
| try { | |||||
| Manifest newManifest = getManifest(new InputStreamReader(is)); | Manifest newManifest = getManifest(new InputStreamReader(is)); | ||||
| if (filesetManifest == null) { | if (filesetManifest == null) { | ||||
| filesetManifest = newManifest; | filesetManifest = newManifest; | ||||
| } else { | } else { | ||||
| filesetManifest.merge(newManifest); | filesetManifest.merge(newManifest); | ||||
| } | } | ||||
| } | |||||
| catch (ManifestException e) { | |||||
| } catch (ManifestException e) { | |||||
| log("Manifest in file " + file + " is invalid: " + e.getMessage(), Project.MSG_ERR); | log("Manifest in file " + file + " is invalid: " + e.getMessage(), Project.MSG_ERR); | ||||
| throw new BuildException("Invalid Manifest", e, getLocation()); | throw new BuildException("Invalid Manifest", e, getLocation()); | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // assuming 'skip' otherwise | // assuming 'skip' otherwise | ||||
| log("File " + file | log("File " + file | ||||
| + " includes a META-INF/MANIFEST.MF which will be ignored. " | + " includes a META-INF/MANIFEST.MF which will be ignored. " | ||||
| @@ -451,26 +435,22 @@ public class Jar extends Zip { | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| // any problems and we will rebuild | // any problems and we will rebuild | ||||
| log("Updating jar since cannot read current jar manifest: " | log("Updating jar since cannot read current jar manifest: " | ||||
| + e.getClass().getName() + " - " + e.getMessage(), | + e.getClass().getName() + " - " + e.getMessage(), | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| return false; | return false; | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| if (theZipFile != null) { | if (theZipFile != null) { | ||||
| try { | try { | ||||
| theZipFile.close(); | theZipFile.close(); | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| //ignore | //ignore | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| else if (manifestFile.lastModified() > zipFile.lastModified()) { | |||||
| } else if (manifestFile.lastModified() > zipFile.lastModified()) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| return super.isUpToDate(scanners, zipFile); | return super.isUpToDate(scanners, zipFile); | ||||
| @@ -396,14 +396,12 @@ public class Java extends Task { | |||||
| exe.execute(project); | exe.execute(project); | ||||
| } catch (IOException io) { | } catch (IOException io) { | ||||
| throw new BuildException(io, location); | throw new BuildException(io, location); | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| if (outStream != null) { | if (outStream != null) { | ||||
| outStream.close(); | outStream.close(); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| exe.execute(project); | exe.execute(project); | ||||
| } | } | ||||
| } | } | ||||
| @@ -776,8 +776,7 @@ public class Javadoc extends Task { | |||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| } | } | ||||
| gotAll = true; | gotAll = true; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| int i; | int i; | ||||
| for (i = 0; i < SCOPE_ELEMENTS.length; i++) { | for (i = 0; i < SCOPE_ELEMENTS.length; i++) { | ||||
| if (next.equals (SCOPE_ELEMENTS[i])) | if (next.equals (SCOPE_ELEMENTS[i])) | ||||
| @@ -786,8 +785,7 @@ public class Javadoc extends Task { | |||||
| if (i == SCOPE_ELEMENTS.length) { | if (i == SCOPE_ELEMENTS.length) { | ||||
| throw new BuildException ("Unrecognised scope element: " | throw new BuildException ("Unrecognised scope element: " | ||||
| + next); | + next); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| if (elements[i]) { | if (elements[i]) { | ||||
| getProject().log ("Repeated tag scope element: " | getProject().log ("Repeated tag scope element: " | ||||
| + next, Project.MSG_VERBOSE); | + next, Project.MSG_VERBOSE); | ||||
| @@ -808,8 +806,7 @@ public class Javadoc extends Task { | |||||
| } | } | ||||
| if (gotAll) { | if (gotAll) { | ||||
| this.scope = "a"; | this.scope = "a"; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| StringBuffer buff = new StringBuffer (elements.length); | StringBuffer buff = new StringBuffer (elements.length); | ||||
| for (int i = 0; i < elements.length; i++) { | for (int i = 0; i < elements.length; i++) { | ||||
| if (elements[i]) { | if (elements[i]) { | ||||
| @@ -998,8 +995,7 @@ public class Javadoc extends Task { | |||||
| if (doclet.getName() == null) { | if (doclet.getName() == null) { | ||||
| throw new BuildException("The doclet name must be " | throw new BuildException("The doclet name must be " | ||||
| + "specified.", location); | + "specified.", location); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| toExecute.createArgument().setValue("-doclet"); | toExecute.createArgument().setValue("-doclet"); | ||||
| toExecute.createArgument().setValue(doclet.getName()); | toExecute.createArgument().setValue(doclet.getName()); | ||||
| if (doclet.getPath() != null) { | if (doclet.getPath() != null) { | ||||
| @@ -1060,13 +1056,11 @@ public class Javadoc extends Task { | |||||
| toExecute.createArgument() | toExecute.createArgument() | ||||
| .setValue(packageListLocation | .setValue(packageListLocation | ||||
| .getAbsolutePath()); | .getAbsolutePath()); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log("Warning: No package list was found at " | log("Warning: No package list was found at " | ||||
| + packageListLocation, Project.MSG_VERBOSE); | + packageListLocation, Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| toExecute.createArgument().setValue("-link"); | toExecute.createArgument().setValue("-link"); | ||||
| toExecute.createArgument().setValue(la.getHref()); | toExecute.createArgument().setValue(la.getHref()); | ||||
| } | } | ||||
| @@ -179,8 +179,7 @@ public class KeySubst extends Task { | |||||
| } | } | ||||
| public static void main(String[] args) | |||||
| { | |||||
| public static void main(String[] args) { | |||||
| try { | try { | ||||
| Hashtable hash = new Hashtable(); | Hashtable hash = new Hashtable(); | ||||
| hash.put("VERSION", "1.0.3"); | hash.put("VERSION", "1.0.3"); | ||||
| @@ -198,8 +197,7 @@ public class KeySubst extends Task { | |||||
| @return the string with the replacements in it. | @return the string with the replacements in it. | ||||
| */ | */ | ||||
| public static String replace(String origString, Hashtable keys) | public static String replace(String origString, Hashtable keys) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| StringBuffer finalString = new StringBuffer(); | StringBuffer finalString = new StringBuffer(); | ||||
| int index = 0; | int index = 0; | ||||
| int i = 0; | int i = 0; | ||||
| @@ -178,8 +178,7 @@ public final class LoadFile extends Task { | |||||
| bis = new BufferedInputStream(fis); | bis = new BufferedInputStream(fis); | ||||
| if (encoding == null) { | if (encoding == null) { | ||||
| instream = new InputStreamReader(bis); | instream = new InputStreamReader(bis); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| instream = new InputStreamReader(bis, encoding); | instream = new InputStreamReader(bis, encoding); | ||||
| } | } | ||||
| @@ -203,15 +202,13 @@ public final class LoadFile extends Task { | |||||
| final String message = "Unable to load file: " + ioe.toString(); | final String message = "Unable to load file: " + ioe.toString(); | ||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException(message, ioe, location); | throw new BuildException(message, ioe, location); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log(message, Project.MSG_ERR); | log(message, Project.MSG_ERR); | ||||
| } | } | ||||
| } catch (final BuildException be) { | } catch (final BuildException be) { | ||||
| if (failOnError) { | if (failOnError) { | ||||
| throw be; | throw be; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log(be.getMessage(), Project.MSG_ERR); | log(be.getMessage(), Project.MSG_ERR); | ||||
| } | } | ||||
| } finally { | } finally { | ||||
| @@ -1068,8 +1068,7 @@ public class Manifest extends Task { | |||||
| if (mode.getValue().equals("update") && manifestFile.exists()) { | if (mode.getValue().equals("update") && manifestFile.exists()) { | ||||
| if (current != null) { | if (current != null) { | ||||
| toWrite.merge(current); | toWrite.merge(current); | ||||
| } | |||||
| else if (error != null) { | |||||
| } else if (error != null) { | |||||
| throw error; | throw error; | ||||
| } | } | ||||
| } | } | ||||
| @@ -117,8 +117,7 @@ public abstract class Pack extends Task { | |||||
| } | } | ||||
| private void zipFile(InputStream in, OutputStream zOut) | private void zipFile(InputStream in, OutputStream zOut) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| byte[] buffer = new byte[8 * 1024]; | byte[] buffer = new byte[8 * 1024]; | ||||
| int count = 0; | int count = 0; | ||||
| do { | do { | ||||
| @@ -128,8 +127,7 @@ public abstract class Pack extends Task { | |||||
| } | } | ||||
| protected void zipFile(File file, OutputStream zOut) | protected void zipFile(File file, OutputStream zOut) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| FileInputStream fIn = new FileInputStream(file); | FileInputStream fIn = new FileInputStream(file); | ||||
| try { | try { | ||||
| zipFile(fIn, zOut); | zipFile(fIn, zOut); | ||||
| @@ -112,8 +112,7 @@ public class Parallel extends Task | |||||
| for (int i = 0; i < threads.length; ++i) { | for (int i = 0; i < threads.length; ++i) { | ||||
| try { | try { | ||||
| threads[i].join(); | threads[i].join(); | ||||
| } | |||||
| catch (InterruptedException ie) { | |||||
| } catch (InterruptedException ie) { | |||||
| // who would interrupt me at a time like this? | // who would interrupt me at a time like this? | ||||
| } | } | ||||
| } | } | ||||
| @@ -142,12 +141,10 @@ public class Parallel extends Task | |||||
| if (numExceptions == 1) { | if (numExceptions == 1) { | ||||
| if (firstException instanceof BuildException) { | if (firstException instanceof BuildException) { | ||||
| throw (BuildException) firstException; | throw (BuildException) firstException; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| throw new BuildException(firstException); | throw new BuildException(firstException); | ||||
| } | } | ||||
| } | |||||
| else if (numExceptions > 1) { | |||||
| } else if (numExceptions > 1) { | |||||
| throw new BuildException(exceptionMessage.toString(), | throw new BuildException(exceptionMessage.toString(), | ||||
| firstLocation); | firstLocation); | ||||
| } | } | ||||
| @@ -175,8 +172,7 @@ public class Parallel extends Task | |||||
| public void run() { | public void run() { | ||||
| try { | try { | ||||
| task.perform(); | task.perform(); | ||||
| } | |||||
| catch (Throwable t) { | |||||
| } catch (Throwable t) { | |||||
| exception = t; | exception = t; | ||||
| } | } | ||||
| } | } | ||||
| @@ -65,8 +65,7 @@ import java.util.Vector; | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| class ProcessDestroyer | class ProcessDestroyer | ||||
| extends Thread | |||||
| { | |||||
| extends Thread { | |||||
| private Vector processes = new Vector(); | private Vector processes = new Vector(); | ||||
| @@ -74,10 +73,8 @@ class ProcessDestroyer | |||||
| * Constructs a <code>ProcessDestroyer</code> and registers it as | * Constructs a <code>ProcessDestroyer</code> and registers it as | ||||
| * a shutdown hook. | * a shutdown hook. | ||||
| */ | */ | ||||
| public ProcessDestroyer() | |||||
| { | |||||
| try | |||||
| { | |||||
| public ProcessDestroyer() { | |||||
| try { | |||||
| // check to see if the method exists (support pre-JDK 1.3 VMs) | // check to see if the method exists (support pre-JDK 1.3 VMs) | ||||
| // | // | ||||
| Class[] paramTypes = {Thread.class}; | Class[] paramTypes = {Thread.class}; | ||||
| @@ -88,9 +85,7 @@ class ProcessDestroyer | |||||
| // | // | ||||
| Object[] args = {this}; | Object[] args = {this}; | ||||
| addShutdownHook.invoke(Runtime.getRuntime(), args); | addShutdownHook.invoke(Runtime.getRuntime(), args); | ||||
| } | |||||
| catch (Exception e) | |||||
| { | |||||
| } catch (Exception e) { | |||||
| // it just won't be added as a shutdown hook... :( | // it just won't be added as a shutdown hook... :( | ||||
| } | } | ||||
| } | } | ||||
| @@ -103,8 +98,7 @@ class ProcessDestroyer | |||||
| * @return <code>true</code> if the specified <code>Process</code> was | * @return <code>true</code> if the specified <code>Process</code> was | ||||
| * successfully added | * successfully added | ||||
| */ | */ | ||||
| public boolean add(Process process) | |||||
| { | |||||
| public boolean add(Process process) { | |||||
| processes.addElement(process); | processes.addElement(process); | ||||
| return processes.contains(process); | return processes.contains(process); | ||||
| } | } | ||||
| @@ -117,21 +111,17 @@ class ProcessDestroyer | |||||
| * @return <code>true</code> if the specified <code>Process</code> was | * @return <code>true</code> if the specified <code>Process</code> was | ||||
| * successfully removed | * successfully removed | ||||
| */ | */ | ||||
| public boolean remove(Process process) | |||||
| { | |||||
| public boolean remove(Process process) { | |||||
| return processes.removeElement(process); | return processes.removeElement(process); | ||||
| } | } | ||||
| /** | /** | ||||
| * Invoked by the VM when it is exiting. | * Invoked by the VM when it is exiting. | ||||
| */ | */ | ||||
| public void run() | |||||
| { | |||||
| synchronized (processes) | |||||
| { | |||||
| public void run() { | |||||
| synchronized (processes) { | |||||
| Enumeration e = processes.elements(); | Enumeration e = processes.elements(); | ||||
| while (e.hasMoreElements()) | |||||
| { | |||||
| while (e.hasMoreElements()) { | |||||
| ((Process) e.nextElement()).destroy(); | ((Process) e.nextElement()).destroy(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -377,8 +377,7 @@ public class Property extends Task { | |||||
| if (props.containsKey(propertyName)) { | if (props.containsKey(propertyName)) { | ||||
| fragment = props.getProperty(propertyName); | fragment = props.getProperty(propertyName); | ||||
| resolved = false; | resolved = false; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| fragment = "${" + propertyName + "}"; | fragment = "${" + propertyName + "}"; | ||||
| } | } | ||||
| } | } | ||||
| @@ -126,8 +126,7 @@ public class Replace extends MatchingTask { | |||||
| } | } | ||||
| //Inner class | //Inner class | ||||
| public class Replacefilter | |||||
| { | |||||
| public class Replacefilter { | |||||
| private String token; | private String token; | ||||
| private String value; | private String value; | ||||
| private String property; | private String property; | ||||
| @@ -173,18 +172,14 @@ public class Replace extends MatchingTask { | |||||
| } | } | ||||
| } | } | ||||
| public String getReplaceValue() | |||||
| { | |||||
| public String getReplaceValue() { | |||||
| if (property != null) { | if (property != null) { | ||||
| return properties.getProperty(property); | return properties.getProperty(property); | ||||
| } | |||||
| else if (value != null) { | |||||
| } else if (value != null) { | |||||
| return value; | return value; | ||||
| } | |||||
| else if (Replace.this.value != null) { | |||||
| } else if (Replace.this.value != null) { | |||||
| return Replace.this.value.getText(); | return Replace.this.value.getText(); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| //Default is empty string | //Default is empty string | ||||
| return new String(""); | return new String(""); | ||||
| } | } | ||||
| @@ -319,13 +314,11 @@ public class Replace extends MatchingTask { | |||||
| try { | try { | ||||
| properties.load(new FileInputStream(propertyFile)); | properties.load(new FileInputStream(propertyFile)); | ||||
| } | |||||
| catch (FileNotFoundException e) { | |||||
| } catch (FileNotFoundException e) { | |||||
| String message = "Property file (" + propertyFile.getPath() | String message = "Property file (" + propertyFile.getPath() | ||||
| + ") not found."; | + ") not found."; | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| String message = "Property file (" + propertyFile.getPath() | String message = "Property file (" + propertyFile.getPath() | ||||
| + ") cannot be loaded."; | + ") cannot be loaded."; | ||||
| throw new BuildException(message); | throw new BuildException(message); | ||||
| @@ -384,8 +377,7 @@ public class Replace extends MatchingTask { | |||||
| //Preserve original string (buf) so we can compare the result | //Preserve original string (buf) so we can compare the result | ||||
| String newString = new String(buf); | String newString = new String(buf); | ||||
| if (token != null) | |||||
| { | |||||
| if (token != null) { | |||||
| // line separators in values and tokens are "\n" | // line separators in values and tokens are "\n" | ||||
| // in order to compare with the file contents, replace them | // in order to compare with the file contents, replace them | ||||
| // as needed | // as needed | ||||
| @@ -484,8 +484,7 @@ public class SQLExec extends Task { | |||||
| } | } | ||||
| } | } | ||||
| dc = loader.loadClass(driver); | dc = loader.loadClass(driver); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log("Loading " + driver + " using system loader.", | log("Loading " + driver + " using system loader.", | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| dc = Class.forName(driver); | dc = Class.forName(driver); | ||||
| @@ -568,8 +567,7 @@ public class SQLExec extends Task { | |||||
| conn.commit(); | conn.commit(); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| if (out != null && out != System.out) { | if (out != null && out != System.out) { | ||||
| out.close(); | out.close(); | ||||
| } | } | ||||
| @@ -588,8 +586,7 @@ public class SQLExec extends Task { | |||||
| } catch (SQLException ex) {} | } catch (SQLException ex) {} | ||||
| } | } | ||||
| throw new BuildException(e, location); | throw new BuildException(e, location); | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| try { | try { | ||||
| if (statement != null) { | if (statement != null) { | ||||
| statement.close(); | statement.close(); | ||||
| @@ -597,8 +594,7 @@ public class SQLExec extends Task { | |||||
| if (conn != null) { | if (conn != null) { | ||||
| conn.close(); | conn.close(); | ||||
| } | } | ||||
| } | |||||
| catch (SQLException e) {} | |||||
| } catch (SQLException e) {} | |||||
| } | } | ||||
| log(goodSql + " of " + totalSql + | log(goodSql + " of " + totalSql + | ||||
| @@ -697,8 +693,7 @@ public class SQLExec extends Task { | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| catch (SQLException e) { | |||||
| } catch (SQLException e) { | |||||
| // Could not get the required information | // Could not get the required information | ||||
| log("Failed to obtain required RDBMS information", Project.MSG_ERR); | log("Failed to obtain required RDBMS information", Project.MSG_ERR); | ||||
| return false; | return false; | ||||
| @@ -721,8 +716,7 @@ public class SQLExec extends Task { | |||||
| if (!statement.execute(sql)) { | if (!statement.execute(sql)) { | ||||
| log(statement.getUpdateCount() + " rows affected", | log(statement.getUpdateCount() + " rows affected", | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| if (print) { | if (print) { | ||||
| printResults(out); | printResults(out); | ||||
| } | } | ||||
| @@ -735,8 +729,7 @@ public class SQLExec extends Task { | |||||
| } | } | ||||
| conn.clearWarnings(); | conn.clearWarnings(); | ||||
| goodSql++; | goodSql++; | ||||
| } | |||||
| catch (SQLException e) { | |||||
| } catch (SQLException e) { | |||||
| log("Failed to execute: " + sql, Project.MSG_ERR); | log("Failed to execute: " + sql, Project.MSG_ERR); | ||||
| if (!onError.equals("continue")) { | if (!onError.equals("continue")) { | ||||
| throw e; | throw e; | ||||
| @@ -776,8 +769,7 @@ public class SQLExec extends Task { | |||||
| if (first) { | if (first) { | ||||
| first = false; | first = false; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| line.append(","); | line.append(","); | ||||
| } | } | ||||
| line.append(columnValue); | line.append(columnValue); | ||||
| @@ -110,8 +110,7 @@ import org.apache.tools.ant.taskdefs.email.EmailTask; | |||||
| * | * | ||||
| * @ant.task name="mail" category="network" | * @ant.task name="mail" category="network" | ||||
| */ | */ | ||||
| public class SendEmail extends EmailTask | |||||
| { | |||||
| public class SendEmail extends EmailTask { | |||||
| /** | /** | ||||
| * Sets the mailport parameter of this build task. | * Sets the mailport parameter of this build task. | ||||
| * @param value mail port name. | * @param value mail port name. | ||||
| @@ -145,8 +145,7 @@ public class Sleep extends Task { | |||||
| public void doSleep(long millis) { | public void doSleep(long millis) { | ||||
| try { | try { | ||||
| Thread.sleep(millis); | Thread.sleep(millis); | ||||
| } | |||||
| catch (InterruptedException ie) { | |||||
| } catch (InterruptedException ie) { | |||||
| } | } | ||||
| } | } | ||||
| @@ -201,12 +200,10 @@ public class Sleep extends Task { | |||||
| log("sleeping for " + sleepTime + " milliseconds", | log("sleeping for " + sleepTime + " milliseconds", | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| doSleep(sleepTime); | doSleep(sleepTime); | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException(e); | throw new BuildException(e); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| String text = e.toString(); | String text = e.toString(); | ||||
| log(text, Project.MSG_ERR); | log(text, Project.MSG_ERR); | ||||
| } | } | ||||
| @@ -130,8 +130,7 @@ public class StreamPumper implements Runnable { | |||||
| * @see #isFinished() | * @see #isFinished() | ||||
| **/ | **/ | ||||
| public synchronized void waitFor() | public synchronized void waitFor() | ||||
| throws InterruptedException | |||||
| { | |||||
| throws InterruptedException { | |||||
| while (!isFinished()) { | while (!isFinished()) { | ||||
| wait(); | wait(); | ||||
| } | } | ||||
| @@ -261,12 +261,10 @@ public class Tar extends MatchingTask { | |||||
| tOut.setDebug(true); | tOut.setDebug(true); | ||||
| if (longFileMode.isTruncateMode()) { | if (longFileMode.isTruncateMode()) { | ||||
| tOut.setLongFileMode(TarOutputStream.LONGFILE_TRUNCATE); | tOut.setLongFileMode(TarOutputStream.LONGFILE_TRUNCATE); | ||||
| } | |||||
| else if (longFileMode.isFailMode() || | |||||
| } else if (longFileMode.isFailMode() || | |||||
| longFileMode.isOmitMode()) { | longFileMode.isOmitMode()) { | ||||
| tOut.setLongFileMode(TarOutputStream.LONGFILE_ERROR); | tOut.setLongFileMode(TarOutputStream.LONGFILE_ERROR); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // warn or GNU | // warn or GNU | ||||
| tOut.setLongFileMode(TarOutputStream.LONGFILE_GNU); | tOut.setLongFileMode(TarOutputStream.LONGFILE_GNU); | ||||
| } | } | ||||
| @@ -296,8 +294,7 @@ public class Tar extends MatchingTask { | |||||
| try { | try { | ||||
| // close up | // close up | ||||
| tOut.close(); | tOut.close(); | ||||
| } | |||||
| catch (IOException e) {} | |||||
| } catch (IOException e) {} | |||||
| } | } | ||||
| } | } | ||||
| } finally { | } finally { | ||||
| @@ -307,8 +304,7 @@ public class Tar extends MatchingTask { | |||||
| protected void tarFile(File file, TarOutputStream tOut, String vPath, | protected void tarFile(File file, TarOutputStream tOut, String vPath, | ||||
| TarFileSet tarFileSet) | TarFileSet tarFileSet) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| FileInputStream fIn = null; | FileInputStream fIn = null; | ||||
| String fullpath = tarFileSet.getFullpath(); | String fullpath = tarFileSet.getFullpath(); | ||||
| @@ -121,15 +121,13 @@ public class Tstamp extends Task { | |||||
| } | } | ||||
| } | } | ||||
| public CustomFormat createFormat() | |||||
| { | |||||
| public CustomFormat createFormat() { | |||||
| CustomFormat cts = new CustomFormat(prefix); | CustomFormat cts = new CustomFormat(prefix); | ||||
| customFormats.addElement(cts); | customFormats.addElement(cts); | ||||
| return cts; | return cts; | ||||
| } | } | ||||
| public class CustomFormat | |||||
| { | |||||
| public class CustomFormat { | |||||
| private TimeZone timeZone; | private TimeZone timeZone; | ||||
| private String propertyName; | private String propertyName; | ||||
| private String pattern; | private String pattern; | ||||
| @@ -140,23 +138,19 @@ public class Tstamp extends Task { | |||||
| private int field = Calendar.DATE; | private int field = Calendar.DATE; | ||||
| private String prefix = ""; | private String prefix = ""; | ||||
| public CustomFormat(String prefix) | |||||
| { | |||||
| public CustomFormat(String prefix) { | |||||
| this.prefix = prefix; | this.prefix = prefix; | ||||
| } | } | ||||
| public void setProperty(String propertyName) | |||||
| { | |||||
| public void setProperty(String propertyName) { | |||||
| this.propertyName = prefix + propertyName; | this.propertyName = prefix + propertyName; | ||||
| } | } | ||||
| public void setPattern(String pattern) | |||||
| { | |||||
| public void setPattern(String pattern) { | |||||
| this.pattern = pattern; | this.pattern = pattern; | ||||
| } | } | ||||
| public void setLocale(String locale) | |||||
| { | |||||
| public void setLocale(String locale) { | |||||
| StringTokenizer st = new StringTokenizer(locale, " \t\n\r\f,"); | StringTokenizer st = new StringTokenizer(locale, " \t\n\r\f,"); | ||||
| try { | try { | ||||
| language = st.nextToken(); | language = st.nextToken(); | ||||
| @@ -169,12 +163,10 @@ public class Tstamp extends Task { | |||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| country = ""; | country = ""; | ||||
| } | } | ||||
| } | |||||
| catch (NoSuchElementException e) { | |||||
| } catch (NoSuchElementException e) { | |||||
| throw new BuildException("bad locale format", e, | throw new BuildException("bad locale format", e, | ||||
| getLocation()); | getLocation()); | ||||
| } | } | ||||
| @@ -207,8 +199,7 @@ public class Tstamp extends Task { | |||||
| field = unit.getCalendarField(); | field = unit.getCalendarField(); | ||||
| } | } | ||||
| public void execute(Project project, Date date, Location location) | |||||
| { | |||||
| public void execute(Project project, Date date, Location location) { | |||||
| if (propertyName == null) { | if (propertyName == null) { | ||||
| throw new BuildException("property attribute must be provided", | throw new BuildException("property attribute must be provided", | ||||
| location); | location); | ||||
| @@ -222,12 +213,10 @@ public class Tstamp extends Task { | |||||
| SimpleDateFormat sdf; | SimpleDateFormat sdf; | ||||
| if (language == null) { | if (language == null) { | ||||
| sdf = new SimpleDateFormat(pattern); | sdf = new SimpleDateFormat(pattern); | ||||
| } | |||||
| else if (variant == null) { | |||||
| } else if (variant == null) { | |||||
| sdf = new SimpleDateFormat(pattern, | sdf = new SimpleDateFormat(pattern, | ||||
| new Locale(language, country)); | new Locale(language, country)); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| sdf = new SimpleDateFormat(pattern, | sdf = new SimpleDateFormat(pattern, | ||||
| new Locale(language, country, | new Locale(language, country, | ||||
| variant)); | variant)); | ||||
| @@ -97,8 +97,7 @@ public class Untar extends Expand { | |||||
| if (tis != null) { | if (tis != null) { | ||||
| try { | try { | ||||
| tis.close(); | tis.close(); | ||||
| } | |||||
| catch (IOException e) {} | |||||
| } catch (IOException e) {} | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -128,8 +128,7 @@ public class War extends Jar { | |||||
| } | } | ||||
| protected void initZipOutputStream(ZipOutputStream zOut) | protected void initZipOutputStream(ZipOutputStream zOut) | ||||
| throws IOException, BuildException | |||||
| { | |||||
| throws IOException, BuildException { | |||||
| // If no webxml file is specified, it's an error. | // If no webxml file is specified, it's an error. | ||||
| if (deploymentDescriptor == null && !isInUpdateMode()) { | if (deploymentDescriptor == null && !isInUpdateMode()) { | ||||
| throw new BuildException("webxml attribute is required", location); | throw new BuildException("webxml attribute is required", location); | ||||
| @@ -139,8 +138,7 @@ public class War extends Jar { | |||||
| } | } | ||||
| protected void zipFile(File file, ZipOutputStream zOut, String vPath) | protected void zipFile(File file, ZipOutputStream zOut, String vPath) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| // If the file being added is WEB-INF/web.xml, we warn if it's | // If the file being added is WEB-INF/web.xml, we warn if it's | ||||
| // not the one specified in the "webxml" attribute - or if | // not the one specified in the "webxml" attribute - or if | ||||
| // it's being added twice, meaning the same file is specified | // it's being added twice, meaning the same file is specified | ||||
| @@ -454,8 +454,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| configureLiaison(stylesheet); | configureLiaison(stylesheet); | ||||
| liaison.transform(inFile, outFile); | liaison.transform(inFile, outFile); | ||||
| } | } | ||||
| } | |||||
| catch (Exception ex) { | |||||
| } catch (Exception ex) { | |||||
| // If failed to process document, must delete target document, | // If failed to process document, must delete target document, | ||||
| // or it will not attempt to process it the second time | // or it will not attempt to process it the second time | ||||
| log("Failed to process " + inFile, Project.MSG_INFO); | log("Failed to process " + inFile, Project.MSG_INFO); | ||||
| @@ -282,22 +282,18 @@ public class Zip extends MatchingTask { | |||||
| addingNewFiles = true; | addingNewFiles = true; | ||||
| doUpdate = doUpdate && zipFile.exists(); | doUpdate = doUpdate && zipFile.exists(); | ||||
| if (doUpdate) | |||||
| { | |||||
| if (doUpdate) { | |||||
| FileUtils fileUtils = FileUtils.newFileUtils(); | FileUtils fileUtils = FileUtils.newFileUtils(); | ||||
| renamedFile = | renamedFile = | ||||
| fileUtils.createTempFile("zip", ".tmp", | fileUtils.createTempFile("zip", ".tmp", | ||||
| fileUtils.getParentFile(zipFile)); | fileUtils.getParentFile(zipFile)); | ||||
| try | |||||
| { | |||||
| try { | |||||
| if (!zipFile.renameTo(renamedFile)) { | if (!zipFile.renameTo(renamedFile)) { | ||||
| throw new BuildException("Unable to rename old file to " | throw new BuildException("Unable to rename old file to " | ||||
| + "temporary file"); | + "temporary file"); | ||||
| } | } | ||||
| } | |||||
| catch (SecurityException e) | |||||
| { | |||||
| } catch (SecurityException e) { | |||||
| throw new BuildException("Not allowed to rename old file to " | throw new BuildException("Not allowed to rename old file to " | ||||
| + "temporary file"); | + "temporary file"); | ||||
| } | } | ||||
| @@ -369,8 +365,7 @@ public class Zip extends MatchingTask { | |||||
| ZipFileSet oldFiles = new ZipFileSet(); | ZipFileSet oldFiles = new ZipFileSet(); | ||||
| oldFiles.setSrc(renamedFile); | oldFiles.setSrc(renamedFile); | ||||
| for (int i = 0; i < addedFiles.size(); i++) | |||||
| { | |||||
| for (int i = 0; i < addedFiles.size(); i++) { | |||||
| PatternSet.NameEntry ne = oldFiles.createExclude(); | PatternSet.NameEntry ne = oldFiles.createExclude(); | ||||
| ne.setName((String) addedFiles.elementAt(i)); | ne.setName((String) addedFiles.elementAt(i)); | ||||
| } | } | ||||
| @@ -485,14 +480,11 @@ public class Zip extends MatchingTask { | |||||
| } | } | ||||
| for (int i = 0; i < files.length; i++) { | for (int i = 0; i < files.length; i++) { | ||||
| File f = new File(thisBaseDir, files[i]); | File f = new File(thisBaseDir, files[i]); | ||||
| if (fullpath.length() > 0) | |||||
| { | |||||
| if (fullpath.length() > 0) { | |||||
| // Add this file at the specified location. | // Add this file at the specified location. | ||||
| addParentDirs(null, fullpath, zOut, ""); | addParentDirs(null, fullpath, zOut, ""); | ||||
| zipFile(f, zOut, fullpath); | zipFile(f, zOut, fullpath); | ||||
| } | |||||
| else | |||||
| { | |||||
| } else { | |||||
| // Add this file with the specified prefix. | // Add this file with the specified prefix. | ||||
| String name = files[i].replace(File.separatorChar, '/'); | String name = files[i].replace(File.separatorChar, '/'); | ||||
| addParentDirs(thisBaseDir, name, zOut, prefix); | addParentDirs(thisBaseDir, name, zOut, prefix); | ||||
| @@ -504,8 +496,7 @@ public class Zip extends MatchingTask { | |||||
| protected void addZipEntries(ZipFileSet fs, DirectoryScanner ds, | protected void addZipEntries(ZipFileSet fs, DirectoryScanner ds, | ||||
| ZipOutputStream zOut, String prefix, | ZipOutputStream zOut, String prefix, | ||||
| String fullpath) | String fullpath) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| log("adding zip entries: " + fullpath, Project.MSG_VERBOSE); | log("adding zip entries: " + fullpath, Project.MSG_VERBOSE); | ||||
| if (prefix.length() > 0 && fullpath.length() > 0) { | if (prefix.length() > 0 && fullpath.length() > 0) { | ||||
| @@ -546,13 +537,11 @@ public class Zip extends MatchingTask { | |||||
| } | } | ||||
| protected void initZipOutputStream(ZipOutputStream zOut) | protected void initZipOutputStream(ZipOutputStream zOut) | ||||
| throws IOException, BuildException | |||||
| { | |||||
| throws IOException, BuildException { | |||||
| } | } | ||||
| protected void finalizeZipOutputStream(ZipOutputStream zOut) | protected void finalizeZipOutputStream(ZipOutputStream zOut) | ||||
| throws IOException, BuildException | |||||
| { | |||||
| throws IOException, BuildException { | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -603,8 +592,7 @@ public class Zip extends MatchingTask { | |||||
| * @exception BuildException if it likes | * @exception BuildException if it likes | ||||
| */ | */ | ||||
| protected boolean isUpToDate(FileScanner[] scanners, File zipFile) | protected boolean isUpToDate(FileScanner[] scanners, File zipFile) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| String[][] fileNames = grabFileNames(scanners); | String[][] fileNames = grabFileNames(scanners); | ||||
| File[] files = grabFiles(scanners, fileNames); | File[] files = grabFiles(scanners, fileNames); | ||||
| if (files.length == 0) { | if (files.length == 0) { | ||||
| @@ -676,8 +664,7 @@ public class Zip extends MatchingTask { | |||||
| } | } | ||||
| protected void zipDir(File dir, ZipOutputStream zOut, String vPath) | protected void zipDir(File dir, ZipOutputStream zOut, String vPath) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| if (addedDirs.get(vPath) != null) { | if (addedDirs.get(vPath) != null) { | ||||
| // don't add directories we've already added. | // don't add directories we've already added. | ||||
| // no warning if we try, it is harmless in and of itself | // no warning if we try, it is harmless in and of itself | ||||
| @@ -706,30 +693,22 @@ public class Zip extends MatchingTask { | |||||
| protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath, | protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath, | ||||
| long lastModified, File file) | long lastModified, File file) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| if (entries.contains(vPath)) { | if (entries.contains(vPath)) { | ||||
| if (duplicate.equals("preserve")) | |||||
| { | |||||
| if (duplicate.equals("preserve")) { | |||||
| log(vPath + " already added, skipping", Project.MSG_INFO); | log(vPath + " already added, skipping", Project.MSG_INFO); | ||||
| return; | return; | ||||
| } | |||||
| else if (duplicate.equals("fail")) | |||||
| { | |||||
| } else if (duplicate.equals("fail")) { | |||||
| throw new BuildException("Duplicate file " + vPath | throw new BuildException("Duplicate file " + vPath | ||||
| + " was found and the duplicate " | + " was found and the duplicate " | ||||
| + "attribute is 'fail'."); | + "attribute is 'fail'."); | ||||
| } | |||||
| else | |||||
| { | |||||
| } else { | |||||
| // duplicate equal to add, so we continue | // duplicate equal to add, so we continue | ||||
| log("duplicate file " + vPath | log("duplicate file " + vPath | ||||
| + " found, adding.", Project.MSG_VERBOSE); | + " found, adding.", Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } | |||||
| else | |||||
| { | |||||
| } else { | |||||
| log("adding entry " + vPath, Project.MSG_VERBOSE); | log("adding entry " + vPath, Project.MSG_VERBOSE); | ||||
| } | } | ||||
| @@ -794,8 +773,7 @@ public class Zip extends MatchingTask { | |||||
| } | } | ||||
| protected void zipFile(File file, ZipOutputStream zOut, String vPath) | protected void zipFile(File file, ZipOutputStream zOut, String vPath) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| if (file.equals(zipFile)) { | if (file.equals(zipFile)) { | ||||
| throw new BuildException("A zip file cannot include itself", | throw new BuildException("A zip file cannot include itself", | ||||
| location); | location); | ||||
| @@ -111,8 +111,7 @@ public class CompilerAdapterFactory { | |||||
| compilerType.equalsIgnoreCase("javac1.2")) { | compilerType.equalsIgnoreCase("javac1.2")) { | ||||
| if (isClassicCompilerSupported) { | if (isClassicCompilerSupported) { | ||||
| return new Javac12(); | return new Javac12(); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| throw new BuildException("This version of java does " | throw new BuildException("This version of java does " | ||||
| + "not support the classic compiler"); | + "not support the classic compiler"); | ||||
| } | } | ||||
| @@ -131,8 +130,7 @@ public class CompilerAdapterFactory { | |||||
| task.log("Modern compiler not found - looking for " | task.log("Modern compiler not found - looking for " | ||||
| + "classic compiler", Project.MSG_WARN); | + "classic compiler", Project.MSG_WARN); | ||||
| return new Javac12(); | return new Javac12(); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| throw new BuildException("Unable to find a javac compiler;\n" | throw new BuildException("Unable to find a javac compiler;\n" | ||||
| + "com.sun.tools.javac.Main is not on the classpath.\n" | + "com.sun.tools.javac.Main is not on the classpath.\n" | ||||
| + "Perhaps JAVA_HOME does not point to the JDK"); | + "Perhaps JAVA_HOME does not point to the JDK"); | ||||
| @@ -100,15 +100,13 @@ public class Javac12 extends DefaultCompilerAdapter { | |||||
| (Boolean) compile.invoke(compiler, | (Boolean) compile.invoke(compiler, | ||||
| new Object[] {cmd.getArguments()}); | new Object[] {cmd.getArguments()}); | ||||
| return ok.booleanValue(); | return ok.booleanValue(); | ||||
| } | |||||
| catch (ClassNotFoundException ex) { | |||||
| } catch (ClassNotFoundException ex) { | |||||
| throw new BuildException("Cannot use classic compiler, as it is " | throw new BuildException("Cannot use classic compiler, as it is " | ||||
| + "not available. A common solution is " | + "not available. A common solution is " | ||||
| + "to set the environment variable" | + "to set the environment variable" | ||||
| + " JAVA_HOME to your jdk directory.", | + " JAVA_HOME to your jdk directory.", | ||||
| location); | location); | ||||
| } | |||||
| catch (Exception ex) { | |||||
| } catch (Exception ex) { | |||||
| if (ex instanceof BuildException) { | if (ex instanceof BuildException) { | ||||
| throw (BuildException) ex; | throw (BuildException) ex; | ||||
| } else { | } else { | ||||
| @@ -88,15 +88,13 @@ public class Kjc extends DefaultCompilerAdapter { | |||||
| (Boolean) compile.invoke(null, | (Boolean) compile.invoke(null, | ||||
| new Object[] {cmd.getArguments()}); | new Object[] {cmd.getArguments()}); | ||||
| return ok.booleanValue(); | return ok.booleanValue(); | ||||
| } | |||||
| catch (ClassNotFoundException ex) { | |||||
| } catch (ClassNotFoundException ex) { | |||||
| throw new BuildException("Cannot use kjc compiler, as it is not " | throw new BuildException("Cannot use kjc compiler, as it is not " | ||||
| + "available. A common solution is to " | + "available. A common solution is to " | ||||
| + "set the environment variable CLASSPATH " | + "set the environment variable CLASSPATH " | ||||
| + "to your kjc archive (kjc.jar).", | + "to your kjc archive (kjc.jar).", | ||||
| location); | location); | ||||
| } | |||||
| catch (Exception ex) { | |||||
| } catch (Exception ex) { | |||||
| if (ex instanceof BuildException) { | if (ex instanceof BuildException) { | ||||
| throw (BuildException) ex; | throw (BuildException) ex; | ||||
| } else { | } else { | ||||
| @@ -147,14 +147,11 @@ class ChangeLogParser { | |||||
| m_comment = m_comment.substring(0, end); | m_comment = m_comment.substring(0, end); | ||||
| saveEntry(); | saveEntry(); | ||||
| m_status = GET_FILE; | m_status = GET_FILE; | ||||
| } | |||||
| else if (line.startsWith("----------------------------")) { | |||||
| } else if (line.startsWith("----------------------------")) { | |||||
| final int end = m_comment.length() - lineSeparator.length(); //was -1 | final int end = m_comment.length() - lineSeparator.length(); //was -1 | ||||
| m_comment = m_comment.substring(0, end); | m_comment = m_comment.substring(0, end); | ||||
| m_status = GET_PREVIOUS_REV; | m_status = GET_PREVIOUS_REV; | ||||
| } | |||||
| else | |||||
| { | |||||
| } else { | |||||
| m_comment += line + lineSeparator; | m_comment += line + lineSeparator; | ||||
| } | } | ||||
| } | } | ||||
| @@ -180,8 +177,7 @@ class ChangeLogParser { | |||||
| if (line.startsWith("revision")) { | if (line.startsWith("revision")) { | ||||
| m_revision = line.substring(9); | m_revision = line.substring(9); | ||||
| m_status = GET_DATE; | m_status = GET_DATE; | ||||
| } | |||||
| else if (line.startsWith("======")) { | |||||
| } else if (line.startsWith("======")) { | |||||
| //There was no revisions in this changelog | //There was no revisions in this changelog | ||||
| //entry so lets move unto next file | //entry so lets move unto next file | ||||
| m_status = GET_FILE; | m_status = GET_FILE; | ||||
| @@ -275,8 +275,7 @@ public class EchoProperties extends Task { | |||||
| *@param header prepend this header to the property output | *@param header prepend this header to the property output | ||||
| */ | */ | ||||
| protected void jdk10SaveProperties(Properties props, OutputStream os, | protected void jdk10SaveProperties(Properties props, OutputStream os, | ||||
| String header) | |||||
| { | |||||
| String header) { | |||||
| props.save(os, header); | props.save(os, header); | ||||
| } | } | ||||
| } | } | ||||
| @@ -321,13 +321,7 @@ public class Javah extends Task { | |||||
| com.sun.tools.javah.Main main | com.sun.tools.javah.Main main | ||||
| = new com.sun.tools.javah.Main(cmd.getArguments()); | = new com.sun.tools.javah.Main(cmd.getArguments()); | ||||
| main.run(); | main.run(); | ||||
| } | |||||
| //catch (ClassNotFoundException ex) { | |||||
| // throw new BuildException("Cannot use javah because it is not available"+ | |||||
| // " A common solution is to set the environment variable"+ | |||||
| // " JAVA_HOME to your jdk directory.", location); | |||||
| //} | |||||
| catch (Exception ex) { | |||||
| } catch (Exception ex) { | |||||
| if (ex instanceof BuildException) { | if (ex instanceof BuildException) { | ||||
| throw (BuildException) ex; | throw (BuildException) ex; | ||||
| } else { | } else { | ||||
| @@ -146,8 +146,7 @@ import java.text.DecimalFormat; | |||||
| * @author Jeremy Mawson <a href="mailto:jem@loftinspace.com.au">jem@loftinspace.com.au</a> | * @author Jeremy Mawson <a href="mailto:jem@loftinspace.com.au">jem@loftinspace.com.au</a> | ||||
| * @author Erik Hatcher <a href="mailto:ehatcher@apache.org">ehatcher@apache.org</a> | * @author Erik Hatcher <a href="mailto:ehatcher@apache.org">ehatcher@apache.org</a> | ||||
| */ | */ | ||||
| public class PropertyFile extends Task | |||||
| { | |||||
| public class PropertyFile extends Task { | |||||
| /* ======================================================================== | /* ======================================================================== | ||||
| * | * | ||||
| @@ -180,38 +179,31 @@ public class PropertyFile extends Task | |||||
| * Methods | * Methods | ||||
| */ | */ | ||||
| public void execute() throws BuildException | |||||
| { | |||||
| public void execute() throws BuildException { | |||||
| checkParameters(); | checkParameters(); | ||||
| readFile(); | readFile(); | ||||
| executeOperation(); | executeOperation(); | ||||
| writeFile(); | writeFile(); | ||||
| } | } | ||||
| public Entry createEntry() | |||||
| { | |||||
| public Entry createEntry() { | |||||
| Entry e = new Entry(); | Entry e = new Entry(); | ||||
| entries.addElement(e); | entries.addElement(e); | ||||
| return e; | return e; | ||||
| } | } | ||||
| private void executeOperation() throws BuildException | |||||
| { | |||||
| for (Enumeration e = entries.elements(); e.hasMoreElements();) | |||||
| { | |||||
| private void executeOperation() throws BuildException { | |||||
| for (Enumeration e = entries.elements(); e.hasMoreElements();) { | |||||
| Entry entry = (Entry) e.nextElement(); | Entry entry = (Entry) e.nextElement(); | ||||
| entry.executeOn(properties); | entry.executeOn(properties); | ||||
| } | } | ||||
| } | } | ||||
| private void readFile() throws BuildException | |||||
| { | |||||
| private void readFile() throws BuildException { | |||||
| // Create the PropertyFile | // Create the PropertyFile | ||||
| properties = new Properties(); | properties = new Properties(); | ||||
| try | |||||
| { | |||||
| if (propertyfile.exists()) | |||||
| { | |||||
| try { | |||||
| if (propertyfile.exists()) { | |||||
| log("Updating property file: " | log("Updating property file: " | ||||
| + propertyfile.getAbsolutePath()); | + propertyfile.getAbsolutePath()); | ||||
| FileInputStream fis = null; | FileInputStream fis = null; | ||||
| @@ -224,9 +216,7 @@ public class PropertyFile extends Task | |||||
| fis.close(); | fis.close(); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| else | |||||
| { | |||||
| } else { | |||||
| log("Creating new property file: " | log("Creating new property file: " | ||||
| + propertyfile.getAbsolutePath()); | + propertyfile.getAbsolutePath()); | ||||
| FileOutputStream out = null; | FileOutputStream out = null; | ||||
| @@ -244,29 +234,23 @@ public class PropertyFile extends Task | |||||
| } | } | ||||
| } | } | ||||
| private void checkParameters() throws BuildException | |||||
| { | |||||
| if (!checkParam(propertyfile)) | |||||
| { | |||||
| private void checkParameters() throws BuildException { | |||||
| if (!checkParam(propertyfile)) { | |||||
| throw new BuildException("file token must not be null.", location); | throw new BuildException("file token must not be null.", location); | ||||
| } | } | ||||
| } | } | ||||
| public void setFile(File file) | |||||
| { | |||||
| public void setFile(File file) { | |||||
| propertyfile = file; | propertyfile = file; | ||||
| } | } | ||||
| public void setComment(String hdr) | |||||
| { | |||||
| public void setComment(String hdr) { | |||||
| comment = hdr; | comment = hdr; | ||||
| } | } | ||||
| private void writeFile() throws BuildException | |||||
| { | |||||
| private void writeFile() throws BuildException { | |||||
| BufferedOutputStream bos = null; | BufferedOutputStream bos = null; | ||||
| try | |||||
| { | |||||
| try { | |||||
| bos = new BufferedOutputStream(new FileOutputStream(propertyfile)); | bos = new BufferedOutputStream(new FileOutputStream(propertyfile)); | ||||
| // Properties.store is not available in JDK 1.1 | // Properties.store is not available in JDK 1.1 | ||||
| @@ -287,8 +271,7 @@ public class PropertyFile extends Task | |||||
| throw new BuildException(iae, location); | throw new BuildException(iae, location); | ||||
| } catch (IOException ioe) { | } catch (IOException ioe) { | ||||
| throw new BuildException(ioe, location); | throw new BuildException(ioe, location); | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| if (bos != null) { | if (bos != null) { | ||||
| try { | try { | ||||
| bos.close(); | bos.close(); | ||||
| @@ -300,13 +283,11 @@ public class PropertyFile extends Task | |||||
| /* | /* | ||||
| * Returns whether the given parameter has been defined. | * Returns whether the given parameter has been defined. | ||||
| */ | */ | ||||
| private boolean checkParam(String param) | |||||
| { | |||||
| private boolean checkParam(String param) { | |||||
| return !((param == null) || (param.equals("null"))); | return !((param == null) || (param.equals("null"))); | ||||
| } | } | ||||
| private boolean checkParam(File param) | |||||
| { | |||||
| private boolean checkParam(File param) { | |||||
| return !(param == null); | return !(param == null); | ||||
| } | } | ||||
| @@ -314,8 +295,7 @@ public class PropertyFile extends Task | |||||
| * Instance of this class represents nested elements of | * Instance of this class represents nested elements of | ||||
| * a task propertyfile. | * a task propertyfile. | ||||
| */ | */ | ||||
| public static class Entry | |||||
| { | |||||
| public static class Entry { | |||||
| private final static int DEFAULT_INT_VALUE = 0; | private final static int DEFAULT_INT_VALUE = 0; | ||||
| private final static String DEFAULT_DATE_VALUE = "now"; | private final static String DEFAULT_DATE_VALUE = "now"; | ||||
| private final static String DEFAULT_STRING_VALUE = ""; | private final static String DEFAULT_STRING_VALUE = ""; | ||||
| @@ -328,28 +308,22 @@ public class PropertyFile extends Task | |||||
| private String pattern = null; | private String pattern = null; | ||||
| private int field = Calendar.DATE; | private int field = Calendar.DATE; | ||||
| public void setKey(String value) | |||||
| { | |||||
| public void setKey(String value) { | |||||
| this.key = value; | this.key = value; | ||||
| } | } | ||||
| public void setValue(String value) | |||||
| { | |||||
| public void setValue(String value) { | |||||
| this.value = value; | this.value = value; | ||||
| } | } | ||||
| public void setOperation(Operation value) | |||||
| { | |||||
| public void setOperation(Operation value) { | |||||
| this.operation = Operation.toOperation(value.getValue()); | this.operation = Operation.toOperation(value.getValue()); | ||||
| } | } | ||||
| public void setType(Type value) | |||||
| { | |||||
| public void setType(Type value) { | |||||
| this.type = Type.toType(value.getValue()); | this.type = Type.toType(value.getValue()); | ||||
| } | } | ||||
| public void setDefault(String value) | |||||
| { | |||||
| public void setDefault(String value) { | |||||
| this.defaultValue = value; | this.defaultValue = value; | ||||
| } | } | ||||
| public void setPattern(String value) | |||||
| { | |||||
| public void setPattern(String value) { | |||||
| this.pattern = value; | this.pattern = value; | ||||
| } | } | ||||
| @@ -360,27 +334,19 @@ public class PropertyFile extends Task | |||||
| field = unit.getCalendarField(); | field = unit.getCalendarField(); | ||||
| } | } | ||||
| protected void executeOn(Properties props) throws BuildException | |||||
| { | |||||
| protected void executeOn(Properties props) throws BuildException { | |||||
| checkParameters(); | checkParameters(); | ||||
| // type may be null because it wasn't set | // type may be null because it wasn't set | ||||
| String oldValue = (String) props.get(key); | String oldValue = (String) props.get(key); | ||||
| try { | try { | ||||
| if (type == Type.INTEGER_TYPE) | |||||
| { | |||||
| if (type == Type.INTEGER_TYPE) { | |||||
| executeInteger(oldValue); | executeInteger(oldValue); | ||||
| } | |||||
| else if (type == Type.DATE_TYPE) | |||||
| { | |||||
| } else if (type == Type.DATE_TYPE) { | |||||
| executeDate(oldValue); | executeDate(oldValue); | ||||
| } | |||||
| else if (type == Type.STRING_TYPE) | |||||
| { | |||||
| } else if (type == Type.STRING_TYPE) { | |||||
| executeString(oldValue); | executeString(oldValue); | ||||
| } | |||||
| else | |||||
| { | |||||
| } else { | |||||
| throw new BuildException("Unknown operation type: " | throw new BuildException("Unknown operation type: " | ||||
| + type); | + type); | ||||
| } | } | ||||
| @@ -405,8 +371,7 @@ public class PropertyFile extends Task | |||||
| * <code>null</code> if the <code>key</code> was | * <code>null</code> if the <code>key</code> was | ||||
| * not contained in the property file. | * not contained in the property file. | ||||
| */ | */ | ||||
| private void executeDate(String oldValue) throws BuildException | |||||
| { | |||||
| private void executeDate(String oldValue) throws BuildException { | |||||
| Calendar currentValue = Calendar.getInstance(); | Calendar currentValue = Calendar.getInstance(); | ||||
| if (pattern == null) { | if (pattern == null) { | ||||
| @@ -421,12 +386,12 @@ public class PropertyFile extends Task | |||||
| if ("now".equals(currentStringValue)) { | if ("now".equals(currentStringValue)) { | ||||
| currentValue.setTime(new Date()); | currentValue.setTime(new Date()); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| try { | try { | ||||
| currentValue.setTime(fmt.parse(currentStringValue)); | currentValue.setTime(fmt.parse(currentStringValue)); | ||||
| } catch (ParseException pe) { | |||||
| // swallow | |||||
| } | } | ||||
| catch (ParseException pe) { /* swollow */ } | |||||
| } | } | ||||
| if (operation != Operation.EQUALS_OPER) { | if (operation != Operation.EQUALS_OPER) { | ||||
| @@ -436,8 +401,7 @@ public class PropertyFile extends Task | |||||
| if (operation == Operation.DECREMENT_OPER) { | if (operation == Operation.DECREMENT_OPER) { | ||||
| offset = -1 * offset; | offset = -1 * offset; | ||||
| } | } | ||||
| } | |||||
| catch (NumberFormatException e) { | |||||
| } catch (NumberFormatException e) { | |||||
| throw new BuildException("Value not an integer on " + key); | throw new BuildException("Value not an integer on " + key); | ||||
| } | } | ||||
| currentValue.add(field, offset); | currentValue.add(field, offset); | ||||
| @@ -454,8 +418,7 @@ public class PropertyFile extends Task | |||||
| * <code>null</code> if the <code>key</code> was | * <code>null</code> if the <code>key</code> was | ||||
| * not contained in the property file. | * not contained in the property file. | ||||
| */ | */ | ||||
| private void executeInteger(String oldValue) throws BuildException | |||||
| { | |||||
| private void executeInteger(String oldValue) throws BuildException { | |||||
| int currentValue = DEFAULT_INT_VALUE; | int currentValue = DEFAULT_INT_VALUE; | ||||
| int newValue = DEFAULT_INT_VALUE; | int newValue = DEFAULT_INT_VALUE; | ||||
| @@ -464,25 +427,27 @@ public class PropertyFile extends Task | |||||
| : new DecimalFormat(); | : new DecimalFormat(); | ||||
| try { | try { | ||||
| currentValue = fmt.parse(getCurrentValue(oldValue)).intValue(); | currentValue = fmt.parse(getCurrentValue(oldValue)).intValue(); | ||||
| } catch (NumberFormatException nfe) { | |||||
| // swallow | |||||
| } catch (ParseException pe) { | |||||
| // swallow | |||||
| } | } | ||||
| catch (NumberFormatException nfe) { /* swollow */ } | |||||
| catch (ParseException pe) { /* swollow */ } | |||||
| if (operation == Operation.EQUALS_OPER) { | if (operation == Operation.EQUALS_OPER) { | ||||
| newValue = currentValue; | newValue = currentValue; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| int operationValue = 1; | int operationValue = 1; | ||||
| try { | try { | ||||
| operationValue = fmt.parse(value).intValue(); | operationValue = fmt.parse(value).intValue(); | ||||
| } catch (NumberFormatException nfe) { | |||||
| // swallow | |||||
| } catch (ParseException pe) { | |||||
| // swallow | |||||
| } | } | ||||
| catch (NumberFormatException nfe) { /* swollow */ } | |||||
| catch (ParseException pe) { /* swollow */ } | |||||
| if (operation == Operation.INCREMENT_OPER) { | if (operation == Operation.INCREMENT_OPER) { | ||||
| newValue = currentValue + operationValue; | newValue = currentValue + operationValue; | ||||
| } | |||||
| else if (operation == Operation.DECREMENT_OPER) { | |||||
| } else if (operation == Operation.DECREMENT_OPER) { | |||||
| newValue = currentValue - operationValue; | newValue = currentValue - operationValue; | ||||
| } | } | ||||
| } | } | ||||
| @@ -497,8 +462,7 @@ public class PropertyFile extends Task | |||||
| * <code>null</code> if the <code>key</code> was | * <code>null</code> if the <code>key</code> was | ||||
| * not contained in the property file. | * not contained in the property file. | ||||
| */ | */ | ||||
| private void executeString(String oldValue) throws BuildException | |||||
| { | |||||
| private void executeString(String oldValue) throws BuildException { | |||||
| String newValue = DEFAULT_STRING_VALUE; | String newValue = DEFAULT_STRING_VALUE; | ||||
| String currentValue = getCurrentValue(oldValue); | String currentValue = getCurrentValue(oldValue); | ||||
| @@ -509,8 +473,7 @@ public class PropertyFile extends Task | |||||
| if (operation == Operation.EQUALS_OPER) { | if (operation == Operation.EQUALS_OPER) { | ||||
| newValue = currentValue; | newValue = currentValue; | ||||
| } | |||||
| else if (operation == Operation.INCREMENT_OPER) { | |||||
| } else if (operation == Operation.INCREMENT_OPER) { | |||||
| newValue = currentValue + value; | newValue = currentValue + value; | ||||
| } | } | ||||
| value = newValue; | value = newValue; | ||||
| @@ -524,17 +487,20 @@ public class PropertyFile extends Task | |||||
| private void checkParameters() throws BuildException { | private void checkParameters() throws BuildException { | ||||
| if (type == Type.STRING_TYPE && | if (type == Type.STRING_TYPE && | ||||
| operation == Operation.DECREMENT_OPER) { | operation == Operation.DECREMENT_OPER) { | ||||
| throw new BuildException("- is not suported for string properties (key:" + key + ")"); | |||||
| throw new BuildException("- is not suported for string " | |||||
| + "properties (key:" + key + ")"); | |||||
| } | } | ||||
| if (value == null && defaultValue == null) { | if (value == null && defaultValue == null) { | ||||
| throw new BuildException("value and/or default must be specified (key:" + key + ")"); | |||||
| throw new BuildException("value and/or default must be " | |||||
| + "specified (key:" + key + ")"); | |||||
| } | } | ||||
| if (key == null) { | if (key == null) { | ||||
| throw new BuildException("key is mandatory"); | throw new BuildException("key is mandatory"); | ||||
| } | } | ||||
| if (type == Type.STRING_TYPE && | if (type == Type.STRING_TYPE && | ||||
| pattern != null) { | pattern != null) { | ||||
| throw new BuildException("pattern is not suported for string properties (key:" + key + ")"); | |||||
| throw new BuildException("pattern is not suported for string " | |||||
| + "properties (key:" + key + ")"); | |||||
| } | } | ||||
| } | } | ||||
| @@ -572,8 +538,7 @@ public class PropertyFile extends Task | |||||
| if (value != null && defaultValue != null && oldValue == null) { | if (value != null && defaultValue != null && oldValue == null) { | ||||
| ret = defaultValue; | ret = defaultValue; | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| ret = (oldValue == null) ? defaultValue : oldValue; | ret = (oldValue == null) ? defaultValue : oldValue; | ||||
| } | } | ||||
| @@ -597,8 +562,7 @@ public class PropertyFile extends Task | |||||
| public static int toOperation(String oper) { | public static int toOperation(String oper) { | ||||
| if ("+".equals(oper)) { | if ("+".equals(oper)) { | ||||
| return INCREMENT_OPER; | return INCREMENT_OPER; | ||||
| } | |||||
| else if ("-".equals(oper)) { | |||||
| } else if ("-".equals(oper)) { | |||||
| return DECREMENT_OPER; | return DECREMENT_OPER; | ||||
| } | } | ||||
| return EQUALS_OPER; | return EQUALS_OPER; | ||||
| @@ -622,8 +586,7 @@ public class PropertyFile extends Task | |||||
| public static int toType(String type) { | public static int toType(String type) { | ||||
| if ("int".equals(type)) { | if ("int".equals(type)) { | ||||
| return INTEGER_TYPE; | return INTEGER_TYPE; | ||||
| } | |||||
| else if ("date".equals(type)) { | |||||
| } else if ("date".equals(type)) { | |||||
| return DATE_TYPE; | return DATE_TYPE; | ||||
| } | } | ||||
| return STRING_TYPE; | return STRING_TYPE; | ||||
| @@ -145,16 +145,14 @@ public class Rpm extends Task { | |||||
| if (error == null && output == null) { | if (error == null && output == null) { | ||||
| streamhandler = new LogStreamHandler(this, Project.MSG_INFO, | streamhandler = new LogStreamHandler(this, Project.MSG_INFO, | ||||
| Project.MSG_WARN); | Project.MSG_WARN); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| if (output != null) { | if (output != null) { | ||||
| try { | try { | ||||
| outputstream = new PrintStream(new BufferedOutputStream(new FileOutputStream(output))); | outputstream = new PrintStream(new BufferedOutputStream(new FileOutputStream(output))); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| throw new BuildException(e, location); | throw new BuildException(e, location); | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| outputstream = new LogOutputStream(this, Project.MSG_INFO); | outputstream = new LogOutputStream(this, Project.MSG_INFO); | ||||
| } | } | ||||
| if (error != null) { | if (error != null) { | ||||
| @@ -163,8 +161,7 @@ public class Rpm extends Task { | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| throw new BuildException(e, location); | throw new BuildException(e, location); | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| errorstream = new LogOutputStream(this, Project.MSG_WARN); | errorstream = new LogOutputStream(this, Project.MSG_WARN); | ||||
| } | } | ||||
| streamhandler = new PumpStreamHandler(outputstream, errorstream); | streamhandler = new PumpStreamHandler(outputstream, errorstream); | ||||
| @@ -254,8 +254,7 @@ public class XMLValidateTask extends Task { | |||||
| if (file.exists() && file.canRead() && file.isFile()) { | if (file.exists() && file.canRead() && file.isFile()) { | ||||
| doValidate(file); | doValidate(file); | ||||
| fileProcessed++; | fileProcessed++; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| String errorMsg = "File " + file + " cannot be read"; | String errorMsg = "File " + file + " cannot be read"; | ||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException(errorMsg); | throw new BuildException(errorMsg); | ||||
| @@ -479,8 +478,7 @@ public class XMLValidateTask extends Task { | |||||
| } | } | ||||
| private class LocalResolver | private class LocalResolver | ||||
| implements EntityResolver | |||||
| { | |||||
| implements EntityResolver { | |||||
| private Hashtable fileDTDs = new Hashtable(); | private Hashtable fileDTDs = new Hashtable(); | ||||
| private Hashtable resourceDTDs = new Hashtable(); | private Hashtable resourceDTDs = new Hashtable(); | ||||
| private Hashtable urlDTDs = new Hashtable(); | private Hashtable urlDTDs = new Hashtable(); | ||||
| @@ -521,8 +519,7 @@ public class XMLValidateTask extends Task { | |||||
| } | } | ||||
| public InputSource resolveEntity(String publicId, String systemId) | public InputSource resolveEntity(String publicId, String systemId) | ||||
| throws SAXException | |||||
| { | |||||
| throws SAXException { | |||||
| File dtdFile = (File) fileDTDs.get(publicId); | File dtdFile = (File) fileDTDs.get(publicId); | ||||
| if (dtdFile != null) { | if (dtdFile != null) { | ||||
| try { | try { | ||||
| @@ -350,8 +350,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| log("error procession stream , null pointer exception", Project.MSG_ERR); | log("error procession stream , null pointer exception", Project.MSG_ERR); | ||||
| npe.printStackTrace(); | npe.printStackTrace(); | ||||
| throw new BuildException(npe.getClass().getName()); | throw new BuildException(npe.getClass().getName()); | ||||
| } // end of catch | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| log("error procession stream " + e.getMessage(), Project.MSG_ERR); | log("error procession stream " + e.getMessage(), Project.MSG_ERR); | ||||
| throw new BuildException(e.getMessage()); | throw new BuildException(e.getMessage()); | ||||
| } // end of try-catch | } // end of try-catch | ||||
| @@ -133,8 +133,7 @@ public abstract class ClearCase extends Task { | |||||
| exe.setWorkingDirectory(aProj.getBaseDir()); | exe.setWorkingDirectory(aProj.getBaseDir()); | ||||
| exe.setCommandline(cmd.getCommandline()); | exe.setCommandline(cmd.getCommandline()); | ||||
| return exe.execute(); | return exe.execute(); | ||||
| } | |||||
| catch (java.io.IOException e) { | |||||
| } catch (java.io.IOException e) { | |||||
| throw new BuildException(e, location); | throw new BuildException(e, location); | ||||
| } | } | ||||
| } | } | ||||
| @@ -231,8 +231,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| if (borlandDD.exists()) { | if (borlandDD.exists()) { | ||||
| log("Borland specific file found " + borlandDD, Project.MSG_VERBOSE); | log("Borland specific file found " + borlandDD, Project.MSG_VERBOSE); | ||||
| ejbFiles.put(META_DIR + BAS_DD, borlandDD); | ejbFiles.put(META_DIR + BAS_DD, borlandDD); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log("Unable to locate borland deployment descriptor. It was expected to be in " + | log("Unable to locate borland deployment descriptor. It was expected to be in " + | ||||
| borlandDD.getPath(), Project.MSG_WARN); | borlandDD.getPath(), Project.MSG_WARN); | ||||
| return; | return; | ||||
| @@ -265,8 +264,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| Commandline.Argument arguments = javaTask.createArg(); | Commandline.Argument arguments = javaTask.createArg(); | ||||
| arguments.setLine(args); | arguments.setLine(args); | ||||
| Path classpath = getCombinedClasspath(); | Path classpath = getCombinedClasspath(); | ||||
| if (classpath != null) | |||||
| { | |||||
| if (classpath != null) { | |||||
| javaTask.setClasspath(classpath); | javaTask.setClasspath(classpath); | ||||
| javaTask.setFork(true); | javaTask.setFork(true); | ||||
| } | } | ||||
| @@ -274,8 +272,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| log("Calling " + VERIFY + " for " + sourceJar.toString(), | log("Calling " + VERIFY + " for " + sourceJar.toString(), | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| javaTask.execute(); | javaTask.execute(); | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| //TO DO : delete the file if it is not a valid file. | //TO DO : delete the file if it is not a valid file. | ||||
| String msg = "Exception while calling " + VERIFY + " Details: " | String msg = "Exception while calling " + VERIFY + " Details: " | ||||
| + e.toString(); | + e.toString(); | ||||
| @@ -307,8 +304,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| } | } | ||||
| gentask.setTaskName("generate client"); | gentask.setTaskName("generate client"); | ||||
| gentask.execute(); | gentask.execute(); | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| //TO DO : delete the file if it is not a valid file. | //TO DO : delete the file if it is not a valid file. | ||||
| String msg = "Exception while calling " + VERIFY + " Details: " | String msg = "Exception while calling " + VERIFY + " Details: " | ||||
| + e.toString(); | + e.toString(); | ||||
| @@ -363,8 +359,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| + result + ")"; | + result + ")"; | ||||
| throw new BuildException(msg, getTask().getLocation()); | throw new BuildException(msg, getTask().getLocation()); | ||||
| } | } | ||||
| } | |||||
| catch (java.io.IOException e) { | |||||
| } catch (java.io.IOException e) { | |||||
| log("java2iiop exception :" + e.getMessage(), Project.MSG_ERR); | log("java2iiop exception :" + e.getMessage(), Project.MSG_ERR); | ||||
| throw new BuildException(e, getTask().getLocation()); | throw new BuildException(e, getTask().getLocation()); | ||||
| } | } | ||||
| @@ -439,8 +434,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| * @param is | * @param is | ||||
| * @exception java.io.IOException | * @exception java.io.IOException | ||||
| */ | */ | ||||
| public void setProcessOutputStream(InputStream is) throws IOException | |||||
| { | |||||
| public void setProcessOutputStream(InputStream is) throws IOException { | |||||
| try { | try { | ||||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | ||||
| String javafile; | String javafile; | ||||
| @@ -455,8 +449,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| } // end of if () | } // end of if () | ||||
| } // end of while () | } // end of while () | ||||
| reader.close(); | reader.close(); | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| String msg = "Exception while parsing java2iiop output. Details: " + e.toString(); | String msg = "Exception while parsing java2iiop output. Details: " + e.toString(); | ||||
| throw new BuildException(msg, e); | throw new BuildException(msg, e); | ||||
| } | } | ||||
| @@ -466,8 +459,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
| * @param param1 | * @param param1 | ||||
| * @exception java.io.IOException | * @exception java.io.IOException | ||||
| */ | */ | ||||
| public void setProcessErrorStream(InputStream is) throws IOException | |||||
| { | |||||
| public void setProcessErrorStream(InputStream is) throws IOException { | |||||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | ||||
| String s = reader.readLine(); | String s = reader.readLine(); | ||||
| if (s != null) { | if (s != null) { | ||||
| @@ -80,8 +80,7 @@ import org.apache.tools.ant.types.Reference; | |||||
| * | * | ||||
| * @ant.task name="blgenclient" category="ejb" | * @ant.task name="blgenclient" category="ejb" | ||||
| */ | */ | ||||
| public class BorlandGenerateClient extends Task | |||||
| { | |||||
| public class BorlandGenerateClient extends Task { | |||||
| final static String JAVA_MODE = "java"; | final static String JAVA_MODE = "java"; | ||||
| final static String FORK_MODE = "fork"; | final static String FORK_MODE = "fork"; | ||||
| @@ -118,8 +117,7 @@ public class BorlandGenerateClient extends Task | |||||
| public void setClasspath(Path classpath) { | public void setClasspath(Path classpath) { | ||||
| if (this.classpath == null) { | if (this.classpath == null) { | ||||
| this.classpath = classpath; | this.classpath = classpath; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| this.classpath.append(classpath); | this.classpath.append(classpath); | ||||
| } | } | ||||
| } | } | ||||
| @@ -167,8 +165,7 @@ public class BorlandGenerateClient extends Task | |||||
| if (mode.equalsIgnoreCase(FORK_MODE)) { | if (mode.equalsIgnoreCase(FORK_MODE)) { | ||||
| executeFork(); | executeFork(); | ||||
| } // end of if () | |||||
| else { | |||||
| } else { | |||||
| executeJava(); | executeJava(); | ||||
| } // end of else | } // end of else | ||||
| } | } | ||||
| @@ -207,8 +204,7 @@ public class BorlandGenerateClient extends Task | |||||
| log("Calling EJBUtilities", Project.MSG_VERBOSE); | log("Calling EJBUtilities", Project.MSG_VERBOSE); | ||||
| execTask.execute(); | execTask.execute(); | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| // Have to catch this because of the semantics of calling main() | // Have to catch this because of the semantics of calling main() | ||||
| String msg = "Exception while calling generateclient Details: " + e.toString(); | String msg = "Exception while calling generateclient Details: " + e.toString(); | ||||
| throw new BuildException(msg, e); | throw new BuildException(msg, e); | ||||
| @@ -242,8 +238,7 @@ public class BorlandGenerateClient extends Task | |||||
| log("Calling java2iiop", Project.MSG_VERBOSE); | log("Calling java2iiop", Project.MSG_VERBOSE); | ||||
| execTask.execute(); | execTask.execute(); | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| // Have to catch this because of the semantics of calling main() | // Have to catch this because of the semantics of calling main() | ||||
| String msg = "Exception while calling generateclient Details: " | String msg = "Exception while calling generateclient Details: " | ||||
| + e.toString(); | + e.toString(); | ||||
| @@ -125,8 +125,7 @@ public class DDCreatorHelper { | |||||
| String serName = null; | String serName = null; | ||||
| if (extIndex != -1) { | if (extIndex != -1) { | ||||
| serName = descriptorName.substring(0, extIndex) + ".ser"; | serName = descriptorName.substring(0, extIndex) + ".ser"; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| serName = descriptorName + ".ser"; | serName = descriptorName + ".ser"; | ||||
| } | } | ||||
| File serFile = new File(generatedFilesDirectory, serName); | File serFile = new File(generatedFilesDirectory, serName); | ||||
| @@ -141,8 +140,7 @@ public class DDCreatorHelper { | |||||
| descriptorFile.getPath()}; | descriptorFile.getPath()}; | ||||
| try { | try { | ||||
| weblogic.ejb.utils.DDCreator.main(args); | weblogic.ejb.utils.DDCreator.main(args); | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| // there was an exception - run with no exit to get proper error | // there was an exception - run with no exit to get proper error | ||||
| String[] newArgs = {"-d", generatedFilesDirectory.getPath(), | String[] newArgs = {"-d", generatedFilesDirectory.getPath(), | ||||
| "-outputfile", serFile.getName(), | "-outputfile", serFile.getName(), | ||||
| @@ -188,8 +188,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||||
| } | } | ||||
| public InputSource resolveEntity(String publicId, String systemId) | public InputSource resolveEntity(String publicId, String systemId) | ||||
| throws SAXException | |||||
| { | |||||
| throws SAXException { | |||||
| this.publicId = publicId; | this.publicId = publicId; | ||||
| File dtdFile = (File) fileDTDs.get(publicId); | File dtdFile = (File) fileDTDs.get(publicId); | ||||
| @@ -273,20 +272,15 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||||
| currentText = ""; | currentText = ""; | ||||
| if (name.equals(EJB_REF)) { | if (name.equals(EJB_REF)) { | ||||
| inEJBRef = true; | inEJBRef = true; | ||||
| } | |||||
| else if (parseState == STATE_LOOKING_EJBJAR && name.equals(EJB_JAR)) { | |||||
| } else if (parseState == STATE_LOOKING_EJBJAR && name.equals(EJB_JAR)) { | |||||
| parseState = STATE_IN_EJBJAR; | parseState = STATE_IN_EJBJAR; | ||||
| } | |||||
| else if (parseState == STATE_IN_EJBJAR && name.equals(ENTERPRISE_BEANS)) { | |||||
| } else if (parseState == STATE_IN_EJBJAR && name.equals(ENTERPRISE_BEANS)) { | |||||
| parseState = STATE_IN_BEANS; | parseState = STATE_IN_BEANS; | ||||
| } | |||||
| else if (parseState == STATE_IN_BEANS && name.equals(SESSION_BEAN)) { | |||||
| } else if (parseState == STATE_IN_BEANS && name.equals(SESSION_BEAN)) { | |||||
| parseState = STATE_IN_SESSION; | parseState = STATE_IN_SESSION; | ||||
| } | |||||
| else if (parseState == STATE_IN_BEANS && name.equals(ENTITY_BEAN)) { | |||||
| } else if (parseState == STATE_IN_BEANS && name.equals(ENTITY_BEAN)) { | |||||
| parseState = STATE_IN_ENTITY; | parseState = STATE_IN_ENTITY; | ||||
| } | |||||
| else if (parseState == STATE_IN_BEANS && name.equals(MESSAGE_BEAN)) { | |||||
| } else if (parseState == STATE_IN_BEANS && name.equals(MESSAGE_BEAN)) { | |||||
| parseState = STATE_IN_MESSAGE; | parseState = STATE_IN_MESSAGE; | ||||
| } | } | ||||
| } | } | ||||
| @@ -307,20 +301,15 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||||
| this.currentElement = ""; | this.currentElement = ""; | ||||
| if (name.equals(EJB_REF)) { | if (name.equals(EJB_REF)) { | ||||
| inEJBRef = false; | inEJBRef = false; | ||||
| } | |||||
| else if (parseState == STATE_IN_ENTITY && name.equals(ENTITY_BEAN)) { | |||||
| } else if (parseState == STATE_IN_ENTITY && name.equals(ENTITY_BEAN)) { | |||||
| parseState = STATE_IN_BEANS; | parseState = STATE_IN_BEANS; | ||||
| } | |||||
| else if (parseState == STATE_IN_SESSION && name.equals(SESSION_BEAN)) { | |||||
| } else if (parseState == STATE_IN_SESSION && name.equals(SESSION_BEAN)) { | |||||
| parseState = STATE_IN_BEANS; | parseState = STATE_IN_BEANS; | ||||
| } | |||||
| else if (parseState == STATE_IN_MESSAGE && name.equals(MESSAGE_BEAN)) { | |||||
| } else if (parseState == STATE_IN_MESSAGE && name.equals(MESSAGE_BEAN)) { | |||||
| parseState = STATE_IN_BEANS; | parseState = STATE_IN_BEANS; | ||||
| } | |||||
| else if (parseState == STATE_IN_BEANS && name.equals(ENTERPRISE_BEANS)) { | |||||
| } else if (parseState == STATE_IN_BEANS && name.equals(ENTERPRISE_BEANS)) { | |||||
| parseState = STATE_IN_EJBJAR; | parseState = STATE_IN_EJBJAR; | ||||
| } | |||||
| else if (parseState == STATE_IN_EJBJAR && name.equals(EJB_JAR)) { | |||||
| } else if (parseState == STATE_IN_EJBJAR && name.equals(EJB_JAR)) { | |||||
| parseState = STATE_LOOKING_EJBJAR; | parseState = STATE_LOOKING_EJBJAR; | ||||
| } | } | ||||
| } | } | ||||
| @@ -229,13 +229,11 @@ public class EjbcHelper { | |||||
| primaryKeyClassSource.lastModified() > classModificationTime) { | primaryKeyClassSource.lastModified() > classModificationTime) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | |||||
| catch (Throwable descriptorLoadException) { | |||||
| } 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 | // any problems - just regenerate | ||||
| return true; | return true; | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| if (fis != null) { | if (fis != null) { | ||||
| fis.close(); | fis.close(); | ||||
| } | } | ||||
| @@ -257,8 +255,7 @@ public class EjbcHelper { | |||||
| if (isRegenRequired(descriptorFile)) { | if (isRegenRequired(descriptorFile)) { | ||||
| System.out.println("Running ejbc for " + descriptorFile.getName()); | System.out.println("Running ejbc for " + descriptorFile.getName()); | ||||
| regenerateSupportClasses(descriptorFile); | regenerateSupportClasses(descriptorFile); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| System.out.println(descriptorFile.getName() + " is up to date"); | 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"; | ||||
| @@ -285,8 +282,7 @@ public class EjbcHelper { | |||||
| try { | try { | ||||
| weblogic.ejbc.main(args); | weblogic.ejbc.main(args); | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| // run with no exit for better reporting | // run with no exit for better reporting | ||||
| String[] newArgs = getCommandLine(true, descriptorFile); | String[] newArgs = getCommandLine(true, descriptorFile); | ||||
| weblogic.ejbc.main(newArgs); | weblogic.ejbc.main(newArgs); | ||||
| @@ -1208,8 +1208,7 @@ public class IPlanetEjbc { | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| latestModified = Math.max(latestModified, modified); | latestModified = Math.max(latestModified, modified); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| pkFile = null; | pkFile = null; | ||||
| } | } | ||||
| @@ -293,8 +293,7 @@ public class IPlanetEjbcTask extends Task { | |||||
| } catch (SAXException e) { | } catch (SAXException e) { | ||||
| String msg = "Unable to create a SAXParser: " + e.getMessage(); | String msg = "Unable to create a SAXParser: " + e.getMessage(); | ||||
| throw new BuildException(msg, e, location); | throw new BuildException(msg, e, location); | ||||
| } | |||||
| catch (ParserConfigurationException e) { | |||||
| } catch (ParserConfigurationException e) { | |||||
| String msg = "Unable to create a SAXParser: " + e.getMessage(); | String msg = "Unable to create a SAXParser: " + e.getMessage(); | ||||
| throw new BuildException(msg, e, location); | throw new BuildException(msg, e, location); | ||||
| } | } | ||||
| @@ -114,8 +114,7 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||||
| if (toplinkDD.exists()) { | if (toplinkDD.exists()) { | ||||
| ejbFiles.put(META_DIR + toplinkDescriptor, | ejbFiles.put(META_DIR + toplinkDescriptor, | ||||
| toplinkDD); | toplinkDD); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log("Unable to locate toplink deployment descriptor. It was expected to be in " + | log("Unable to locate toplink deployment descriptor. It was expected to be in " + | ||||
| toplinkDD.getPath(), Project.MSG_WARN); | toplinkDD.getPath(), Project.MSG_WARN); | ||||
| } | } | ||||
| @@ -117,8 +117,7 @@ public class VAJAntTool { | |||||
| if (args.length >= 2 && args[1] instanceof String) { | if (args.length >= 2 && args[1] instanceof String) { | ||||
| String projectName = (String) args[1]; | String projectName = (String) args[1]; | ||||
| info = loadBuildData(projectName); | info = loadBuildData(projectName); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| info = new VAJBuildInfo(); | info = new VAJBuildInfo(); | ||||
| } | } | ||||
| @@ -209,8 +209,7 @@ public class VAJAntToolGUI extends Frame { | |||||
| if (error == null) { | if (error == null) { | ||||
| getMessageTextArea().append(lineSeparator + "BUILD SUCCESSFUL"); | getMessageTextArea().append(lineSeparator + "BUILD SUCCESSFUL"); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| logException(error); | logException(error); | ||||
| } | } | ||||
| @@ -232,8 +231,7 @@ public class VAJAntToolGUI extends Frame { | |||||
| if (nested != null) { | if (nested != null) { | ||||
| nested.printStackTrace(System.err); | nested.printStackTrace(System.err); | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| error.printStackTrace(System.err); | error.printStackTrace(System.err); | ||||
| } | } | ||||
| } | } | ||||
| @@ -339,8 +337,7 @@ public class VAJAntToolGUI extends Frame { | |||||
| try { | try { | ||||
| getBuildInfo().updateTargetList(); | getBuildInfo().updateTargetList(); | ||||
| fillList(); | fillList(); | ||||
| } | |||||
| catch (Throwable fileNotFound) { | |||||
| } catch (Throwable fileNotFound) { | |||||
| handleException(fileNotFound); | handleException(fileNotFound); | ||||
| getTargetList().removeAll(); | getTargetList().removeAll(); | ||||
| getBuildButton().setEnabled(false); | getBuildButton().setEnabled(false); | ||||
| @@ -370,8 +367,7 @@ public class VAJAntToolGUI extends Frame { | |||||
| if (e.getSource() == VAJAntToolGUI.this.getMessageOkButton()) { | if (e.getSource() == VAJAntToolGUI.this.getMessageOkButton()) { | ||||
| getMessageFrame().dispose(); | getMessageFrame().dispose(); | ||||
| } | } | ||||
| } | |||||
| catch (Throwable exc) { | |||||
| } catch (Throwable exc) { | |||||
| handleException(exc); | handleException(exc); | ||||
| } | } | ||||
| } | } | ||||
| @@ -390,8 +386,7 @@ public class VAJAntToolGUI extends Frame { | |||||
| if (e.getSource() == VAJAntToolGUI.this.getTargetList()) { | if (e.getSource() == VAJAntToolGUI.this.getTargetList()) { | ||||
| getBuildInfo().setTarget(getTargetList().getSelectedItem()); | getBuildInfo().setTarget(getTargetList().getSelectedItem()); | ||||
| } | } | ||||
| } | |||||
| catch (Throwable exc) { | |||||
| } catch (Throwable exc) { | |||||
| handleException(exc); | handleException(exc); | ||||
| } | } | ||||
| } | } | ||||
| @@ -432,8 +427,7 @@ public class VAJAntToolGUI extends Frame { | |||||
| if (e.getSource() == VAJAntToolGUI.this.getMessageFrame()) { | if (e.getSource() == VAJAntToolGUI.this.getMessageFrame()) { | ||||
| getMessageFrame().dispose(); | getMessageFrame().dispose(); | ||||
| } | } | ||||
| } | |||||
| catch (Throwable exc) { | |||||
| } catch (Throwable exc) { | |||||
| handleException(exc); | handleException(exc); | ||||
| } | } | ||||
| } | } | ||||
| @@ -524,8 +518,7 @@ public class VAJAntToolGUI extends Frame { | |||||
| try { | try { | ||||
| getMessageFrame().show(); | getMessageFrame().show(); | ||||
| getBuildInfo().executeProject(logger); | getBuildInfo().executeProject(logger); | ||||
| } | |||||
| catch (Throwable exc) { | |||||
| } catch (Throwable exc) { | |||||
| logger.logException(exc); | logger.logException(exc); | ||||
| } | } | ||||
| return; | return; | ||||
| @@ -1346,8 +1339,7 @@ public class VAJAntToolGUI extends Frame { | |||||
| private void saveBuildInfo() { | private void saveBuildInfo() { | ||||
| try { | try { | ||||
| VAJAntTool.saveBuildData(getBuildInfo()); | VAJAntTool.saveBuildData(getBuildInfo()); | ||||
| } | |||||
| catch (Throwable exc) { | |||||
| } catch (Throwable exc) { | |||||
| // This Exception occurs when you try to write into a versioned project | // This Exception occurs when you try to write into a versioned project | ||||
| handleException(exc); | handleException(exc); | ||||
| } | } | ||||
| @@ -350,8 +350,7 @@ abstract class VAJLocalUtil implements VAJUtil{ | |||||
| Type[] importedTypes = getWorkspace().importData(importSpec); | Type[] importedTypes = getWorkspace().importData(importSpec); | ||||
| if (importedTypes == null) { | if (importedTypes == null) { | ||||
| throw new BuildException("Unable to import into Workspace!"); | throw new BuildException("Unable to import into Workspace!"); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log(importedTypes.length + " types imported", MSG_DEBUG); | log(importedTypes.length + " types imported", MSG_DEBUG); | ||||
| for (int i = 0; i < importedTypes.length; i++) { | for (int i = 0; i < importedTypes.length; i++) { | ||||
| log(importedTypes[i].getPackage().getName() | log(importedTypes[i].getPackage().getName() | ||||
| @@ -428,11 +427,9 @@ abstract class VAJLocalUtil implements VAJUtil{ | |||||
| * @param fileType type of files (Source/Class/Resource) | * @param fileType type of files (Source/Class/Resource) | ||||
| * @param summaryLog buffer for logging | * @param summaryLog buffer for logging | ||||
| */ | */ | ||||
| private void addFilesToImport( | |||||
| ImportCodeSpec spec, boolean doImport, | |||||
| private void addFilesToImport(ImportCodeSpec spec, boolean doImport, | |||||
| Vector files, String fileType, | Vector files, String fileType, | ||||
| StringBuffer summaryLog) | |||||
| { | |||||
| StringBuffer summaryLog) { | |||||
| if (doImport) { | if (doImport) { | ||||
| String[] fileArr = new String[files.size()]; | String[] fileArr = new String[files.size()]; | ||||
| @@ -80,8 +80,7 @@ import org.apache.tools.ant.types.Path; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool | * @see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool | ||||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | ||||
| */ | */ | ||||
| public abstract class AbstractHotDeploymentTool implements HotDeploymentTool | |||||
| { | |||||
| public abstract class AbstractHotDeploymentTool implements HotDeploymentTool { | |||||
| /** The parent task **/ | /** The parent task **/ | ||||
| private ServerDeploy task; | private ServerDeploy task; | ||||
| @@ -69,8 +69,7 @@ import org.apache.tools.ant.taskdefs.Java; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool | * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool | ||||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | ||||
| */ | */ | ||||
| public class GenericHotDeploymentTool extends AbstractHotDeploymentTool | |||||
| { | |||||
| public class GenericHotDeploymentTool extends AbstractHotDeploymentTool { | |||||
| /** A Java task used to run the deployment tool **/ | /** A Java task used to run the deployment tool **/ | ||||
| private Java java; | private Java java; | ||||
| @@ -63,8 +63,7 @@ import org.apache.tools.ant.BuildException; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool | * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool | ||||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | ||||
| */ | */ | ||||
| public interface HotDeploymentTool | |||||
| { | |||||
| public interface HotDeploymentTool { | |||||
| /** The delete action String **/ | /** The delete action String **/ | ||||
| public static final String ACTION_DELETE = "delete"; | public static final String ACTION_DELETE = "delete"; | ||||
| @@ -241,11 +241,9 @@ public class JonasHotDeploymentTool extends GenericHotDeploymentTool implements | |||||
| action.equals(ACTION_UPDATE) || | action.equals(ACTION_UPDATE) || | ||||
| action.equals("redeploy")) { | action.equals("redeploy")) { | ||||
| java.createArg().setLine("-a " + getTask().getSource()); | java.createArg().setLine("-a " + getTask().getSource()); | ||||
| } | |||||
| else if (action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY)) { | |||||
| } else if (action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY)) { | |||||
| java.createArg().setLine("-r " + getTask().getSource()); | java.createArg().setLine("-r " + getTask().getSource()); | ||||
| } | |||||
| else if (action.equals(ACTION_LIST)) { | |||||
| } else if (action.equals(ACTION_LIST)) { | |||||
| java.createArg().setValue("-l"); | java.createArg().setValue("-l"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -74,8 +74,7 @@ import org.apache.tools.ant.Task; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.GenericHotDeploymentTool | * @see org.apache.tools.ant.taskdefs.optional.j2ee.GenericHotDeploymentTool | ||||
| * @see org.apache.tools.ant.taskdefs.optional.j2ee.WebLogicHotDeploymentTool | * @see org.apache.tools.ant.taskdefs.optional.j2ee.WebLogicHotDeploymentTool | ||||
| */ | */ | ||||
| public class ServerDeploy extends Task | |||||
| { | |||||
| public class ServerDeploy extends Task { | |||||
| /** The action to be performed. IE: "deploy", "delete", etc... **/ | /** The action to be performed. IE: "deploy", "delete", etc... **/ | ||||
| private String action; | private String action; | ||||
| @@ -96,8 +96,7 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool impleme | |||||
| * tools is executed. | * tools is executed. | ||||
| * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. | * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. | ||||
| */ | */ | ||||
| public void deploy() | |||||
| { | |||||
| public void deploy() { | |||||
| Java java = (Java) getTask().getProject().createTask("java"); | Java java = (Java) getTask().getProject().createTask("java"); | ||||
| java.setFork(true); | java.setFork(true); | ||||
| java.setFailonerror(true); | java.setFailonerror(true); | ||||
| @@ -219,8 +219,7 @@ public class JJTree extends Task { | |||||
| if (process.execute() != 0) { | if (process.execute() != 0) { | ||||
| throw new BuildException("JJTree failed."); | throw new BuildException("JJTree failed."); | ||||
| } | } | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| throw new BuildException("Failed to launch JJTree", e); | throw new BuildException("Failed to launch JJTree", e); | ||||
| } | } | ||||
| } | } | ||||
| @@ -224,8 +224,7 @@ public class JavaCC extends Task { | |||||
| // use the directory containing the target as the output directory | // use the directory containing the target as the output directory | ||||
| if (outputDirectory == null) { | if (outputDirectory == null) { | ||||
| outputDirectory = new File(target.getParent()); | outputDirectory = new File(target.getParent()); | ||||
| } | |||||
| else if (!outputDirectory.isDirectory()) { | |||||
| } else if (!outputDirectory.isDirectory()) { | |||||
| throw new BuildException("Outputdir not a directory."); | throw new BuildException("Outputdir not a directory."); | ||||
| } | } | ||||
| cmdl.createArgument().setValue("-OUTPUT_DIRECTORY:" | cmdl.createArgument().setValue("-OUTPUT_DIRECTORY:" | ||||
| @@ -281,8 +280,7 @@ public class JavaCC extends Task { | |||||
| * file. | * file. | ||||
| * | * | ||||
| */ | */ | ||||
| private File getOutputJavaFile(File outputdir, File srcfile) | |||||
| { | |||||
| private File getOutputJavaFile(File outputdir, File srcfile) { | |||||
| String path = srcfile.getPath(); | String path = srcfile.getPath(); | ||||
| // Extract file's base-name | // Extract file's base-name | ||||
| @@ -295,8 +293,7 @@ public class JavaCC extends Task { | |||||
| int startExtn = path.lastIndexOf('.'); | int startExtn = path.lastIndexOf('.'); | ||||
| if (startExtn != -1) { | if (startExtn != -1) { | ||||
| path = path.substring(0, startExtn) + ".java"; | path = path.substring(0, startExtn) + ".java"; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| path += ".java"; | path += ".java"; | ||||
| } | } | ||||
| @@ -228,17 +228,14 @@ public class JDependTask extends Task { | |||||
| } | } | ||||
| public void setFormat(FormatAttribute ea) | |||||
| { | |||||
| public void setFormat(FormatAttribute ea) { | |||||
| format = ea.getValue(); | format = ea.getValue(); | ||||
| } | } | ||||
| public static class FormatAttribute extends EnumeratedAttribute | |||||
| { | |||||
| public static class FormatAttribute extends EnumeratedAttribute { | |||||
| private String [] formats = new String[]{"xml", "text"}; | private String [] formats = new String[]{"xml", "text"}; | ||||
| public String[] getValues() | |||||
| { | |||||
| public String[] getValues() { | |||||
| return formats; | return formats; | ||||
| } | } | ||||
| } | } | ||||
| @@ -324,8 +321,7 @@ public class JDependTask extends Task { | |||||
| FileWriter fw; | FileWriter fw; | ||||
| try { | try { | ||||
| fw = new FileWriter(getOutputFile().getPath()); | fw = new FileWriter(getOutputFile().getPath()); | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| String msg = "JDepend Failed when creating the output file: " | String msg = "JDepend Failed when creating the output file: " | ||||
| + e.getMessage(); | + e.getMessage(); | ||||
| log(msg); | log(msg); | ||||
| @@ -349,8 +345,7 @@ public class JDependTask extends Task { | |||||
| } | } | ||||
| try { | try { | ||||
| jdepend.addDirectory(f.getPath()); | jdepend.addDirectory(f.getPath()); | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| String msg = "JDepend Failed when adding a source directory: " | String msg = "JDepend Failed when adding a source directory: " | ||||
| + e.getMessage(); | + e.getMessage(); | ||||
| log(msg); | log(msg); | ||||
| @@ -86,8 +86,7 @@ class ConstantPool { | |||||
| for (int i = 1; i < count; i++) { | for (int i = 1; i < count; i++) { | ||||
| byte type = data.readByte(); | byte type = data.readByte(); | ||||
| types[i] = type; | types[i] = type; | ||||
| switch (type) | |||||
| { | |||||
| switch (type) { | |||||
| case UTF8 : | case UTF8 : | ||||
| values[i] = data.readUTF(); | values[i] = data.readUTF(); | ||||
| break; | break; | ||||
| @@ -112,8 +112,7 @@ public class JlinkTask extends MatchingTask { | |||||
| public void setMergefiles(Path mergefiles) { | public void setMergefiles(Path mergefiles) { | ||||
| if (this.mergefiles == null) { | if (this.mergefiles == null) { | ||||
| this.mergefiles = mergefiles; | this.mergefiles = mergefiles; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| this.mergefiles.append(mergefiles); | this.mergefiles.append(mergefiles); | ||||
| } | } | ||||
| } | } | ||||
| @@ -135,8 +134,7 @@ public class JlinkTask extends MatchingTask { | |||||
| public void setAddfiles(Path addfiles) { | public void setAddfiles(Path addfiles) { | ||||
| if (this.addfiles == null) { | if (this.addfiles == null) { | ||||
| this.addfiles = addfiles; | this.addfiles = addfiles; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| this.addfiles.append(addfiles); | this.addfiles.append(addfiles); | ||||
| } | } | ||||
| } | } | ||||
| @@ -110,8 +110,7 @@ import org.apache.tools.ant.types.Reference; | |||||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | ||||
| * @since 1.5 | * @since 1.5 | ||||
| */ | */ | ||||
| public class JspC extends MatchingTask | |||||
| { | |||||
| public class JspC extends MatchingTask { | |||||
| /* ------------------------------------------------------------ */ | /* ------------------------------------------------------------ */ | ||||
| private Path classpath; | private Path classpath; | ||||
| private Path src; | private Path src; | ||||
| @@ -226,23 +225,19 @@ public class JspC extends MatchingTask | |||||
| return failOnError; | return failOnError; | ||||
| } | } | ||||
| /* ------------------------------------------------------------ */ | /* ------------------------------------------------------------ */ | ||||
| public String getIeplugin() | |||||
| { | |||||
| public String getIeplugin() { | |||||
| return iepluginid; | return iepluginid; | ||||
| } | } | ||||
| /** Set the ieplugin id */ | /** Set the ieplugin id */ | ||||
| public void setIeplugin(String iepluginid_) | |||||
| { | |||||
| public void setIeplugin(String iepluginid_) { | |||||
| iepluginid = iepluginid_; | iepluginid = iepluginid_; | ||||
| } | } | ||||
| /* ------------------------------------------------------------ */ | /* ------------------------------------------------------------ */ | ||||
| public boolean isMapped() | |||||
| { | |||||
| public boolean isMapped() { | |||||
| return mapped; | return mapped; | ||||
| } | } | ||||
| /** set the mapped flag */ | /** set the mapped flag */ | ||||
| public void setMapped(boolean mapped_) | |||||
| { | |||||
| public void setMapped(boolean mapped_) { | |||||
| mapped = mapped_; | mapped = mapped_; | ||||
| } | } | ||||
| @@ -338,8 +333,7 @@ public class JspC extends MatchingTask | |||||
| //demand create vector of filesets | //demand create vector of filesets | ||||
| if (webApp == null) { | if (webApp == null) { | ||||
| webApp = webappParam; | webApp = webappParam; | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| throw new BuildException("Only one webapp can be specified"); | throw new BuildException("Only one webapp can be specified"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -429,12 +423,10 @@ public class JspC extends MatchingTask | |||||
| + dest); | + dest); | ||||
| doCompilation(compiler); | doCompilation(compiler); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| if (filecount == 0) { | if (filecount == 0) { | ||||
| log("there were no files to compile", Project.MSG_INFO); | log("there were no files to compile", Project.MSG_INFO); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log("all files are up to date", Project.MSG_VERBOSE); | log("all files are up to date", Project.MSG_VERBOSE); | ||||
| } | } | ||||
| } | } | ||||
| @@ -468,8 +460,7 @@ public class JspC extends MatchingTask | |||||
| if (!compiler.execute()) { | if (!compiler.execute()) { | ||||
| if (failOnError) { | if (failOnError) { | ||||
| throw new BuildException(FAIL_MSG, location); | throw new BuildException(FAIL_MSG, location); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| log(FAIL_MSG, Project.MSG_ERR); | log(FAIL_MSG, Project.MSG_ERR); | ||||
| } | } | ||||
| } | } | ||||
| @@ -121,8 +121,7 @@ public class JspNameMangler implements JspMangler { | |||||
| char firstChar = className.charAt(0); | char firstChar = className.charAt(0); | ||||
| if (Character.isJavaIdentifierStart(firstChar)) { | if (Character.isJavaIdentifierStart(firstChar)) { | ||||
| modifiedClassName.append(firstChar); | modifiedClassName.append(firstChar); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| modifiedClassName.append(mangleChar(firstChar)); | modifiedClassName.append(mangleChar(firstChar)); | ||||
| } | } | ||||
| // this is the rest | // this is the rest | ||||
| @@ -130,8 +129,7 @@ public class JspNameMangler implements JspMangler { | |||||
| char subChar = className.charAt(i); | char subChar = className.charAt(i); | ||||
| if (Character.isJavaIdentifierPart(subChar)) { | if (Character.isJavaIdentifierPart(subChar)) { | ||||
| modifiedClassName.append(subChar); | modifiedClassName.append(subChar); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| modifiedClassName.append(mangleChar(subChar)); | modifiedClassName.append(mangleChar(subChar)); | ||||
| } | } | ||||
| } | } | ||||
| @@ -150,8 +148,7 @@ public class JspNameMangler implements JspMangler { | |||||
| String filename = jspFile.getName(); | String filename = jspFile.getName(); | ||||
| if (filename.endsWith(".jsp")) { | if (filename.endsWith(".jsp")) { | ||||
| className = filename.substring(0, filename.length() - 4); | className = filename.substring(0, filename.length() - 4); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| className = filename; | className = filename; | ||||
| } | } | ||||
| return className; | return className; | ||||
| @@ -113,8 +113,7 @@ import java.util.StringTokenizer; | |||||
| * | * | ||||
| */ | */ | ||||
| public class WLJspc extends MatchingTask | |||||
| { | |||||
| public class WLJspc extends MatchingTask { | |||||
| //TODO Test on other versions of weblogic | //TODO Test on other versions of weblogic | ||||
| //TODO add more attributes to the task, to take care of all jspc options | //TODO add more attributes to the task, to take care of all jspc options | ||||
| //TODO Test on Unix | //TODO Test on Unix | ||||
| @@ -83,8 +83,7 @@ public abstract class DefaultJspCompilerAdapter | |||||
| */ | */ | ||||
| protected void logAndAddFilesToCompile(JspC jspc, | protected void logAndAddFilesToCompile(JspC jspc, | ||||
| Vector compileList, | Vector compileList, | ||||
| Commandline cmd) | |||||
| { | |||||
| Commandline cmd) { | |||||
| jspc.log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE); | jspc.log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE); | ||||
| StringBuffer niceSourceList = new StringBuffer("File"); | StringBuffer niceSourceList = new StringBuffer("File"); | ||||
| @@ -73,8 +73,7 @@ import java.io.File; | |||||
| * @author steve loughran | * @author steve loughran | ||||
| * @since ant1.5 | * @since ant1.5 | ||||
| */ | */ | ||||
| public class JasperC extends DefaultJspCompilerAdapter | |||||
| { | |||||
| public class JasperC extends DefaultJspCompilerAdapter { | |||||
| /** | /** | ||||
| * our execute method | * our execute method | ||||
| */ | */ | ||||
| @@ -90,8 +89,7 @@ public class JasperC extends DefaultJspCompilerAdapter | |||||
| Java java = (Java) (getJspc().getProject()).createTask("java"); | Java java = (Java) (getJspc().getProject()).createTask("java"); | ||||
| if (getJspc().getClasspath() != null) { | if (getJspc().getClasspath() != null) { | ||||
| java.setClasspath(getJspc().getClasspath()); | java.setClasspath(getJspc().getClasspath()); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| java.setClasspath(Path.systemClasspath); | java.setClasspath(Path.systemClasspath); | ||||
| } | } | ||||
| java.setClassname("org.apache.jasper.JspC"); | java.setClassname("org.apache.jasper.JspC"); | ||||
| @@ -105,8 +103,7 @@ public class JasperC extends DefaultJspCompilerAdapter | |||||
| java.setFork(true); | java.setFork(true); | ||||
| java.execute(); | java.execute(); | ||||
| return true; | return true; | ||||
| } | |||||
| catch (Exception ex) { | |||||
| } catch (Exception ex) { | |||||
| //@todo implement failonerror support here? | //@todo implement failonerror support here? | ||||
| if (ex instanceof BuildException) { | if (ex instanceof BuildException) { | ||||
| throw (BuildException) ex; | throw (BuildException) ex; | ||||
| @@ -114,8 +111,7 @@ public class JasperC extends DefaultJspCompilerAdapter | |||||
| throw new BuildException("Error running jsp compiler: ", | throw new BuildException("Error running jsp compiler: ", | ||||
| ex, getJspc().getLocation()); | ex, getJspc().getLocation()); | ||||
| } | } | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| getJspc().deleteEmptyJavaFiles(); | getJspc().deleteEmptyJavaFiles(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -91,8 +91,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan | |||||
| private static DocumentBuilder getDocumentBuilder() { | private static DocumentBuilder getDocumentBuilder() { | ||||
| try { | try { | ||||
| return DocumentBuilderFactory.newInstance().newDocumentBuilder(); | return DocumentBuilderFactory.newInstance().newDocumentBuilder(); | ||||
| } | |||||
| catch (Exception exc) { | |||||
| } catch (Exception exc) { | |||||
| throw new ExceptionInInitializerError(exc); | throw new ExceptionInInitializerError(exc); | ||||
| } | } | ||||
| } | } | ||||
| @@ -69,16 +69,14 @@ import org.apache.tools.ant.taskdefs.email.EmailTask; | |||||
| * @author ehatcher@apache.org Erik Hatcher | * @author ehatcher@apache.org Erik Hatcher | ||||
| * @author paulo.gaspar@krankikom.de Paulo Gaspar | * @author paulo.gaspar@krankikom.de Paulo Gaspar | ||||
| */ | */ | ||||
| public class MimeMail extends EmailTask | |||||
| { | |||||
| public class MimeMail extends EmailTask { | |||||
| /** | /** | ||||
| * Executes this build task. | * Executes this build task. | ||||
| * | * | ||||
| * @exception BuildException On error. | * @exception BuildException On error. | ||||
| */ | */ | ||||
| public void execute() | public void execute() | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| log("DEPRECATED - The " + getTaskName() + " task is deprecated. " | log("DEPRECATED - The " + getTaskName() + " task is deprecated. " | ||||
| + "Use the mail task instead."); | + "Use the mail task instead."); | ||||
| super.execute(); | super.execute(); | ||||
| @@ -120,8 +120,7 @@ public class TelnetTask extends Task { | |||||
| * Connect and possibly login | * Connect and possibly login | ||||
| * Iterate through the list of Reads and writes | * Iterate through the list of Reads and writes | ||||
| */ | */ | ||||
| public void execute() throws BuildException | |||||
| { | |||||
| public void execute() throws BuildException { | |||||
| /** A server name is required to continue */ | /** A server name is required to continue */ | ||||
| if (server == null) { | if (server == null) { | ||||
| throw new BuildException("No Server Specified"); | throw new BuildException("No Server Specified"); | ||||
| @@ -149,8 +148,7 @@ public class TelnetTask extends Task { | |||||
| } | } | ||||
| /** Process each sub command */ | /** Process each sub command */ | ||||
| Enumeration tasksToRun = telnetTasks.elements(); | Enumeration tasksToRun = telnetTasks.elements(); | ||||
| while (tasksToRun != null && tasksToRun.hasMoreElements()) | |||||
| { | |||||
| while (tasksToRun != null && tasksToRun.hasMoreElements()) { | |||||
| TelnetSubTask task = (TelnetSubTask) tasksToRun.nextElement(); | TelnetSubTask task = (TelnetSubTask) tasksToRun.nextElement(); | ||||
| if (task instanceof TelnetRead && defaultTimeout != null) { | if (task instanceof TelnetRead && defaultTimeout != null) { | ||||
| ((TelnetRead) task).setDefaultTimeout(defaultTimeout); | ((TelnetRead) task).setDefaultTimeout(defaultTimeout); | ||||
| @@ -163,8 +161,7 @@ public class TelnetTask extends Task { | |||||
| * Process a 'typical' login. If it differs, use the read | * Process a 'typical' login. If it differs, use the read | ||||
| * and write tasks explicitely | * and write tasks explicitely | ||||
| */ | */ | ||||
| private void login() | |||||
| { | |||||
| private void login() { | |||||
| if (addCarriageReturn) { | if (addCarriageReturn) { | ||||
| telnet.sendString("\n", true); | telnet.sendString("\n", true); | ||||
| } | } | ||||
| @@ -197,8 +194,7 @@ public class TelnetTask extends Task { | |||||
| /** | /** | ||||
| * Set the tcp port to connect to attribute | * Set the tcp port to connect to attribute | ||||
| */ | */ | ||||
| public void setInitialCR(boolean b) | |||||
| { | |||||
| public void setInitialCR(boolean b) { | |||||
| this.addCarriageReturn = b; | this.addCarriageReturn = b; | ||||
| } | } | ||||
| @@ -206,8 +202,7 @@ public class TelnetTask extends Task { | |||||
| * Change the default timeout to wait for | * Change the default timeout to wait for | ||||
| * valid responses | * valid responses | ||||
| */ | */ | ||||
| public void setTimeout(Integer i) | |||||
| { | |||||
| public void setTimeout(Integer i) { | |||||
| this.defaultTimeout = i; | this.defaultTimeout = i; | ||||
| } | } | ||||
| @@ -216,8 +211,7 @@ public class TelnetTask extends Task { | |||||
| * Save it in our list, and return it. | * Save it in our list, and return it. | ||||
| */ | */ | ||||
| public TelnetSubTask createRead() | |||||
| { | |||||
| public TelnetSubTask createRead() { | |||||
| TelnetSubTask task = (TelnetSubTask) new TelnetRead(); | TelnetSubTask task = (TelnetSubTask) new TelnetRead(); | ||||
| telnetTasks.addElement(task); | telnetTasks.addElement(task); | ||||
| return task; | return task; | ||||
| @@ -227,8 +221,7 @@ public class TelnetTask extends Task { | |||||
| * A subTask <write> tag was found. Create the object, | * A subTask <write> tag was found. Create the object, | ||||
| * Save it in our list, and return it. | * Save it in our list, and return it. | ||||
| */ | */ | ||||
| public TelnetSubTask createWrite() | |||||
| { | |||||
| public TelnetSubTask createWrite() { | |||||
| TelnetSubTask task = (TelnetSubTask) new TelnetWrite(); | TelnetSubTask task = (TelnetSubTask) new TelnetWrite(); | ||||
| telnetTasks.addElement(task); | telnetTasks.addElement(task); | ||||
| return task; | return task; | ||||
| @@ -238,12 +231,10 @@ public class TelnetTask extends Task { | |||||
| * This class is the parent of the Read and Write tasks. | * This class is the parent of the Read and Write tasks. | ||||
| * It handles the common attributes for both. | * It handles the common attributes for both. | ||||
| */ | */ | ||||
| public class TelnetSubTask | |||||
| { | |||||
| public class TelnetSubTask { | |||||
| protected String taskString = ""; | protected String taskString = ""; | ||||
| public void execute(AntTelnetClient telnet) | public void execute(AntTelnetClient telnet) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| throw new BuildException("Shouldn't be able instantiate a SubTask directly"); | throw new BuildException("Shouldn't be able instantiate a SubTask directly"); | ||||
| } | } | ||||
| /** | /** | ||||
| @@ -255,25 +246,21 @@ public class TelnetTask extends Task { | |||||
| /** | /** | ||||
| * attribute assignment of properties | * attribute assignment of properties | ||||
| */ | */ | ||||
| public void setString(String s) | |||||
| { | |||||
| public void setString(String s) { | |||||
| taskString += s; | taskString += s; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * This class sends text to the connected server | * This class sends text to the connected server | ||||
| */ | */ | ||||
| public class TelnetWrite extends TelnetSubTask | |||||
| { | |||||
| public class TelnetWrite extends TelnetSubTask { | |||||
| private boolean echoString = true; | private boolean echoString = true; | ||||
| public void execute(AntTelnetClient telnet) | public void execute(AntTelnetClient telnet) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| telnet.sendString(taskString, echoString); | telnet.sendString(taskString, echoString); | ||||
| } | } | ||||
| public void setEcho(boolean b) | |||||
| { | |||||
| public void setEcho(boolean b) { | |||||
| echoString = b; | echoString = b; | ||||
| } | } | ||||
| } | } | ||||
| @@ -281,110 +268,93 @@ public class TelnetTask extends Task { | |||||
| * This class reads the output from the connected server | * This class reads the output from the connected server | ||||
| * until the required string is found. | * until the required string is found. | ||||
| */ | */ | ||||
| public class TelnetRead extends TelnetSubTask | |||||
| { | |||||
| public class TelnetRead extends TelnetSubTask { | |||||
| private Integer timeout = null; | private Integer timeout = null; | ||||
| public void execute(AntTelnetClient telnet) | public void execute(AntTelnetClient telnet) | ||||
| throws BuildException | |||||
| { | |||||
| throws BuildException { | |||||
| telnet.waitForString(taskString, timeout); | telnet.waitForString(taskString, timeout); | ||||
| } | } | ||||
| /** | /** | ||||
| * Override any default timeouts | * Override any default timeouts | ||||
| */ | */ | ||||
| public void setTimeout(Integer i) | |||||
| { | |||||
| public void setTimeout(Integer i) { | |||||
| this.timeout = i; | this.timeout = i; | ||||
| } | } | ||||
| /** | /** | ||||
| * Sets the default timeout if none has been set already | * Sets the default timeout if none has been set already | ||||
| */ | */ | ||||
| public void setDefaultTimeout(Integer defaultTimeout) | |||||
| { | |||||
| public void setDefaultTimeout(Integer defaultTimeout) { | |||||
| if (timeout == null) { | if (timeout == null) { | ||||
| timeout = defaultTimeout; | timeout = defaultTimeout; | ||||
| } | } | ||||
| } | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| * This class handles the abstraction of the telnet protocol. | * This class handles the abstraction of the telnet protocol. | ||||
| * Currently it is a wrapper around <a href="www.oroinc.com">ORO</a>'s | * Currently it is a wrapper around <a href="www.oroinc.com">ORO</a>'s | ||||
| * NetComponents | * NetComponents | ||||
| */ | */ | ||||
| public class AntTelnetClient extends TelnetClient | |||||
| { | |||||
| /** | |||||
| * Read from the telnet session until the string we are | |||||
| * waiting for is found | |||||
| * @param s The string to wait on | |||||
| */ | |||||
| public void waitForString(String s) | |||||
| { | |||||
| waitForString(s, null); | |||||
| } | |||||
| public class AntTelnetClient extends TelnetClient { | |||||
| /** | |||||
| * Read from the telnet session until the string we are | |||||
| * waiting for is found | |||||
| * @param s The string to wait on | |||||
| */ | |||||
| public void waitForString(String s) { | |||||
| waitForString(s, null); | |||||
| } | |||||
| /** | |||||
| * Read from the telnet session until the string we are | |||||
| * waiting for is found or the timeout has been reached | |||||
| * @param s The string to wait on | |||||
| * @param timeout The maximum number of seconds to wait | |||||
| */ | |||||
| public void waitForString(String s, Integer timeout) | |||||
| { | |||||
| InputStream is = this.getInputStream(); | |||||
| try { | |||||
| StringBuffer sb = new StringBuffer(); | |||||
| if (timeout == null || timeout.intValue() == 0) | |||||
| { | |||||
| while (sb.toString().indexOf(s) == -1) | |||||
| { | |||||
| sb.append((char) is.read()); | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| Calendar endTime = Calendar.getInstance(); | |||||
| endTime.add(Calendar.SECOND, timeout.intValue()); | |||||
| while (sb.toString().indexOf(s) == -1) | |||||
| { | |||||
| while (Calendar.getInstance().before(endTime) && | |||||
| is.available() == 0) { | |||||
| Thread.sleep(250); | |||||
| } | |||||
| if (is.available() == 0) { | |||||
| throw new BuildException("Response Timed-Out", getLocation()); | |||||
| } | |||||
| sb.append((char) is.read()); | |||||
| } | |||||
| } | |||||
| log(sb.toString(), Project.MSG_INFO); | |||||
| } catch (BuildException be) | |||||
| { | |||||
| throw be; | |||||
| } catch (Exception e) | |||||
| { | |||||
| throw new BuildException(e, getLocation()); | |||||
| /** | |||||
| * Read from the telnet session until the string we are | |||||
| * waiting for is found or the timeout has been reached | |||||
| * @param s The string to wait on | |||||
| * @param timeout The maximum number of seconds to wait | |||||
| */ | |||||
| public void waitForString(String s, Integer timeout) { | |||||
| InputStream is = this.getInputStream(); | |||||
| try { | |||||
| StringBuffer sb = new StringBuffer(); | |||||
| if (timeout == null || timeout.intValue() == 0) { | |||||
| while (sb.toString().indexOf(s) == -1){ | |||||
| sb.append((char) is.read()); | |||||
| } | |||||
| } else { | |||||
| Calendar endTime = Calendar.getInstance(); | |||||
| endTime.add(Calendar.SECOND, timeout.intValue()); | |||||
| while (sb.toString().indexOf(s) == -1) { | |||||
| while (Calendar.getInstance().before(endTime) && | |||||
| is.available() == 0) { | |||||
| Thread.sleep(250); | |||||
| } | |||||
| if (is.available() == 0) { | |||||
| throw new BuildException("Response Timed-Out", getLocation()); | |||||
| } | |||||
| sb.append((char) is.read()); | |||||
| } | |||||
| } | |||||
| log(sb.toString(), Project.MSG_INFO); | |||||
| } catch (BuildException be) { | |||||
| throw be; | |||||
| } catch (Exception e) { | |||||
| throw new BuildException(e, getLocation()); | |||||
| } | |||||
| } | } | ||||
| } | |||||
| /** | |||||
| * Write this string to the telnet session. | |||||
| * @param echoString Logs string sent | |||||
| */ | |||||
| public void sendString(String s, boolean echoString) | |||||
| { | |||||
| OutputStream os = this.getOutputStream(); | |||||
| try { | |||||
| os.write((s + "\n").getBytes()); | |||||
| if (echoString) { | |||||
| log(s, Project.MSG_INFO); | |||||
| } | |||||
| os.flush(); | |||||
| } catch (Exception e) | |||||
| { | |||||
| throw new BuildException(e, getLocation()); | |||||
| /** | |||||
| * Write this string to the telnet session. | |||||
| * @param echoString Logs string sent | |||||
| */ | |||||
| public void sendString(String s, boolean echoString) { | |||||
| OutputStream os = this.getOutputStream(); | |||||
| try { | |||||
| os.write((s + "\n").getBytes()); | |||||
| if (echoString) { | |||||
| log(s, Project.MSG_INFO); | |||||
| } | |||||
| os.flush(); | |||||
| } catch (Exception e) { | |||||
| throw new BuildException(e, getLocation()); | |||||
| } | |||||
| } | } | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -131,8 +131,7 @@ public class Pvcs extends org.apache.tools.ant.Task { | |||||
| exe.setWorkingDirectory(aProj.getBaseDir()); | exe.setWorkingDirectory(aProj.getBaseDir()); | ||||
| exe.setCommandline(cmd.getCommandline()); | exe.setCommandline(cmd.getCommandline()); | ||||
| return exe.execute(); | return exe.execute(); | ||||
| } | |||||
| catch (java.io.IOException e) { | |||||
| } catch (java.io.IOException e) { | |||||
| String msg = "Failed executing: " + cmd.toString() | String msg = "Failed executing: " + cmd.toString() | ||||
| + ". Exception: " + e.getMessage(); | + ". Exception: " + e.getMessage(); | ||||
| throw new BuildException(msg, location); | throw new BuildException(msg, location); | ||||
| @@ -139,12 +139,10 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||||
| try { | try { | ||||
| audioInputStream = AudioSystem.getAudioInputStream(file); | audioInputStream = AudioSystem.getAudioInputStream(file); | ||||
| } | |||||
| catch (UnsupportedAudioFileException uafe) { | |||||
| } catch (UnsupportedAudioFileException uafe) { | |||||
| project.log("Audio format is not yet supported: " | project.log("Audio format is not yet supported: " | ||||
| + uafe.getMessage()); | + uafe.getMessage()); | ||||
| } | |||||
| catch (IOException ioe) { | |||||
| } catch (IOException ioe) { | |||||
| ioe.printStackTrace(); | ioe.printStackTrace(); | ||||
| } | } | ||||
| @@ -156,12 +154,10 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||||
| audioClip = (Clip) AudioSystem.getLine(info); | audioClip = (Clip) AudioSystem.getLine(info); | ||||
| audioClip.addLineListener(this); | audioClip.addLineListener(this); | ||||
| audioClip.open(audioInputStream); | audioClip.open(audioInputStream); | ||||
| } | |||||
| catch (LineUnavailableException e) { | |||||
| } catch (LineUnavailableException e) { | |||||
| project.log("The sound device is currently unavailable"); | project.log("The sound device is currently unavailable"); | ||||
| return; | return; | ||||
| } | |||||
| catch (IOException e) { | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| @@ -172,8 +168,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||||
| } | } | ||||
| audioClip.drain(); | audioClip.drain(); | ||||
| audioClip.close(); | audioClip.close(); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| project.log("Can't get data from file " + file.getName()); | project.log("Can't get data from file " + file.getName()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -189,8 +184,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||||
| clip.loop(Clip.LOOP_CONTINUOUSLY); | clip.loop(Clip.LOOP_CONTINUOUSLY); | ||||
| try { | try { | ||||
| Thread.sleep(duration); | Thread.sleep(duration); | ||||
| } | |||||
| catch (InterruptedException e) { | |||||
| } catch (InterruptedException e) { | |||||
| } | } | ||||
| } | } | ||||
| @@ -202,8 +196,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||||
| if (event.getType().equals(LineEvent.Type.STOP)) { | if (event.getType().equals(LineEvent.Type.STOP)) { | ||||
| Line line = event.getLine(); | Line line = event.getLine(); | ||||
| line.close(); | line.close(); | ||||
| } | |||||
| else if (event.getType().equals(LineEvent.Type.CLOSE)) { | |||||
| } else if (event.getType().equals(LineEvent.Type.CLOSE)) { | |||||
| /* | /* | ||||
| * There is a bug in JavaSound 0.90 (jdk1.3beta). | * There is a bug in JavaSound 0.90 (jdk1.3beta). | ||||
| * It prevents correct termination of the VM. | * It prevents correct termination of the VM. | ||||
| @@ -111,8 +111,7 @@ import org.apache.tools.ant.types.Commandline; | |||||
| * | * | ||||
| * @ant.task name="vsslabel" category="scm" | * @ant.task name="vsslabel" category="scm" | ||||
| */ | */ | ||||
| public class MSVSSLABEL extends MSVSS | |||||
| { | |||||
| public class MSVSSLABEL extends MSVSS { | |||||
| private String m_AutoResponse = null; | private String m_AutoResponse = null; | ||||
| private String m_Label = null; | private String m_Label = null; | ||||
| private String m_Version = null; | private String m_Version = null; | ||||
| @@ -306,22 +306,18 @@ public class FilterSet extends DataType implements Cloneable { | |||||
| String strValue = props.getProperty(strPropName); | String strValue = props.getProperty(strPropName); | ||||
| filters.addElement(new Filter(strPropName, strValue)); | filters.addElement(new Filter(strPropName, strValue)); | ||||
| } | } | ||||
| } | |||||
| catch (Exception e) { | |||||
| } catch (Exception e) { | |||||
| throw new BuildException("Could not read filters from file: " | throw new BuildException("Could not read filters from file: " | ||||
| + filtersFile); | + filtersFile); | ||||
| } | |||||
| finally { | |||||
| } finally { | |||||
| if (in != null) { | if (in != null) { | ||||
| try { | try { | ||||
| in.close(); | in.close(); | ||||
| } | |||||
| catch (IOException ioex) { | |||||
| } catch (IOException ioex) { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| throw new BuildException("Must specify a file not a directory in " | throw new BuildException("Must specify a file not a directory in " | ||||
| + "the filtersfile attribute:" + filtersFile); | + "the filtersfile attribute:" + filtersFile); | ||||
| } | } | ||||
| @@ -363,8 +359,7 @@ public class FilterSet extends DataType implements Cloneable { | |||||
| b.append(value); | b.append(value); | ||||
| i = index + beginToken.length() + token.length() | i = index + beginToken.length() + token.length() | ||||
| + endToken.length(); | + endToken.length(); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| // just append beginToken and search further | // just append beginToken and search further | ||||
| b.append(beginToken); | b.append(beginToken); | ||||
| i = index + beginToken.length(); | i = index + beginToken.length(); | ||||
| @@ -373,12 +368,10 @@ public class FilterSet extends DataType implements Cloneable { | |||||
| b.append(line.substring(i)); | b.append(line.substring(i)); | ||||
| return b.toString(); | return b.toString(); | ||||
| } | |||||
| catch (StringIndexOutOfBoundsException e) { | |||||
| } catch (StringIndexOutOfBoundsException e) { | |||||
| return line; | return line; | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| return line; | return line; | ||||
| } | } | ||||
| } | } | ||||
| @@ -260,8 +260,7 @@ public class Path extends DataType implements Cloneable { | |||||
| File f = null; | File f = null; | ||||
| if (getProject() != null) { | if (getProject() != null) { | ||||
| f = getProject().resolveFile(list[i]); | f = getProject().resolveFile(list[i]); | ||||
| } | |||||
| else { | |||||
| } else { | |||||
| f = new File(list[i]); | f = new File(list[i]); | ||||
| } | } | ||||
| @@ -384,8 +383,7 @@ public class Path extends DataType implements Cloneable { | |||||
| String pathElement = tok.nextToken(); | String pathElement = tok.nextToken(); | ||||
| try { | try { | ||||
| element.append(resolveFile(project, pathElement)); | element.append(resolveFile(project, pathElement)); | ||||
| } | |||||
| catch (BuildException e) { | |||||
| } catch (BuildException e) { | |||||
| project.log("Dropping path element " + pathElement | project.log("Dropping path element " + pathElement | ||||
| + " as it is not valid relative to the project", | + " as it is not valid relative to the project", | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| @@ -585,8 +583,7 @@ public class Path extends DataType implements Cloneable { | |||||
| kaffeJarFiles.setIncludes("*.jar"); | kaffeJarFiles.setIncludes("*.jar"); | ||||
| addFileset(kaffeJarFiles); | addFileset(kaffeJarFiles); | ||||
| } | |||||
| else if (Project.getJavaVersion() == Project.JAVA_1_1) { | |||||
| } else if (Project.getJavaVersion() == Project.JAVA_1_1) { | |||||
| addExisting(new Path(null, | addExisting(new Path(null, | ||||
| System.getProperty("java.home") | System.getProperty("java.home") | ||||
| + File.separator + "lib" | + File.separator + "lib" | ||||
| @@ -470,8 +470,7 @@ public class PatternSet extends DataType { | |||||
| } | } | ||||
| } | } | ||||
| public String toString() | |||||
| { | |||||
| public String toString() { | |||||
| return "patternSet{ includes: " + includeList + | return "patternSet{ includes: " + includeList + | ||||
| " excludes: " + excludeList + " }"; | " excludes: " + excludeList + " }"; | ||||
| } | } | ||||
| @@ -96,8 +96,7 @@ import org.apache.tools.ant.util.regexp.RegexpFactory; | |||||
| * | * | ||||
| * @ant.datatype name="regexp" | * @ant.datatype name="regexp" | ||||
| */ | */ | ||||
| public class RegularExpression extends DataType | |||||
| { | |||||
| public class RegularExpression extends DataType { | |||||
| public final static String DATA_TYPE_NAME = "regexp"; | public final static String DATA_TYPE_NAME = "regexp"; | ||||
| // The regular expression factory | // The regular expression factory | ||||
| @@ -105,13 +104,11 @@ public class RegularExpression extends DataType | |||||
| private Regexp regexp; | private Regexp regexp; | ||||
| public RegularExpression() | |||||
| { | |||||
| public RegularExpression() { | |||||
| this.regexp = factory.newRegexp(); | this.regexp = factory.newRegexp(); | ||||
| } | } | ||||
| public void setPattern(String pattern) | |||||
| { | |||||
| public void setPattern(String pattern) { | |||||
| this.regexp.setPattern(pattern); | this.regexp.setPattern(pattern); | ||||
| } | } | ||||
| @@ -119,8 +116,7 @@ public class RegularExpression extends DataType | |||||
| * Gets the pattern string for this RegularExpression in the | * Gets the pattern string for this RegularExpression in the | ||||
| * given project. | * given project. | ||||
| */ | */ | ||||
| public String getPattern(Project p) | |||||
| { | |||||
| public String getPattern(Project p) { | |||||
| if (isReference()) { | if (isReference()) { | ||||
| return getRef(p).getPattern(p); | return getRef(p).getPattern(p); | ||||
| } | } | ||||
| @@ -128,8 +124,7 @@ public class RegularExpression extends DataType | |||||
| return regexp.getPattern(); | return regexp.getPattern(); | ||||
| } | } | ||||
| public Regexp getRegexp(Project p) | |||||
| { | |||||
| public Regexp getRegexp(Project p) { | |||||
| if (isReference()) { | if (isReference()) { | ||||
| return getRef(p).getRegexp(p); | return getRef(p).getRegexp(p); | ||||
| } | } | ||||
| @@ -140,10 +135,8 @@ public class RegularExpression extends DataType | |||||
| * Get the RegularExpression this reference refers to in | * Get the RegularExpression this reference refers to in | ||||
| * the given project. Check for circular references too | * the given project. Check for circular references too | ||||
| */ | */ | ||||
| public RegularExpression getRef(Project p) | |||||
| { | |||||
| if (!checked) | |||||
| { | |||||
| public RegularExpression getRef(Project p) { | |||||
| if (!checked) { | |||||
| Stack stk = new Stack(); | Stack stk = new Stack(); | ||||
| stk.push(this); | stk.push(this); | ||||
| dieOnCircularReference(stk, p); | dieOnCircularReference(stk, p); | ||||
| @@ -151,16 +144,12 @@ public class RegularExpression extends DataType | |||||
| Object o = ref.getReferencedObject(p); | Object o = ref.getReferencedObject(p); | ||||
| if (!(o instanceof RegularExpression)) | |||||
| { | |||||
| if (!(o instanceof RegularExpression)) { | |||||
| String msg = ref.getRefId() + " doesn\'t denote a " | String msg = ref.getRefId() + " doesn\'t denote a " | ||||
| + DATA_TYPE_NAME; | + DATA_TYPE_NAME; | ||||
| throw new BuildException(msg); | throw new BuildException(msg); | ||||
| } | |||||
| else | |||||
| { | |||||
| } else { | |||||
| return (RegularExpression) o; | return (RegularExpression) o; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -70,19 +70,16 @@ import org.apache.tools.ant.Project; | |||||
| * @see org.apache.oro.text.regex.Perl5Substitution | * @see org.apache.oro.text.regex.Perl5Substitution | ||||
| * @author Matthew Inger <a href="mailto:mattinger@mindless.com">mattinger@mindless.com</a> | * @author Matthew Inger <a href="mailto:mattinger@mindless.com">mattinger@mindless.com</a> | ||||
| */ | */ | ||||
| public class Substitution extends DataType | |||||
| { | |||||
| public class Substitution extends DataType { | |||||
| public final static String DATA_TYPE_NAME = "substitition"; | public final static String DATA_TYPE_NAME = "substitition"; | ||||
| private String expression; | private String expression; | ||||
| public Substitution() | |||||
| { | |||||
| public Substitution() { | |||||
| this.expression = null; | this.expression = null; | ||||
| } | } | ||||
| public void setExpression(String expression) | |||||
| { | |||||
| public void setExpression(String expression) { | |||||
| this.expression = expression; | this.expression = expression; | ||||
| } | } | ||||
| @@ -90,8 +87,7 @@ public class Substitution extends DataType | |||||
| * Gets the pattern string for this RegularExpression in the | * Gets the pattern string for this RegularExpression in the | ||||
| * given project. | * given project. | ||||
| */ | */ | ||||
| public String getExpression(Project p) | |||||
| { | |||||
| public String getExpression(Project p) { | |||||
| if (isReference()) { | if (isReference()) { | ||||
| return getRef(p).getExpression(p); | return getRef(p).getExpression(p); | ||||
| } | } | ||||
| @@ -103,10 +99,8 @@ public class Substitution extends DataType | |||||
| * Get the RegularExpression this reference refers to in | * Get the RegularExpression this reference refers to in | ||||
| * the given project. Check for circular references too | * the given project. Check for circular references too | ||||
| */ | */ | ||||
| public Substitution getRef(Project p) | |||||
| { | |||||
| if (!checked) | |||||
| { | |||||
| public Substitution getRef(Project p) { | |||||
| if (!checked) { | |||||
| Stack stk = new Stack(); | Stack stk = new Stack(); | ||||
| stk.push(this); | stk.push(this); | ||||
| dieOnCircularReference(stk, p); | dieOnCircularReference(stk, p); | ||||
| @@ -114,15 +108,11 @@ public class Substitution extends DataType | |||||
| Object o = ref.getReferencedObject(p); | Object o = ref.getReferencedObject(p); | ||||
| if (!(o instanceof Substitution)) | |||||
| { | |||||
| if (!(o instanceof Substitution)) { | |||||
| String msg = ref.getRefId() + " doesn\'t denote a substitution"; | String msg = ref.getRefId() + " doesn\'t denote a substitution"; | ||||
| throw new BuildException(msg); | throw new BuildException(msg); | ||||
| } | |||||
| else | |||||
| { | |||||
| } else { | |||||
| return (Substitution) o; | return (Substitution) o; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -153,8 +153,7 @@ public class FileUtils { | |||||
| * @throws IOException | * @throws IOException | ||||
| */ | */ | ||||
| public void copyFile(String sourceFile, String destFile, FilterSetCollection filters) | public void copyFile(String sourceFile, String destFile, FilterSetCollection filters) | ||||
| throws IOException | |||||
| { | |||||
| throws IOException { | |||||
| copyFile(new File(sourceFile), new File(destFile), filters, false, false); | copyFile(new File(sourceFile), new File(destFile), filters, false, false); | ||||
| } | } | ||||