JMX: Quote object name values if not identifiers

https://www.oracle.com/technetwork/java/javase/tech/best-practices-jsp-136021.html

The set of characters in a value is also limited. If special characters may
occur, it is recommended that the value be quoted, using ObjectName.quote. If
the value for a given key is sometimes quoted, then it should always be quoted.
By default, if a value is a string (rather than a number, say), then it should
be quoted unless you are sure that it will never contain special characters.

Practically, some special characters are allowed, but we will standardize on
allowed characters in java identifiers.
This commit is contained in:
Gary Russell
2018-10-09 14:56:31 -04:00
committed by Artem Bilan
parent 7ef38919b8
commit 551f03caa4
6 changed files with 44 additions and 12 deletions

View File

@@ -332,6 +332,8 @@ The exporter propagates the `default-domain` to that object to let it generate a
If your custom naming strategy is a `MetadataNamingStrategy` (or a subclass of it), the exporter does not propagate the `default-domain`.
You must configure it on your strategy bean.
Starting with version 5.1; any bean names (represented by the `name` key in the object name) will be quoted if they contain any characters that are not allowed in a Java identifier (or period `.`).
[[jmx-42-improvements]]
===== JMX Improvements

View File

@@ -182,3 +182,11 @@ See <<jms>> for more information.
The `statusCodeExpression` (and `Function`) is now supplied with the `RequestEntity<?>` as a root object for evaluation context, so request headers, method, URI and body are available for target status code calculation.
See <<http>> and <<webflux>> for more information.
[[x51.-jmx]]
=== JMX Changes
Object name key values are now quoted if they contain any characters other than those allowed in a Java identifier (or period `.`).
e.g. `org.springframework.integration:type=MessageChannel,name="input:foo.myGroup.errors"`.
This has the side effect that previously "allowed" names, with such characters, will now be quoted.
e.g. `org.springframework.integration:type=MessageChannel,name="input#foo.myGroup.errors"`.