Skip to content
Draft
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
5 changes: 4 additions & 1 deletion dd-java-agent/instrumentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ TaskProvider<JavaExec> registerIndexTask(String indexTaskName, String indexer, S
}

instrumentationNaming {
exclusions = ["org-json-20230227"] // org-json does not use semver
exclusions = [
"org-json-20230227",
// org-json does not use semver
]
suffixes = ["-common", "-stubs", "-iast"]
}

Expand Down
21 changes: 10 additions & 11 deletions dd-java-agent/instrumentation/commons-httpclient-2.0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ muzzle {
pass {
group = "commons-httpclient"
module = "commons-httpclient"
versions = "[2.0,]"
skipVersions += "20020423" // ancient pre-release version
skipVersions += '2.0-final' // broken metadata on maven central
assertInverse = true
versions = "[2.0,4.0)"
skipVersions += '3.1-jenkins-1'
skipVersions += '2.0-final'
}
pass {
name = 'commons-http-client-x' // for IAST instrumenters valid for 1.x
fail {
group = "commons-httpclient"
module = "commons-httpclient"
versions = "[2.0,]"
skipVersions += "20020423" // ancient pre-release version
skipVersions += '2.0-final' // broken metadata on maven central
assertInverse = false
versions = "[,2.0)"
}
}

Expand All @@ -27,5 +22,9 @@ dependencies {

testImplementation group: 'commons-httpclient', name: 'commons-httpclient', version: '2.0'

latestDepTestImplementation group: 'commons-httpclient', name: 'commons-httpclient', version: '(2.0,20000000]'
// latestDepTest tests against the highest 2.x release (module instruments 2.x only)
latestDepTestImplementation group: 'commons-httpclient', name: 'commons-httpclient', version: '2+'

testRuntimeOnly(project(':dd-java-agent:instrumentation:datadog:asm:iast-instrumenter'))
testRuntimeOnly(project(':dd-java-agent:instrumentation:java:java-net:java-net-1.8'))
}
129 changes: 0 additions & 129 deletions dd-java-agent/instrumentation/commons-httpclient-2.0/gradle.lockfile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.StatusLine;
import org.apache.commons.httpclient.URIException;

public class CommonsHttpClientDecorator extends HttpClientDecorator<HttpMethod, HttpMethod> {

public static final CharSequence COMMONS_HTTP_CLIENT =
UTF8BytesString.create("commons-http-client");
public static final CommonsHttpClientDecorator DECORATE = new CommonsHttpClientDecorator();
Expand All @@ -34,16 +34,14 @@ protected String method(final HttpMethod httpMethod) {
@Override
protected URI url(final HttpMethod httpMethod) throws URISyntaxException {
try {
// org.apache.commons.httpclient.URI -> java.net.URI
return new URI(httpMethod.getURI().toString());
} catch (final URIException e) {
throw new URISyntaxException("", e.getMessage());
org.apache.commons.httpclient.URI uri = httpMethod.getURI();
if (uri != null) {
return new URI(uri.toString());
}
} catch (Exception e) {
// getURI() can throw URIException; fall through to return null
}
}

@Override
protected HttpMethod sourceUrl(final HttpMethod httpMethod) {
return httpMethod;
return null;
}

@Override
Expand All @@ -53,18 +51,18 @@ protected int status(final HttpMethod httpMethod) {
}

@Override
protected String getRequestHeader(HttpMethod request, String headerName) {
Header header = request.getRequestHeader(headerName);
if (null != header) {
protected String getRequestHeader(HttpMethod httpMethod, String headerName) {
Header header = httpMethod.getRequestHeader(headerName);
if (header != null) {
return header.getValue();
}
return null;
}

@Override
protected String getResponseHeader(HttpMethod response, String headerName) {
Header header = response.getResponseHeader(headerName);
if (null != header) {
protected String getResponseHeader(HttpMethod httpMethod, String headerName) {
Header header = httpMethod.getResponseHeader(headerName);
if (header != null) {
return header.getValue();
}
return null;
Expand Down
Loading