Skip to content

Instantly share code, notes, and snippets.

@tkobayas
Created September 9, 2024 09:00
Show Gist options
  • Save tkobayas/d74b103eb98d62b1300e6d905699486a to your computer and use it in GitHub Desktop.
Save tkobayas/d74b103eb98d62b1300e6d905699486a to your computer and use it in GitHub Desktop.
maven-resolver-debug.diff
diff --git a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
index 11e9a913..027112e9 100644
--- a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
+++ b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
@@ -556,11 +556,12 @@ final class BasicRepositoryConnector implements RepositoryConnector {
baos.write(buffer, 0, read);
}
}
-
+ LOGGER.info("runTask : uploading " + file.getName());
byte[] bytes = baos.toByteArray();
transporter.put(new PutTask(path).setDataBytes(bytes).setListener(listener));
uploadChecksums(file, bytes);
} else {
+ LOGGER.info("#runTask : uploading " + file.getName());
transporter.put(new PutTask(path).setDataFile(file).setListener(listener));
uploadChecksums(file, null);
}
diff --git a/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java b/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java
index 8cd00f50..c3a6bb9f 100644
--- a/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java
+++ b/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java
@@ -152,6 +152,8 @@ final class HttpTransporter extends AbstractTransporter {
private final boolean supportWebDav;
+ public static final int ONE_SECOND = 1000;
+
@SuppressWarnings("checkstyle:methodlength")
HttpTransporter(
Map<String, ChecksumExtractor> checksumExtractors,
@@ -482,6 +484,12 @@ final class HttpTransporter extends AbstractTransporter {
try {
SharingHttpContext context = new SharingHttpContext(state);
prepare(request, context);
+ LOGGER.info("execute {}", request);
+ if (request.toString().contains("simple-pojo05")
+ && request.toString().contains("jar HTTP/1.1")) {
+ Thread.sleep(ONE_SECOND);
+ throw new IOException("DEBUG");
+ }
try (CloseableHttpResponse response = client.execute(server, request, context)) {
try {
context.close();
@@ -493,6 +501,7 @@ final class HttpTransporter extends AbstractTransporter {
EntityUtils.consumeQuietly(response.getEntity());
}
}
+ LOGGER.info("execute done {}", request);
} catch (IOException e) {
if (e.getCause() instanceof TransferCancelledException) {
throw (Exception) e.getCause();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment