Karaf
  1. Karaf
  2. KARAF-735

java.util.NoSuchElementException if issue the first command as an empty command

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1, 2.2.2
    • Fix Version/s: 2.2.3, 3.0.0
    • Component/s: karaf-shell
    • Labels:
      None
    • Environment:

      WinXP SP3 English

      Description

      Steps to reproduce the problem.

      1. downlaod apache-karaf-2.2.1.zip
      2. extract it to folderA
      3. go into the folderA\bin
      4. issue karaf.bat
      5. press enter and you get java.util.NoSuchElementException

      BTW: The exception disappears after any non-empty command like "list" being issued.

      1. karaf-735.patch
        0.9 kB
        Han Hong Fang

        Activity

        Hide
        Freeman Fang added a comment -

        Hi,

        My gut feeling is it's related to the discussion here[1], you probably miss dll from Visual C++ libraries on the windows XP.

        Could you take a look at [1] and verify if you're in this case?

        [1]http://fusesource.com/forums/thread.jspa?messageID=10985&#10985

        Freeman

        Show
        Freeman Fang added a comment - Hi, My gut feeling is it's related to the discussion here [1] , you probably miss dll from Visual C++ libraries on the windows XP. Could you take a look at [1] and verify if you're in this case? [1] http://fusesource.com/forums/thread.jspa?messageID=10985&#10985 Freeman
        Hide
        Han Hong Fang added a comment -

        The problem only occurs if the FIRST command is EMPTY. Meanwhile, the problem will disappear once a non-empty command has been issued.

        Karaf works well if you issue non-empty command firstly. So I guess it is non-related with the VC libraries.

        I look into the karaf code. In org.apache.karaf.shell.console.jline.Cosole.run() method, the problem occurs here: reader.getHistory().replace(command); when the first command is empty, history is with size 0, but replace() tries to remove the last item which leads to java.util.NoSuchElementException.

        Show
        Han Hong Fang added a comment - The problem only occurs if the FIRST command is EMPTY. Meanwhile, the problem will disappear once a non-empty command has been issued. Karaf works well if you issue non-empty command firstly. So I guess it is non-related with the VC libraries. I look into the karaf code. In org.apache.karaf.shell.console.jline.Cosole.run() method, the problem occurs here: reader.getHistory().replace(command); when the first command is empty, history is with size 0, but replace() tries to remove the last item which leads to java.util.NoSuchElementException.
        Hide
        Han Hong Fang added a comment -

        Attached the patch for this issue.

        Show
        Han Hong Fang added a comment - Attached the patch for this issue.
        Hide
        Freeman Fang added a comment -

        Hi,

        Yeah, I can also reproduce it from my mac if I remove the .karaf/karaf.history(this is the cache for the history karaf command), I will fix it up soon.

        Freeman

        Show
        Freeman Fang added a comment - Hi, Yeah, I can also reproduce it from my mac if I remove the .karaf/karaf.history(this is the cache for the history karaf command), I will fix it up soon. Freeman
        Hide
        Freeman Fang added a comment -

        apply patch on behalf of Han Hong Fang with thanks
        http://svn.apache.org/viewvc?rev=1146572&view=rev for trunk
        http://svn.apache.org/viewvc?rev=1146571&view=rev for 2.2.x branch

        Show
        Freeman Fang added a comment - apply patch on behalf of Han Hong Fang with thanks http://svn.apache.org/viewvc?rev=1146572&view=rev for trunk http://svn.apache.org/viewvc?rev=1146571&view=rev for 2.2.x branch

          People

          • Assignee:
            Freeman Fang
            Reporter:
            Han Hong Fang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development