From 905bf82f80a3152fc4c889f6586307066c6206f9 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 12 Sep 2019 10:14:58 +1000 Subject: [PATCH] reformatting Signed-off-by: Greg Wilkins --- .../jetty/http/pathmap/ServletPathSpec.java | 2 +- .../jetty/http2/hpack/HpackDecoder.java | 2 +- .../jetty/http2/hpack/HpackEncoder.java | 8 +++---- .../eclipse/jetty/http2/hpack/Huffman.java | 21 +++++++++--------- .../session/AbstractSessionDataStore.java | 22 ++++++++----------- 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java index d214323e6e7..e9d9de80ccc 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java @@ -89,7 +89,7 @@ public class ServletPathSpec extends PathSpec { this.group = PathSpecGroup.EXACT; this.prefix = servletPathSpec; - if (servletPathSpec.endsWith("*") ) + if (servletPathSpec.endsWith("*")) { LOG.warn("Suspicious URL pattern: '{}'; see sections 12.1 and 12.2 of the Servlet specification", servletPathSpec); diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java index bb1d3ede5fb..69f0cca8139 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackDecoder.java @@ -177,7 +177,7 @@ public class HpackDecoder else name = toASCIIString(buffer, length); check: - for (int i = name.length(); i-- > 0;) + for (int i = name.length(); i-- > 0; ) { char c = name.charAt(i); if (c > 0xff) diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java index a6c3bda169b..38f9c4f4cbe 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java @@ -404,8 +404,8 @@ public class HpackEncoder { // Not iso_8859_1 byte[] bytes = value.getBytes(StandardCharsets.UTF_8); - NBitInteger.encode(buffer,7,Huffman.octetsNeeded(bytes)); - Huffman.encode(buffer,bytes); + NBitInteger.encode(buffer, 7, Huffman.octetsNeeded(bytes)); + Huffman.encode(buffer, bytes); } } else @@ -421,8 +421,8 @@ public class HpackEncoder // Not iso_8859_1, so re-encode as UTF-8 buffer.reset(); byte[] bytes = value.getBytes(StandardCharsets.UTF_8); - NBitInteger.encode(buffer,7,bytes.length); - buffer.put(bytes,0,bytes.length); + NBitInteger.encode(buffer, 7, bytes.length); + buffer.put(bytes, 0, bytes.length); return; } buffer.put((byte)c); diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/Huffman.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/Huffman.java index 4645a6cebfb..85cc3a9ebc6 100644 --- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/Huffman.java +++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/Huffman.java @@ -358,8 +358,8 @@ public class Huffman return decode(buffer, buffer.remaining()); } - public static String decode(ByteBuffer buffer,int length) throws HpackException.CompressionException - { + public static String decode(ByteBuffer buffer, int length) throws HpackException.CompressionException + { Utf8StringBuilder utf8 = new Utf8StringBuilder(length * 2); int node = 0; int current = 0; @@ -430,20 +430,20 @@ public class Huffman } public static int octetsNeeded(byte[] b) - { - return octetsNeeded(CODES,b); + { + return octetsNeeded(CODES, b); } - + public static void encode(ByteBuffer buffer, String s) { encode(CODES, buffer, s); } - public static void encode(ByteBuffer buffer,byte[] b) + public static void encode(ByteBuffer buffer, byte[] b) { - encode(CODES,buffer,b); + encode(CODES, buffer, b); } - + public static int octetsNeededLC(String s) { return octetsNeeded(LCCODES, s); @@ -469,7 +469,7 @@ public class Huffman return (needed + 7) / 8; } - private static int octetsNeeded(final int[][] table,byte[] b) + private static int octetsNeeded(final int[][] table, byte[] b) { int needed = 0; int len = b.length; @@ -485,7 +485,6 @@ public class Huffman * @param table The table to encode by * @param buffer The buffer to encode to * @param s The string to encode - * @return True if the string could be encoded, false otherwise (and the buffer may have been modified). */ private static void encode(final int[][] table, ByteBuffer buffer, String s) { @@ -519,7 +518,7 @@ public class Huffman } } - private static void encode(final int[][] table,ByteBuffer buffer,byte[] b) + private static void encode(final int[][] table, ByteBuffer buffer, byte[] b) { long current = 0; int n = 0; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java index 01dc84e87d6..12bb46d86e9 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java @@ -81,24 +81,20 @@ public abstract class AbstractSessionDataStore extends ContainerLifeCycle implem public SessionData load(String id) throws Exception { if (!isStarted()) - throw new IllegalStateException ("Not started"); + throw new IllegalStateException("Not started"); final AtomicReference reference = new AtomicReference(); final AtomicReference exception = new AtomicReference(); - Runnable r = new Runnable() + Runnable r = () -> { - @Override - public void run() + try { - try - { - reference.set(doLoad(id)); - } - catch (Exception e) - { - exception.set(e); - } + reference.set(doLoad(id)); + } + catch (Exception e) + { + exception.set(e); } }; @@ -165,7 +161,7 @@ public abstract class AbstractSessionDataStore extends ContainerLifeCycle implem public Set getExpired(Set candidates) { if (!isStarted()) - throw new IllegalStateException ("Not started"); + throw new IllegalStateException("Not started"); try {