Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Spaces in Arguments #117

Open
ChrisHuebsch-FLIG opened this issue Apr 5, 2024 · 1 comment
Open

Problem with Spaces in Arguments #117

ChrisHuebsch-FLIG opened this issue Apr 5, 2024 · 1 comment

Comments

@ChrisHuebsch-FLIG
Copy link

I have a JMX Bean which has an operation to set some textual content (in this case it's a text representing a datetime).
The format is like "2024-04-05 10:25".

When I try to run the operation like this:
run -b com.xxx.yyy.zzz:name=hello,type=Handler setDateTime "2024-04-05 10:25"

I get an error like that:
#IllegalArgumentException: Operation setDateTime with 2 parameters doesn't exist in bean com.xxx.yyy.zzz:name=hello,type=Handler

I added some debug-output to the program for myself. I added these lines into RunCommand/execute():

for (String p : parameters) {
  session.output.printMessage(String.format("Parameter: %s", p));
}

My log shows:
#Parameter: setDateTime
#Parameter: "2024-04-05
#Parameter: 10:25"

So it seems, the String is broken into two. I could not find why this happens. Is using the "" not the right was to "escape" the space?
I also tried a backslash in front of the space. Did not work.

Bug in the code or need I read the documentation more properly?

(PS: Thanks for your awesome tool!)

@nyg
Copy link
Contributor

nyg commented Apr 5, 2024

It should work with double backslash, I don't think it's documented anywhere :).

$>run executeOperation "asdf\\ asdf"
#calling operation executeOperation of mbean edu.self.nyg.example.jmx.app:Lorem=ipsum,foo=Bar with params [asdf asdf]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants