RFR: 6996: Properly support converters [v4]

Marcus Hirt hirt at openjdk.java.net
Fri Nov 27 14:23:54 UTC 2020


On Fri, 27 Nov 2020 09:23:01 GMT, Marcus Hirt <hirt at openjdk.org> wrote:

>> agent/src/test/resources/org/openjdk/jmc/agent/converters/test/jfrprobes_template.xml line 86:
>> 
>>> 84: 						</description>
>>> 85: 						<contenttype>None</contenttype>
>>> 86: 						<converter>org.openjdk.jmc.agent.converters.test.GurkConverterInt
>> 
>> Thinking more about this, would it actually make more sense to specify a _method_ here? In the end, that's what we want to identify. That'd allow for usage of existing methods named other than `convert()`. WDYT?
>
> I was considering it, since it would allow people to have multiple converters to different return types in the same class. It becomes a bit more cumbersome to specify though. Perhaps use convert as the default if only specified as a class, and the method, if specified?

Added.

>> agent/src/main/java/org/openjdk/jmc/agent/converters/FileConverter.java line 51:
>> 
>>> 49: 			return file.getCanonicalPath();
>>> 50: 		} catch (Throwable e) {
>>> 51: 			Agent.getLogger().warning("Agent failed to convert file to String: " + e.getMessage());
>> 
>> Should propagate the original exception instead of just its message?
>
> I thought it might be annoying, since you know where you've declared them. But perhaps I should - there might be multiple locations. Another variant would be to silently ignore and just return the path, but perhaps you do want to know.

Fixed.

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

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


More information about the jmc-dev mailing list