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

PAYARA-2911 Can't set description for JMX Monitoring attributes #2968

Merged
merged 3 commits into from Jul 23, 2018

Conversation

MeroRai
Copy link
Member

@MeroRai MeroRai commented Jul 18, 2018

No description provided.

@MeroRai MeroRai added this to the Payara 5.183 milestone Jul 18, 2018
@MeroRai MeroRai self-assigned this Jul 18, 2018
@MeroRai MeroRai requested a review from MattGill98 July 18, 2018 14:04
@MeroRai
Copy link
Member Author

MeroRai commented Jul 18, 2018

Jenkins test please

@payara-ci
Copy link
Contributor

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)");
Copy link
Member

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.

Copy link
Member Author

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)");
Copy link
Contributor

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.

Copy link
Contributor

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!

@MeroRai
Copy link
Member Author

MeroRai commented Jul 20, 2018

Jenkins test please

@payara-ci
Copy link
Contributor

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?=)");
Copy link
Contributor

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 ;)

@MeroRai
Copy link
Member Author

MeroRai commented Jul 23, 2018

Jenkins test please

@payara-ci
Copy link
Contributor

Quick build and test passed!

@MattGill98 MattGill98 merged commit a7ce229 into payara:master Jul 23, 2018
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

Successfully merging this pull request may close these issues.

None yet

4 participants