Summary
WIndows has trouble with newlines and I'm not sure how you want to proceed.
Failure
When I run JfrSchemaFactoryTest.canRunSimpleSelectFromClassLoad on Windows, it fails on column 2 because the newlines are different:
assertThat(rs.getString(2)).isEqualTo("""
{
classLoader = null
name = "java/lang/Throwable"
package = {
name = "java/lang"
module = {
name = "java.base"
version = "17"
location = "jrt:/java.base"
classLoader = null
}
exported = true
}
modifiers = 33
hidden = false
}
""");
Cause
JfrSchema.getConverter is using the following converter:
else if (field.getTypeName().equals("java.lang.Class")) {
LOGGER.log(INFO, "| -> java.lang.Class");
return event -> event.getClass(field.getName());
}
I believe when the testcase calls rs.getString(), this is calling RecordedClass.toString() which ultimately uses StructuredWriter.lineSeparator which is initialized to String.format("%n"), and this differs by platform.
Possible solutions
Should we return the java.lang.Class in this case, rather than the RecordedClass object? The Class.toString() method should produce the same result on all platforms.
Summary
WIndows has trouble with newlines and I'm not sure how you want to proceed.
Failure
When I run
JfrSchemaFactoryTest.canRunSimpleSelectFromClassLoadon Windows, it fails on column 2 because the newlines are different:Cause
JfrSchema.getConverteris using the following converter:I believe when the testcase calls
rs.getString(), this is callingRecordedClass.toString()which ultimately usesStructuredWriter.lineSeparatorwhich is initialized toString.format("%n"), and this differs by platform.Possible solutions
Should we return the
java.lang.Classin this case, rather than theRecordedClassobject? TheClass.toString()method should produce the same result on all platforms.