-
Notifications
You must be signed in to change notification settings - Fork 304
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
PAYARA-2911 Can't set description for JMX Monitoring attributes #2968
Conversation
Jenkins test please |
Quick build and test passed! |
@@ -306,8 +306,7 @@ private void updateAttributes(MonitoringServiceConfiguration monitoringConfig, A | |||
* attribute value. | |||
*/ | |||
private MonitoredAttribute parseToMonitoredAttribute(String input, MonitoredAttribute monitoredAttribute) throws PropertyVetoException { | |||
// Negative lookbehind - find space characters not preceeded by \ | |||
String[] attributeTokens = input.split("(?<!\\\\) "); | |||
String[] attributeTokens = input.split("(?=objectName)|(?=attributeName)|(?=description)"); |
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.
Replacing the descriptive comment rather than removing it would be better.
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.
Isn't the code self-explanatory? Hence, doesn't require a comment.
@@ -306,8 +306,7 @@ private void updateAttributes(MonitoringServiceConfiguration monitoringConfig, A | |||
* attribute value. | |||
*/ | |||
private MonitoredAttribute parseToMonitoredAttribute(String input, MonitoredAttribute monitoredAttribute) throws PropertyVetoException { | |||
// Negative lookbehind - find space characters not preceeded by \ | |||
String[] attributeTokens = input.split("(?<!\\\\) "); | |||
String[] attributeTokens = input.split("(?=objectName)|(?=attributeName)|(?=description)"); |
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.
This is a neat fix, but unfortunately has a small hole in it.
If you use the command:
set-monitoring-configuration --addattribute "objectName=myObject attributeName=myAttribute description=a test attribute"
the stored attributeName
will be myAttribute
(with a space).
If you then run:
set-monitoring-configuration --delattribute "objectName=myObject attributeName=myAttribute"
the attribute to be searched for will be myAttribute
(without a space).
The parsed string will need to be String.trim()
ed probably here.
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.
This regex string also has the problem of hating when the description has the word 'description' in. I would recommend something like changing the regex string to '(?=objectName ?=)|(?=attributeName ?=)|(?=description ?=)' to make sure it catches this!
Jenkins test please |
Quick build and test passed! |
@@ -306,7 +306,7 @@ private void updateAttributes(MonitoringServiceConfiguration monitoringConfig, A | |||
* attribute value. | |||
*/ | |||
private MonitoredAttribute parseToMonitoredAttribute(String input, MonitoredAttribute monitoredAttribute) throws PropertyVetoException { | |||
String[] attributeTokens = input.split("(?=objectName)|(?=attributeName)|(?=description)"); | |||
String[] attributeTokens = input.split("(?=objectName?=)|(?=attributeName?=)|(?=description?=)"); |
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.
Needs a space before the new question mark ;)
Jenkins test please |
Quick build and test passed! |
No description provided.