Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dd-java-agent/agent-iast/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ jmh {
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
}

tasks.named("forbiddenApisJmh") {
ignoreFailures = true
}

sourceSets {
test {
java {
Expand Down
1 change: 1 addition & 0 deletions dd-java-agent/agent-tooling/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ tasks.named("forbiddenApisTest_java11") {
// it will fail due to missing JDK >= 9 classes
// java.lang.ClassNotFoundException: java.lang.invoke.StringConcatFactory
failOnMissingClasses = false
ignoreFailures = true
}

tasks.named("compileTestJava") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import datadog.trace.bootstrap.instrumentation.websocket.HandlerContext;
import datadog.trace.util.RandomUtils;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
import java.util.UUID;

@ChannelHandler.Sharable
public class HttpServerResponseTracingHandler extends ChannelOutboundHandlerAdapter {
Expand Down Expand Up @@ -49,7 +49,7 @@ public void write(final ChannelHandlerContext ctx, final Object msg, final Chann
String channelId =
ctx.channel()
.attr(CHANNEL_ID)
.setIfAbsent(UUID.randomUUID().toString().substring(0, 8));
.setIfAbsent(RandomUtils.randomUUID().toString().substring(0, 8));
ctx.channel()
.attr(WEBSOCKET_SENDER_HANDLER_CONTEXT)
.set(new HandlerContext.Sender(span, channelId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static datadog.trace.util.Strings.getResourceName;

import de.thetaphi.forbiddenapis.SuppressForbidden;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
Expand Down Expand Up @@ -45,6 +46,7 @@ public static byte[] convertToByteArray(final Class<?> clazz) throws IOException
* @return the location of the newly created jar.
* @throws IOException if the jar file cannot be created.
*/
@SuppressForbidden
public static URL createJarWithClasses(final ClassLoader loader, final String... resourceNames)
throws IOException {
final File tmpJar = File.createTempFile(UUID.randomUUID().toString(), ".jar");
Expand Down Expand Up @@ -75,6 +77,7 @@ public static URL createJarWithClasses(final ClassLoader loader, final String...
* @return the location of the newly created jar.
* @throws IOException
*/
@SuppressForbidden
public static URL createJarWithClasses(final Class<?>... classes) throws IOException {
final File tmpJar = File.createTempFile(UUID.randomUUID().toString(), ".jar");
tmpJar.deleteOnExit();
Expand Down
2 changes: 1 addition & 1 deletion gradle/forbiddenApiFilters/main.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ java.lang.String#replaceAll(java.lang.String,java.lang.String)
java.lang.String#replaceFirst(java.lang.String,java.lang.String)

# can initialize java.util.logging when ACCP is installed, prefer RandomUtils instead
java.util.UUID.randomUUID()
java.util.UUID#randomUUID()

# prefer the NameMatchers/HierarchyMatchers equivalent instead
net.bytebuddy.matcher.ElementMatchers#named(java.lang.String)
Expand Down