-
Notifications
You must be signed in to change notification settings - Fork 38
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
Update WinProcess.java #50
base: master
Are you sure you want to change the base?
Conversation
Using `getCommandLine()` in the `toString()` function to ensure that the `commandline` String variable is set. The `getCommandLine()` function will internally have it parsed if it is currently null.
Fixing line 27 which somehow got altered in my first commit. My bad not picking up on this on that first commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was intentional to avoid excessive load when the values are not available. What is a use-case for it?
When I tried to print the contents of my WinProcess object, I was getting a null at the end of the toString. I realized it was because the toString function relies of the variable being set, which only happens in the getter, not the constructor. So alternatively I think having the constructor create the object is fine as well. |
Would if we replace |
That certainly is better than null. I do wonder why would there be concern about excessive load for this parsing event in the toString. I'd think the user of your API would expect the command to be available to them. I did, which is what lead me to looking at the source code and making this pull request. |
Retrieval of process command line is pretty heavy, because it has to read the Process headers. If API users need to get command line, there is a Anyway, I will update the string to make the message more clear |
Fix applied in bd2fa87 |
Using
getCommandLine()
in thetoString()
function to ensure that thecommandline
String variable is set. ThegetCommandLine()
function will internally have it parsed if it is currently null.