RFR: 6890: defineEventProbes should throw exception on malformed probe definitions

Marcus Hirt hirt at openjdk.java.net
Fri Mar 12 12:26:06 UTC 2021


On Thu, 11 Mar 2021 21:06:50 GMT, Joshua Matsuoka <jmatsuoka at openjdk.org> wrote:

> This PR addresses JMC-6890 (defineEventProbes should throw exception on malformed probe definitions) [1]. Previously the exception would be swallowed by DefaultTransformRegistry when the XML failed validation, and would simply return null. With this change the exception is rethrown and can be handled accordingly by the AgentController, which rethrows it, and the user. I've added a test for the AgentController and updated the test for DefaultTransformRegistry accordingly.
> 
> [1] https://bugs.openjdk.java.net/browse/JMC-6890

agent/src/main/java/org/openjdk/jmc/agent/TransformRegistry.java line 91:

> 89: 	 *             if the supplied XML fails to validate.
> 90: 	 */
> 91: 	Set<String> modify(String xmlDescription) throws XMLStreamException;

Perhaps have our own exception class (e.g. XmlValidationException)? It shouldn't depend on whatever XML parser methology we're using (StAX vs DOM etc).

-------------

PR: https://git.openjdk.java.net/jmc/pull/227


More information about the jmc-dev mailing list