8151586: Wrong exception catch for FTPClient in JDK-8055032
authorvtewari
Wed, 06 Apr 2016 21:31:48 +0100
changeset 36947 83319fc2c7ac
parent 36946 cbe79e752734
child 36948 8727362c1c78
8151586: Wrong exception catch for FTPClient in JDK-8055032 Reviewed-by: chegar
jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java
jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java
jdk/test/sun/net/www/ftptest/FtpCommandHandler.java
--- a/jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java	Wed Apr 06 17:54:41 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java	Wed Apr 06 21:31:48 2016 +0100
@@ -83,7 +83,7 @@
                     code = Integer.parseInt(response, 0, 3, 10);
                 } catch (NumberFormatException e) {
                     code = -1;
-                } catch (StringIndexOutOfBoundsException e) {
+                } catch (IndexOutOfBoundsException e) {
                     /* this line doesn't contain a response code, so
                        we just completely ignore it */
                     continue;
--- a/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java	Wed Apr 06 17:54:41 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java	Wed Apr 06 21:31:48 2016 +0100
@@ -440,7 +440,7 @@
                     code = Integer.parseInt(response, 0, 3, 10);
                 } catch (NumberFormatException e) {
                     code = -1;
-                } catch (StringIndexOutOfBoundsException e) {
+                } catch (IndexOutOfBoundsException e) {
                     /* this line doesn't contain a response code, so
                     we just completely ignore it */
                     continue;
--- a/jdk/test/sun/net/www/ftptest/FtpCommandHandler.java	Wed Apr 06 17:54:41 2016 +0200
+++ b/jdk/test/sun/net/www/ftptest/FtpCommandHandler.java	Wed Apr 06 21:31:48 2016 +0100
@@ -442,7 +442,9 @@
             // cmd.setSoTimeout(2000);
             in = new BufferedReader(new InputStreamReader(cmd.getInputStream()));
             out = new PrintStream(cmd.getOutputStream(), true, "ISO8859_1");
-            out.println("220 Java FTP test server (j2se 6.0) ready.");
+            out.println("---------------------------------\n220 Java FTP test server"
+                    + " (j2se 6.0) ready.\n \n                Please send commands\n"
+                    + "-----------------------------\n\n\n");
             out.flush();
             if (auth.authType() == 0) // No auth needed
                 logged = true;