reformatting

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-09-12 10:14:58 +10:00
parent 05c7aaab6f
commit 905bf82f80
5 changed files with 25 additions and 30 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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<SessionData> reference = new AtomicReference<SessionData>();
final AtomicReference<Exception> exception = new AtomicReference<Exception>();
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<String> getExpired(Set<String> candidates)
{
if (!isStarted())
throw new IllegalStateException ("Not started");
throw new IllegalStateException("Not started");
try
{