Kitty
  1. Kitty
  2. KITTY-18

Unix style relative paths up and down mbean tree not working

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Labels:

      Description

      when navigating the mbean trees using Unix style relative paths, a No signature of method error is thrown

        Activity

        Hide
        Matthew Sacks added a comment -

        To reproduce:
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dtools.jar=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/tools.jar -Dgroovy.home=/Users/msacks/groovy-1.7.4 -Dgroovy.starter.conf=/Users/msacks/groovy-1.7.4/conf/groovy-starter.conf -Dfile.encoding=UTF-8 -classpath /Users/msacks/groovy-1.7.4/lib/groovy-1.7.4.jar org.codehaus.groovy.tools.GroovyStarter --conf /Users/msacks/groovy-1.7.4/conf/groovy-starter.conf --main groovy.ui.GroovyMain --classpath /Users/msacks/Development/Code/Groovy/kitty-test/out/production/Main:/Users/msacks/groovy-1.7.4/lib/ant-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/ant-antlr-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/ant-junit-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/ant-launcher-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/ant-nodeps-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/antlr-2.7.7.jar:/Users/msacks/groovy-1.7.4/lib/asm-3.2.jar:/Users/msacks/groovy-1.7.4/lib/asm-analysis-3.2.jar:/Users/msacks/groovy-1.7.4/lib/asm-commons-3.2.jar:/Users/msacks/groovy-1.7.4/lib/asm-tree-3.2.jar:/Users/msacks/groovy-1.7.4/lib/asm-util-3.2.jar:/Users/msacks/groovy-1.7.4/lib/bsf-2.4.0.jar:/Users/msacks/groovy-1.7.4/lib/commons-cli-1.2.jar:/Users/msacks/groovy-1.7.4/lib/commons-logging-1.1.1.jar:/Users/msacks/groovy-1.7.4/lib/groovy-1.7.4.jar:/Users/msacks/groovy-1.7.4/lib/ivy-2.2.0-rc1.jar:/Users/msacks/groovy-1.7.4/lib/jansi-1.2.1.jar:/Users/msacks/groovy-1.7.4/lib/jline-0.9.94.jar:/Users/msacks/groovy-1.7.4/lib/jsp-api-2.0.jar:/Users/msacks/groovy-1.7.4/lib/junit-4.8.1.jar:/Users/msacks/groovy-1.7.4/lib/servlet-api-2.4.jar:/Users/msacks/groovy-1.7.4/lib/xstream-1.3.1.jar --encoding=UTF-8 /Users/msacks/Development/Code/Groovy/kitty-test/src/main/java/org/apache/kitty/CmdShell.groovy
        kitty> connect localhost 9000
        connect localhost 9000
        connecting to localhost at port 9000....
        the url is service:jmx:rmi:///jndi/rmi://localhost:9000/jmxrmi
        Successfully connected to host
        kitty> setdomain Catalina
        setdomain Catalina
        Setting the domain to Catalina...
        The domain is set to Catalina
        kitty> ls
        ls
        listing files and directories...
        Catalina:


        M j2eeType=Servlet
        M j2eeType=WebModule
        M j2eeType=Filter
        M type=Loader
        M type=Manager
        M type=NamingResources
        M type=JspMonitor
        M type=WebappClassLoader
        M type=Environment
        M type=Host
        M type=Resource
        M type=Valve
        M type=JkHandler
        M type=Mapper
        M type=Connector
        M type=Realm
        M type=MBeanFactory
        M type=Cache
        M type=ServerClassLoader
        M type=Service
        M type=Deployer
        M type=Server
        M type=RequestProcessor
        M type=GlobalRequestProcessor
        M type=Engine
        M type=ThreadPool
        M type=ProtocolHandler
        M type=JkWorkerEnv
        M type=StringCache
        M type=JkMain
        The domain list is:
        kitty> cd type=Server
        cd type=Server
        changing remote path...
        kitty> ls
        ls
        listing files and directories...
        Catalina:type=Server


        null
        kitty> cd ..
        cd ..
        changing remote path...
        No signature of method: java.util.ArrayList.length() is applicable for argument types: () values: []
        Possible solutions: last(), get(int), get(int), getAt(java.lang.String), getAt(int), getAt(java.lang.String)

        Working previous Jython version:

        jmx> pwd
        Catalina:type=Valve
        jmx> ls
        Catalina:type=Valve


        M name=ErrorReportValve
        M name=StandardHostValve
        M name=StandardContextValve
        M name=StandardEngineValve
        M name=BasicAuthenticator
        M name=FormAuthenticator
        jmx> pwd
        Catalina:type=Valve
        jmx> cd ..
        jmx> pwd
        Catalina:

        Show
        Matthew Sacks added a comment - To reproduce: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dtools.jar=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/tools.jar -Dgroovy.home=/Users/msacks/groovy-1.7.4 -Dgroovy.starter.conf=/Users/msacks/groovy-1.7.4/conf/groovy-starter.conf -Dfile.encoding=UTF-8 -classpath /Users/msacks/groovy-1.7.4/lib/groovy-1.7.4.jar org.codehaus.groovy.tools.GroovyStarter --conf /Users/msacks/groovy-1.7.4/conf/groovy-starter.conf --main groovy.ui.GroovyMain --classpath /Users/msacks/Development/Code/Groovy/kitty-test/out/production/Main:/Users/msacks/groovy-1.7.4/lib/ant-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/ant-antlr-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/ant-junit-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/ant-launcher-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/ant-nodeps-1.8.1.jar:/Users/msacks/groovy-1.7.4/lib/antlr-2.7.7.jar:/Users/msacks/groovy-1.7.4/lib/asm-3.2.jar:/Users/msacks/groovy-1.7.4/lib/asm-analysis-3.2.jar:/Users/msacks/groovy-1.7.4/lib/asm-commons-3.2.jar:/Users/msacks/groovy-1.7.4/lib/asm-tree-3.2.jar:/Users/msacks/groovy-1.7.4/lib/asm-util-3.2.jar:/Users/msacks/groovy-1.7.4/lib/bsf-2.4.0.jar:/Users/msacks/groovy-1.7.4/lib/commons-cli-1.2.jar:/Users/msacks/groovy-1.7.4/lib/commons-logging-1.1.1.jar:/Users/msacks/groovy-1.7.4/lib/groovy-1.7.4.jar:/Users/msacks/groovy-1.7.4/lib/ivy-2.2.0-rc1.jar:/Users/msacks/groovy-1.7.4/lib/jansi-1.2.1.jar:/Users/msacks/groovy-1.7.4/lib/jline-0.9.94.jar:/Users/msacks/groovy-1.7.4/lib/jsp-api-2.0.jar:/Users/msacks/groovy-1.7.4/lib/junit-4.8.1.jar:/Users/msacks/groovy-1.7.4/lib/servlet-api-2.4.jar:/Users/msacks/groovy-1.7.4/lib/xstream-1.3.1.jar --encoding=UTF-8 /Users/msacks/Development/Code/Groovy/kitty-test/src/main/java/org/apache/kitty/CmdShell.groovy kitty> connect localhost 9000 connect localhost 9000 connecting to localhost at port 9000.... the url is service:jmx:rmi:///jndi/rmi://localhost:9000/jmxrmi Successfully connected to host kitty> setdomain Catalina setdomain Catalina Setting the domain to Catalina... The domain is set to Catalina kitty> ls ls listing files and directories... Catalina: M j2eeType=Servlet M j2eeType=WebModule M j2eeType=Filter M type=Loader M type=Manager M type=NamingResources M type=JspMonitor M type=WebappClassLoader M type=Environment M type=Host M type=Resource M type=Valve M type=JkHandler M type=Mapper M type=Connector M type=Realm M type=MBeanFactory M type=Cache M type=ServerClassLoader M type=Service M type=Deployer M type=Server M type=RequestProcessor M type=GlobalRequestProcessor M type=Engine M type=ThreadPool M type=ProtocolHandler M type=JkWorkerEnv M type=StringCache M type=JkMain The domain list is: kitty> cd type=Server cd type=Server changing remote path... kitty> ls ls listing files and directories... Catalina:type=Server null kitty> cd .. cd .. changing remote path... No signature of method: java.util.ArrayList.length() is applicable for argument types: () values: [] Possible solutions: last(), get(int), get(int), getAt(java.lang.String), getAt(int), getAt(java.lang.String) Working previous Jython version: jmx> pwd Catalina:type=Valve jmx> ls Catalina:type=Valve M name=ErrorReportValve M name=StandardHostValve M name=StandardContextValve M name=StandardEngineValve M name=BasicAuthenticator M name=FormAuthenticator jmx> pwd Catalina:type=Valve jmx> cd .. jmx> pwd Catalina:
        Hide
        Gerben Castel added a comment -

        Hi,

        I've got a quick fix for this bug :

        In Client.groovy, "cd(String path)" method, replace :

        if (path == "..") {
        if (this.mBeansPath.length())

        { this.mBeansPath.pop() }
        }

        with :

        if (path == "..") {
        if (this.mBeansPath.size()) { this.mBeansPath.pop() }

        }

        (there is no "length()" method on a list, replace it with "size()")

        Show
        Gerben Castel added a comment - Hi, I've got a quick fix for this bug : In Client.groovy, "cd(String path)" method, replace : if (path == "..") { if (this.mBeansPath.length()) { this.mBeansPath.pop() } } with : if (path == "..") { if (this.mBeansPath.size()) { this.mBeansPath.pop() } } (there is no "length()" method on a list, replace it with "size()")
        Hide
        Pid added a comment -

        That would be a new bug, I think.

        Show
        Pid added a comment - That would be a new bug, I think.
        Hide
        Gerben Castel added a comment -

        It's the same bug, if you replace length() with size() as I showed, the cd() method will work as expected :

        jmx> pwd
        Catalina:type=Valve
        jmx> cd ..
        jmx> pwd
        Catalina:

        Show
        Gerben Castel added a comment - It's the same bug, if you replace length() with size() as I showed, the cd() method will work as expected : jmx> pwd Catalina:type=Valve jmx> cd .. jmx> pwd Catalina:
        Hide
        Pid added a comment -

        You are correct, of course. I was looking at the wrong bug.

        Show
        Pid added a comment - You are correct, of course. I was looking at the wrong bug.
        Hide
        Matthew Sacks added a comment -

        Looks like this is fixed now? Can we close?

        Show
        Matthew Sacks added a comment - Looks like this is fixed now? Can we close?
        Hide
        Alessandro Novarini added a comment -

        I've just commited the patch, now you can close it.

        Thanks
        Ale

        Show
        Alessandro Novarini added a comment - I've just commited the patch, now you can close it. Thanks Ale
        Hide
        Matthew Sacks added a comment -

        I am currently on temporary leave. I will respond as soon as possible.

        Thank you,
        Matthew

        Show
        Matthew Sacks added a comment - I am currently on temporary leave. I will respond as soon as possible. Thank you, Matthew
        Hide
        Matthew Sacks added a comment -

        Was anyone able to test before closing this one out? Thanks Ale for tackling it.

        Show
        Matthew Sacks added a comment - Was anyone able to test before closing this one out? Thanks Ale for tackling it.
        Hide
        Alessandro Novarini added a comment - - edited

        Sorry, it seems I missed an unit test, now it is working fine.

        The feature is still NOT fully implemented, the fix released is just for the described use case.
        What has to be done on this feature is the possibility to go up and down of multiple levels with one command: for example like

        cd ..,..

        or

        cd ../..

        At the moment we're using the ',' as a separator, but if we want to stick with the definition Unix style, maybe we should switch to a proper '/'... what do you think?

        Moreover, at the moment there's no check that the path you want to go to is present or not, for example:

        pwd
        type=Server

        cd foo
        pwd
        type=Server,foo

        even though the foo "dir" doesn't exist.

        Show
        Alessandro Novarini added a comment - - edited Sorry, it seems I missed an unit test, now it is working fine. The feature is still NOT fully implemented, the fix released is just for the described use case. What has to be done on this feature is the possibility to go up and down of multiple levels with one command: for example like cd ..,.. or cd ../.. At the moment we're using the ',' as a separator, but if we want to stick with the definition Unix style, maybe we should switch to a proper '/'... what do you think? Moreover, at the moment there's no check that the path you want to go to is present or not, for example: pwd type=Server cd foo pwd type=Server,foo even though the foo "dir" doesn't exist.
        Hide
        Matthew Sacks added a comment - - edited

        1) I think question 1 above relates to whether or not we should use relative or absolute paths. This is a good question, I think much like Unix both should be supported in the case of automating and scripting using the Kitty tool. So for example to get to Type=Server,node you could do cd Type=Server and then cd node (relative) to then perform an ls on the attributes for that node, or cd Type=Server,node directly (absolute).

        2)

        "Moreover, at the moment there's no check that the path you want to go to is present or not, for example: "

        The ls() command should allow this.

        Show
        Matthew Sacks added a comment - - edited 1) I think question 1 above relates to whether or not we should use relative or absolute paths. This is a good question, I think much like Unix both should be supported in the case of automating and scripting using the Kitty tool. So for example to get to Type=Server,node you could do cd Type=Server and then cd node (relative) to then perform an ls on the attributes for that node, or cd Type=Server,node directly (absolute). 2) "Moreover, at the moment there's no check that the path you want to go to is present or not, for example: " The ls() command should allow this.

          People

          • Assignee:
            Pid
            Reporter:
            Matthew Sacks
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development