Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8022580

sun.net.ftp.impl.FtpClient.nameList(String path) handles "null" incorrectly

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: 7, 7u25, 8
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b129
    • OS:
      windows_7

      Backports

        Description

        FULL PRODUCT VERSION :


        A DESCRIPTION OF THE PROBLEM :
        This is the original source code of the method sun.net.ftp.impl.FtpClient#nameList():

            /**
             * Issues a NLST path command to server to get the specified directory
             * content. It differs from {@link #list(String)} method by the fact that
             * it will only list the file names which would make the parsing of the
             * somewhat easier.
             *
             * {@link #completePending()} <b>has</b> to be called once the application
             * is finished writing to the stream.
             *
             * @param path a <code>String</code> containing the pathname of the
             * directory to list or <code>null</code> for the current working
             * directory.
             * @return the <code>InputStream</code> from the resulting data connection
             * @throws IOException if an error occurs during the transmission.
             */
            public InputStream nameList(String path) throws sun.net.ftp.FtpProtocolException, IOException {
                Socket s;
                s = openDataConnection( " NLST " + path);
                if (s != null) {
                    return createInputStream(s.getInputStream());
                }
                return null;
            }

        As can be seen, there is no handling of a null as the path parameter in this code at all (although documented).
        A null as path doesn't lead to the expected result.




        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        Passing an empty String instead of a null as the method argument.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  snikandrova Svetlana Nikandrova (Inactive)
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: