Browse Source

Don't close SocketClients if connect has failed, PR 33618

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277682 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
c798cf3db8
3 changed files with 16 additions and 12 deletions
  1. +4
    -0
      WHATSNEW
  2. +10
    -10
      src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java

+ 4
- 0
WHATSNEW View File

@@ -318,6 +318,10 @@ Fixed bugs:
<exec>, <apply>, or <java> tasks was always logged to System.out <exec>, <apply>, or <java> tasks was always logged to System.out
instead of to the managing Task. instead of to the managing Task.


* <telnet> and <rexec> would try to disconnect from servers they never
connetced to, potentially leading to exceptions in commons-net.
Bugzilla Report 33618.

Changes from Ant 1.6.1 to Ant 1.6.2 Changes from Ant 1.6.1 to Ant 1.6.2
=================================== ===================================




+ 10
- 10
src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004 The Apache Software Foundation
* Copyright 2003-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -342,15 +342,15 @@ public class RExecTask extends Task {
/** Keep reading input stream until end of it or time-out */ /** Keep reading input stream until end of it or time-out */
rexec.waitForEOF(defaultTimeout); rexec.waitForEOF(defaultTimeout);
} finally { } finally {
if (rexec != null) {
try {
rexec.disconnect();
} catch (IOException e) {
throw new BuildException("Error disconnecting from "
+ server);
}
}
}
if (rexec != null && rexec.isConnected()) {
try {
rexec.disconnect();
} catch (IOException e) {
throw new BuildException("Error disconnecting from "
+ server);
}
}
}
} }
/** /**
* Process a 'typical' login. If it differs, use the read * Process a 'typical' login. If it differs, use the read


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000,2002-2004 The Apache Software Foundation
* Copyright 2000,2002-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -114,7 +114,7 @@ public class TelnetTask extends Task {
task.execute(telnet); task.execute(telnet);
} }
} finally { } finally {
if (telnet != null) {
if (telnet != null && telnet.isConnected()) {
try { try {
telnet.disconnect(); telnet.disconnect();
} catch (IOException e) { } catch (IOException e) {


Loading…
Cancel
Save