diff --git a/std-bits/base/src/main/java/org/enso/base/net/URIHelpers.java b/std-bits/base/src/main/java/org/enso/base/net/URIHelpers.java index 21b3cfb3d5cca..70ebbbf58e96a 100644 --- a/std-bits/base/src/main/java/org/enso/base/net/URIHelpers.java +++ b/std-bits/base/src/main/java/org/enso/base/net/URIHelpers.java @@ -1,15 +1,15 @@ package org.enso.base.net; -import org.apache.http.client.utils.URIBuilder; - import java.net.URI; import java.net.URISyntaxException; import java.util.List; +import org.apache.http.client.utils.URIBuilder; public class URIHelpers { public record NameValuePair(String name, String value) {} - public static URI addQueryParameters(URI uri, List params) throws URISyntaxException { + public static URI addQueryParameters(URI uri, List params) + throws URISyntaxException { URIBuilder builder = new URIBuilder(uri); for (NameValuePair param : params) { builder.addParameter(param.name(), param.value()); diff --git a/tools/simple-httpbin/src/main/java/org/enso/shttp/BasicAuthTestHandler.java b/tools/simple-httpbin/src/main/java/org/enso/shttp/BasicAuthTestHandler.java index d88ed548ff6ab..d94a67c99c508 100644 --- a/tools/simple-httpbin/src/main/java/org/enso/shttp/BasicAuthTestHandler.java +++ b/tools/simple-httpbin/src/main/java/org/enso/shttp/BasicAuthTestHandler.java @@ -1,7 +1,6 @@ package org.enso.shttp; import com.sun.net.httpserver.HttpExchange; - import java.io.IOException; import java.util.Base64; import java.util.List; diff --git a/tools/simple-httpbin/src/main/java/org/enso/shttp/CrashingTestHandler.java b/tools/simple-httpbin/src/main/java/org/enso/shttp/CrashingTestHandler.java index 5f556079ec106..0b18798d57a5b 100644 --- a/tools/simple-httpbin/src/main/java/org/enso/shttp/CrashingTestHandler.java +++ b/tools/simple-httpbin/src/main/java/org/enso/shttp/CrashingTestHandler.java @@ -1,13 +1,13 @@ package org.enso.shttp; import com.sun.net.httpserver.HttpExchange; - import java.io.IOException; public class CrashingTestHandler extends SimpleHttpHandler { @Override public void doHandle(HttpExchange exchange) throws IOException { - // This exception will be logged by SimpleHttpHandler, but that's OK - let's know that this crash is happening. + // This exception will be logged by SimpleHttpHandler, but that's OK - let's know that this + // crash is happening. throw new RuntimeException("This handler crashes on purpose."); } } diff --git a/tools/simple-httpbin/src/main/java/org/enso/shttp/HeaderTestHandler.java b/tools/simple-httpbin/src/main/java/org/enso/shttp/HeaderTestHandler.java index b85e16be36b8b..6eb10d7923c66 100644 --- a/tools/simple-httpbin/src/main/java/org/enso/shttp/HeaderTestHandler.java +++ b/tools/simple-httpbin/src/main/java/org/enso/shttp/HeaderTestHandler.java @@ -1,10 +1,9 @@ package org.enso.shttp; import com.sun.net.httpserver.HttpExchange; -import org.apache.http.client.utils.URIBuilder; - import java.io.IOException; import java.net.URI; +import org.apache.http.client.utils.URIBuilder; public class HeaderTestHandler extends SimpleHttpHandler { @Override diff --git a/tools/simple-httpbin/src/main/java/org/enso/shttp/SimpleHTTPBin.java b/tools/simple-httpbin/src/main/java/org/enso/shttp/SimpleHTTPBin.java index ce5899d0aa58b..fe8a32c3f9d39 100644 --- a/tools/simple-httpbin/src/main/java/org/enso/shttp/SimpleHTTPBin.java +++ b/tools/simple-httpbin/src/main/java/org/enso/shttp/SimpleHTTPBin.java @@ -3,9 +3,6 @@ import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.SimpleFileServer; -import sun.misc.Signal; -import sun.misc.SignalHandler; - import java.io.IOException; import java.net.InetSocketAddress; import java.net.URISyntaxException; @@ -13,6 +10,8 @@ import java.nio.file.Path; import java.util.List; import java.util.stream.Stream; +import sun.misc.Signal; +import sun.misc.SignalHandler; public class SimpleHTTPBin { diff --git a/tools/simple-httpbin/src/main/java/org/enso/shttp/SimpleHttpHandler.java b/tools/simple-httpbin/src/main/java/org/enso/shttp/SimpleHttpHandler.java index 0baf318355c6a..acb8cbb4b9b2b 100644 --- a/tools/simple-httpbin/src/main/java/org/enso/shttp/SimpleHttpHandler.java +++ b/tools/simple-httpbin/src/main/java/org/enso/shttp/SimpleHttpHandler.java @@ -2,7 +2,6 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; - import java.io.IOException; import java.io.OutputStream; import java.nio.charset.StandardCharsets; @@ -31,7 +30,8 @@ public final void handle(HttpExchange exchange) throws IOException { public abstract void doHandle(HttpExchange exchange) throws IOException; - protected final void sendResponse(int code, String message, HttpExchange exchange) throws IOException { + protected final void sendResponse(int code, String message, HttpExchange exchange) + throws IOException { byte[] response = message.getBytes(StandardCharsets.UTF_8); exchange.getResponseHeaders().add("Content-Type", "text/plain; charset=utf-8"); exchange.sendResponseHeaders(code, response.length); diff --git a/tools/simple-httpbin/src/main/java/org/enso/shttp/TestHandler.java b/tools/simple-httpbin/src/main/java/org/enso/shttp/TestHandler.java index b97ff6fcada40..e88b34b8ce3d0 100644 --- a/tools/simple-httpbin/src/main/java/org/enso/shttp/TestHandler.java +++ b/tools/simple-httpbin/src/main/java/org/enso/shttp/TestHandler.java @@ -1,10 +1,6 @@ package org.enso.shttp; import com.sun.net.httpserver.HttpExchange; -import org.apache.commons.text.StringEscapeUtils; -import org.apache.http.NameValuePair; -import org.apache.http.client.utils.URIBuilder; - import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -17,6 +13,9 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.text.StringEscapeUtils; +import org.apache.http.NameValuePair; +import org.apache.http.client.utils.URIBuilder; public class TestHandler extends SimpleHttpHandler { private final HttpMethod expectedMethod; @@ -79,7 +78,8 @@ public void doHandle(HttpExchange exchange) throws IOException { response.append("\n"); response.append(" },\n"); - response.append(" \"origin\": \"" + exchange.getRemoteAddress().getAddress().getHostAddress() + "\",\n"); + response.append( + " \"origin\": \"" + exchange.getRemoteAddress().getAddress().getHostAddress() + "\",\n"); response.append(" \"path\": \"" + StringEscapeUtils.escapeJson(uri.getPath()) + "\",\n"); if (uri.getQuery() != null) { URIBuilder builder = new URIBuilder(uri); @@ -89,7 +89,12 @@ public void doHandle(HttpExchange exchange) throws IOException { NameValuePair param = params.get(i); String key = StringEscapeUtils.escapeJson(param.getName()); String value = StringEscapeUtils.escapeJson(param.getValue()); - response.append(" {\"name\": \"").append(key).append("\", \"value\": \"").append(value).append("\"}"); + response + .append(" {\"name\": \"") + .append(key) + .append("\", \"value\": \"") + .append(value) + .append("\"}"); boolean isLast = i == params.size() - 1; if (!isLast) { response.append(",\n"); @@ -108,8 +113,10 @@ public void doHandle(HttpExchange exchange) throws IOException { response.append(" \"form\": null,\n"); response.append(" \"files\": null,\n"); String value = readBody(exchange.getRequestBody(), textEncoding); - response.append(" \"data\": \"").append(value == null ? "" : StringEscapeUtils.escapeJson(value)).append( - "\",\n"); + response + .append(" \"data\": \"") + .append(value == null ? "" : StringEscapeUtils.escapeJson(value)) + .append("\",\n"); } response.append(" \"args\": {}\n"); response.append("}"); diff --git a/tools/simple-httpbin/src/main/java/org/enso/shttp/TokenAuthTestHandler.java b/tools/simple-httpbin/src/main/java/org/enso/shttp/TokenAuthTestHandler.java index cd6995aac323d..ef1d5501961c3 100644 --- a/tools/simple-httpbin/src/main/java/org/enso/shttp/TokenAuthTestHandler.java +++ b/tools/simple-httpbin/src/main/java/org/enso/shttp/TokenAuthTestHandler.java @@ -1,7 +1,6 @@ package org.enso.shttp; import com.sun.net.httpserver.HttpExchange; - import java.io.IOException; import java.util.List;