Accumulo
  1. Accumulo
  2. ACCUMULO-2187

Scanner is left unclosed in AddSplitsCommand#execute()

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.0
    • Component/s: None
    • Labels:

      Description

      Here is related code:

            java.util.Scanner file = new java.util.Scanner(new File(f));
            while (file.hasNextLine()) {
              line = file.nextLine();
              if (!line.isEmpty()) {
                splits.add(decode ? new Text(Base64.decodeBase64(line.getBytes())) : new Text(line));
              }
            }
      

      file should be closed upon return.

      1. ACCUMULO-2187.v1.patch.txt
        7 kB
        Vikram Srivastava
      2. ACCUMULO-2187.v2.patch.txt
        11 kB
        Vikram Srivastava

        Issue Links

          Activity

          Hide
          ASF subversion and git services added a comment -

          Commit 18fee706ba213b2cd6b0aaa587f5da1bfe5aa118 in accumulo's branch refs/heads/master from Christopher Tubbs
          [ https://git-wip-us.apache.org/repos/asf?p=accumulo.git;h=18fee70 ]

          ACCUMULO-2477, ACCUMULO-2187 Fix introduced warnings/formatting

          Show
          ASF subversion and git services added a comment - Commit 18fee706ba213b2cd6b0aaa587f5da1bfe5aa118 in accumulo's branch refs/heads/master from Christopher Tubbs [ https://git-wip-us.apache.org/repos/asf?p=accumulo.git;h=18fee70 ] ACCUMULO-2477 , ACCUMULO-2187 Fix introduced warnings/formatting
          Bill Havanki made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Bill Havanki added a comment -

          Thanks Vikram!

          Show
          Bill Havanki added a comment - Thanks Vikram!
          Hide
          ASF subversion and git services added a comment -

          Commit ff605865d1388a07687a924b064e3dd3495d3102 in accumulo's branch refs/heads/master from Bill Havanki
          [ https://git-wip-us.apache.org/repos/asf?p=accumulo.git;h=ff60586 ]

          ACCUMULO-2187 Clean whitespace, format ShellUtilTest

          Show
          ASF subversion and git services added a comment - Commit ff605865d1388a07687a924b064e3dd3495d3102 in accumulo's branch refs/heads/master from Bill Havanki [ https://git-wip-us.apache.org/repos/asf?p=accumulo.git;h=ff60586 ] ACCUMULO-2187 Clean whitespace, format ShellUtilTest
          Hide
          ASF subversion and git services added a comment -

          Commit 2d68f5772cce9ef995d97730f4c9f95f203d72b1 in accumulo's branch refs/heads/master from Vikram Srivastava
          [ https://git-wip-us.apache.org/repos/asf?p=accumulo.git;h=2d68f57 ]

          ACCUMULO-2187 Refactor method to read file in AddSplitsCommand and CreateTableCommand

          Signed-off-by: Bill Havanki <bhavanki@cloudera.com>

          Show
          ASF subversion and git services added a comment - Commit 2d68f5772cce9ef995d97730f4c9f95f203d72b1 in accumulo's branch refs/heads/master from Vikram Srivastava [ https://git-wip-us.apache.org/repos/asf?p=accumulo.git;h=2d68f57 ] ACCUMULO-2187 Refactor method to read file in AddSplitsCommand and CreateTableCommand Signed-off-by: Bill Havanki <bhavanki@cloudera.com>
          Vikram Srivastava made changes -
          Attachment ACCUMULO-2187.v2.patch.txt [ 12633227 ]
          Hide
          Vikram Srivastava added a comment -

          Added unit tests. Had to also make a change in ShellUtil to use UTF8 due to the new changes in AddSplitsCommand and CreateTableCommand.

          Show
          Vikram Srivastava added a comment - Added unit tests. Had to also make a change in ShellUtil to use UTF8 due to the new changes in AddSplitsCommand and CreateTableCommand.
          Hide
          Bill Havanki added a comment -

          Can you add a unit test for the refactored method, and also add @param and @return to the Javadoc?

          Show
          Bill Havanki added a comment - Can you add a unit test for the refactored method, and also add @param and @return to the Javadoc?
          Vikram Srivastava made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Fix Version/s 1.7.0 [ 12324607 ]
          Vikram Srivastava made changes -
          Assignee Vikram Srivastava [ vickyuec ]
          Vikram Srivastava made changes -
          Attachment ACCUMULO-2187.v1.patch.txt [ 12625823 ]
          Hide
          Vikram Srivastava added a comment -

          Attached patch. Refactored file reading into a method.

          Show
          Vikram Srivastava added a comment - Attached patch. Refactored file reading into a method.
          Christopher Tubbs made changes -
          Labels newbie
          Mike Drob made changes -
          Field Original Value New Value
          Link This issue is part of ACCUMULO-1362 [ ACCUMULO-1362 ]
          Ted Yu created issue -

            People

            • Assignee:
              Vikram Srivastava
              Reporter:
              Ted Yu
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development