diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/JsonUtils.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/JsonUtils.java index 9a68a53736..c98519534e 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/JsonUtils.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/JsonUtils.java @@ -18,12 +18,35 @@ */ package co.elastic.apm.agent; +import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +import java.io.IOException; +import java.nio.CharBuffer; public class JsonUtils { - private static final ObjectMapper objectMapper = new ObjectMapper(); + private static final ObjectMapper objectMapper; + + static { + objectMapper = new ObjectMapper(); + + // using default serializer for CharBuffer will try to make some properties accessible using introspection + // which fails with Java 15+ and we don't need in practice, thus using a custom serializer allows to avoid this. + SimpleModule module = new SimpleModule(); + module.addSerializer(CharBuffer.class, new StdSerializer(CharBuffer.class) { + + @Override + public void serialize(CharBuffer charBuffer, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + jsonGenerator.writeString(charBuffer.toString()); + } + }); + objectMapper.registerModule(module); + } public static JsonNode toJson(Object o) { return objectMapper.valueToTree(o); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java index d04039af56..c5c8ccdc62 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java @@ -43,6 +43,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnJre; +import org.junit.jupiter.api.condition.JRE; import org.slf4j.event.SubstituteLoggingEvent; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -292,6 +294,7 @@ void testPatchClassFileVersionJava6ToJava7() { } @Test + @DisabledOnJre(JRE.JAVA_15) // https://github.com/elastic/apm-agent-java/issues/1944 void testPatchClassFileVersionJava5ToJava7() { // loading classes compiled with bytecode level 49 (Java 6) new org.slf4j.event.SubstituteLoggingEvent(); @@ -311,6 +314,7 @@ void testPatchClassFileVersionJava5ToJava7() { } @Test + @DisabledOnJre(JRE.JAVA_15) // https://github.com/elastic/apm-agent-java/issues/1944 void testPatchClassFileVersionJava5ToJava7CommonsMath() { org.apache.commons.math3.stat.StatUtils.max(new double[]{3.14}); @@ -329,6 +333,7 @@ void testPatchClassFileVersionJava5ToJava7CommonsMath() { } @Test + @DisabledOnJre(JRE.JAVA_15) // https://github.com/elastic/apm-agent-java/issues/1944 void testPatchClassFileVersionJava4ToJava7CommonsMath() { org.apache.log4j.LogManager.exists("not"); diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/payload/ContainerInfoTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/payload/ContainerInfoTest.java index 1ab645fd3b..094a809fd5 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/payload/ContainerInfoTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/payload/ContainerInfoTest.java @@ -19,6 +19,8 @@ package co.elastic.apm.agent.impl.payload; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnJre; +import org.junit.jupiter.api.condition.JRE; import javax.annotation.Nullable; @@ -117,6 +119,7 @@ void testKubernetesInfo_podUid_with_underscores() { } @Test + @DisabledOnJre({JRE.JAVA_15, JRE.JAVA_16}) // https://github.com/elastic/apm-agent-java/issues/1942 void testKubernetesDownwardApi() throws Exception { String line = "1:name=systemd:/kubepods/besteffort/pode9b90526-f47d-11e8-b2a5-080027b9f4fb/15aa6e53-b09a-40c7-8558-c6c31e36c88a"; String containerId = "15aa6e53-b09a-40c7-8558-c6c31e36c88a"; diff --git a/apm-agent-plugins/apm-grails-plugin/pom.xml b/apm-agent-plugins/apm-grails-plugin/pom.xml index 9ddde33a07..dc8283897c 100644 --- a/apm-agent-plugins/apm-grails-plugin/pom.xml +++ b/apm-agent-plugins/apm-grails-plugin/pom.xml @@ -19,7 +19,7 @@ org.grails grails-web-mvc - 4.0.3 + 4.1.0.M4 provided diff --git a/pom.xml b/pom.xml index 2d4a40bf92..ba9f8023a8 100644 --- a/pom.xml +++ b/pom.xml @@ -356,6 +356,7 @@ org.jacoco jacoco-maven-plugin + 0.8.7