Commons Net
  1. Commons Net
  2. NET-458

MVSFTPEntryParser.parseSimpleEntry - ArrayIndexOutOfBoundsException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.1, 3.1
    • Fix Version/s: 3.2
    • Component/s: FTP
    • Labels:
      None
    • Environment:

      zOS

      Description

      Line 360 in MVSFTPEntryParser.parseSimpleEntry :

      String name = entry.split(" ")[0];

      gives an ArrayIndexOutOfBoundsException: 0

      It appears to be caused by a partitioned dataset whose members only contain names. No other details (creation date, file type etc).

      This is the method, if it helps:

      private boolean parseSimpleEntry(FTPFile file, String entry) {
          if (entry != null && entry.length() > 0) {
              file.setRawListing(entry);
              String name = entry.split(" ")[0];           // <--- error occurs here
              file.setName(name);
              file.setType(FTPFile.FILE_TYPE);
              return true;
          }
          return false;
      }
      

        Activity

        Denis Molony created issue -
        Denis Molony made changes -
        Field Original Value New Value
        Description Line 360 in MVSFTPEntryParser.parseSimpleEntry :

            String name = entry.split(" ")[0];

        gives an ArrayIndexOutOfBoundsException: 0

        It appears to be caused by a partitioned dataset whose members only contain names. No other details (creation date, file type etc).

        This is the method, if it helps:

        private boolean parseSimpleEntry(FTPFile file, String entry) {
                if (entry != null && entry.length() > 0) {
                    file.setRawListing(entry);
                    String name = entry.split(" ")[0]; // <--- error occurs here
                    file.setName(name);
                    file.setType(FTPFile.FILE_TYPE);
                    return true;
                }
                return false;
            }
        Line 360 in MVSFTPEntryParser.parseSimpleEntry :

            String name = entry.split(" ")[0];

        gives an ArrayIndexOutOfBoundsException: 0

        It appears to be caused by a partitioned dataset whose members only contain names. No other details (creation date, file type etc).

        This is the method, if it helps:

        private boolean parseSimpleEntry(FTPFile file, String entry) {

                if (entry != null && entry.length() > 0) {

                    file.setRawListing(entry);

                    String name = entry.split(" ")[0]; // <--- error occurs here

                    file.setName(name);

                    file.setType(FTPFile.FILE_TYPE);

                    return true;

                }

                return false;

            }
        Hide
        Sebb added a comment -

        Fix layout

        Show
        Sebb added a comment - Fix layout
        Sebb made changes -
        Description Line 360 in MVSFTPEntryParser.parseSimpleEntry :

            String name = entry.split(" ")[0];

        gives an ArrayIndexOutOfBoundsException: 0

        It appears to be caused by a partitioned dataset whose members only contain names. No other details (creation date, file type etc).

        This is the method, if it helps:

        private boolean parseSimpleEntry(FTPFile file, String entry) {

                if (entry != null && entry.length() > 0) {

                    file.setRawListing(entry);

                    String name = entry.split(" ")[0]; // <--- error occurs here

                    file.setName(name);

                    file.setType(FTPFile.FILE_TYPE);

                    return true;

                }

                return false;

            }
        Line 360 in MVSFTPEntryParser.parseSimpleEntry :

            String name = entry.split(" ")[0];

        gives an ArrayIndexOutOfBoundsException: 0

        It appears to be caused by a partitioned dataset whose members only contain names. No other details (creation date, file type etc).

        This is the method, if it helps:

        {code}
        private boolean parseSimpleEntry(FTPFile file, String entry) {
            if (entry != null && entry.length() > 0) {
                file.setRawListing(entry);
                String name = entry.split(" ")[0]; // <--- error occurs here
                file.setName(name);
                file.setType(FTPFile.FILE_TYPE);
                return true;
            }
            return false;
        }
        {code}
        Hide
        Sebb added a comment -

        Looks like the problem is caused by trying to split a string containing only space(s)

        Show
        Sebb added a comment - Looks like the problem is caused by trying to split a string containing only space(s)
        Hide
        Denis Molony added a comment -

        The PDS contains many members, but all of them appear to have unreadable names (unprintable characters?). There is no other member information available, so that part of the string is definitely blank.

        Show
        Denis Molony added a comment - The PDS contains many members, but all of them appear to have unreadable names (unprintable characters?). There is no other member information available, so that part of the string is definitely blank.
        Hide
        Sebb added a comment -

        Thanks for the report. Fixed in SVN, and a new SNAPSHOT has been uploaded to the ASF snapshots repo [1].

        [1] http://repository.apache.org/snapshots/

        Show
        Sebb added a comment - Thanks for the report. Fixed in SVN, and a new SNAPSHOT has been uploaded to the ASF snapshots repo [1] . [1] http://repository.apache.org/snapshots/
        Sebb made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Denis Molony added a comment -

        Thanks, that fixed it.

        Show
        Denis Molony added a comment - Thanks, that fixed it.
        Sebb made changes -
        Fix Version/s 3.2 [ 12320140 ]
        Sebb made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        42m 10s 1 Sebb 13/Apr/12 12:20
        Resolved Resolved Closed Closed
        369d 8h 38m 1 Sebb 17/Apr/13 20:59

          People

          • Assignee:
            Unassigned
            Reporter:
            Denis Molony
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development