ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: svn commit: r577684 - in /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional: dotnet/ jlink/ jsp/ junit/ net/ splash/ ssh/
Date Thu, 20 Sep 2007 11:43:09 GMT
>ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspN
ameMangler.java
>         if (filename.endsWith(".jsp")) {
>-            className = filename.substring(0, filename.length() - 4);
>+            className = filename.substring(0, filename.length() -
".jsp".length());
>         } else {
>             className = filename;
>         }



What about refactoring?

className = removeSuffix(filename, ".jsp");

String removeSuffix(String string, String suffix) {
    if (string.endsWith(suffix)) {
        return string.substring(0, string.length() - suffix.length());
    } else {
        return string;
    }
}

Maybe in StringUtils?


>Modified: 
>ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/Teln
etTask.java
> public class TelnetTask extends Task {
>+    private static final int QUARTER_SECOND = 250;
>                     while (sb.toString().indexOf(s) == -1) {
>                         while (Calendar.getInstance().before(endTime)
>                                && is.available() == 0) {
>-                            Thread.sleep(250);
>+                            Thread.sleep(QUARTER_SECOND);


What about WAIT_INTERVAL?





>ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/splash/S
plashTask.java
> public class SplashTask extends Task {
>+    private static final int FIVE_SECONDS = 5000;
>-    private int showDuration = 5000;
>+    private int showDuration = FIVE_SECONDS;


What about DEFAULT_SHOW_DURATION ?



>ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHE
xec.java (original)
> public class SSHExec extends SSHBase {
> 
>+    private static final int HALF_SECOND = 500;
>+


    /** for waiting for the command to finish */
    private Thread thread = null;

            thread =
                new Thread() {
                    public void run() {
                        while (!channel.isClosed()) {
                            if (thread == null) {
                                return;
                            }
                            try {
                                sleep(HALF_SECOND);
                            } catch (Exception e) {
                                // ignored
                            }
                        }
                    }
                };



Not shure about a naming ... RETRY_INTERVAL ?




Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message