Skip to content

Commit 5ba38c1

Browse files
committed
Checkstyle fixes
1 parent df9f2ba commit 5ba38c1

File tree

5 files changed

+45
-7
lines changed

5 files changed

+45
-7
lines changed

jooby/src/main/java/io/jooby/AccessLogHandler.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Jooby https://jooby.io
3+
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+
* Copyright 2014 Edgar Espina
5+
*/
16
package io.jooby;
27

38
import org.slf4j.Logger;
@@ -167,9 +172,12 @@ public class AccessLogHandler implements Route.Decorator {
167172
private static final char BR = ']';
168173
private static final char Q = '\"';
169174

170-
private static Function<Context, String> USER_OR_DASH = ctx -> Optional.ofNullable(ctx.getUser())
171-
.map(Object::toString)
172-
.orElse(DASH);
175+
private static final Function<Context, String> USER_OR_DASH = ctx ->
176+
Optional.ofNullable(ctx.getUser())
177+
.map(Object::toString)
178+
.orElse(DASH);
179+
/** Default buffer size. */
180+
private static final int MESSAGE_SIZE = 256;
173181

174182
/** The logging system. */
175183
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -207,7 +215,7 @@ public AccessLogHandler() {
207215
long timestamp = System.currentTimeMillis();
208216
return ctx -> {
209217
ctx.onComplete(context -> {
210-
StringBuilder sb = new StringBuilder(256);
218+
StringBuilder sb = new StringBuilder(MESSAGE_SIZE);
211219
sb.append(ctx.getRemoteAddress());
212220
sb.append(SP).append(DASH).append(SP);
213221
sb.append(userId.apply(ctx));

jooby/src/main/java/io/jooby/CompletionListeners.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
1+
/**
2+
* Jooby https://jooby.io
3+
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+
* Copyright 2014 Edgar Espina
5+
*/
16
package io.jooby;
27

38
import javax.annotation.Nonnull;
49
import java.util.ArrayList;
510
import java.util.List;
611
import java.util.stream.Stream;
712

13+
/**
14+
* Utility class that group one or more completion listeners and execute them in reverse order.
15+
*
16+
* @author edgar
17+
* @since 2.5.2
18+
*/
819
public class CompletionListeners {
920
private List<Route.Complete> listeners;
1021

22+
/**
23+
* Add a listener.
24+
*
25+
* @param listener Listener.
26+
*/
1127
public void addListener(@Nonnull Route.Complete listener) {
1228
if (listeners == null) {
1329
listeners = new ArrayList<>();
1430
}
1531
listeners.add(listener);
1632
}
1733

34+
/**
35+
* Execute all listeners.
36+
*
37+
* @param ctx Listeners.
38+
*/
1839
public void run(@Nonnull Context ctx) {
1940
if (listeners != null) {
2041
Throwable cause = null;

jooby/src/main/java/io/jooby/Route.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import io.jooby.exception.NotAcceptableException;
1010
import io.jooby.exception.NotFoundException;
1111
import io.jooby.exception.UnsupportedMediaType;
12-
import sun.security.krb5.Config;
1312

1413
import javax.annotation.Nonnull;
1514
import javax.annotation.Nullable;
@@ -462,7 +461,7 @@ public Route(@Nonnull String method, @Nonnull String pattern, @Nonnull Handler h
462461
/**
463462
* Recreate a path pattern using the given variables.
464463
*
465-
* <code>reserve(/{k1}/{k2}, {"k1": ""foo", "k2": "bar"}) => /foo/bar</code>
464+
* <code>reserve(/{k1}/{k2}, {"k1": ""foo", "k2": "bar"}) =&gt; /foo/bar</code>
466465
*
467466
* @param keys Path keys.
468467
* @return Path.
@@ -474,7 +473,7 @@ public Route(@Nonnull String method, @Nonnull String pattern, @Nonnull Handler h
474473
/**
475474
* Recreate a path pattern using the given variables.
476475
*
477-
* <code>reserve(/{k1}/{k2}, "foo", "bar") => /foo/bar</code>
476+
* <code>reserve(/{k1}/{k2}, "foo", "bar") =&gt; /foo/bar</code>
478477
*
479478
* @param values Values.
480479
* @return Path.

modules/jooby-jetty/src/main/java/io/jooby/internal/jetty/JettyOutputStream.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Jooby https://jooby.io
3+
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+
* Copyright 2014 Edgar Espina
5+
*/
16
package io.jooby.internal.jetty;
27

38
import java.io.IOException;

modules/jooby-utow/src/main/java/io/jooby/internal/utow/UtowCompletionListener.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Jooby https://jooby.io
3+
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+
* Copyright 2014 Edgar Espina
5+
*/
16
package io.jooby.internal.utow;
27

38
import io.jooby.CompletionListeners;

0 commit comments

Comments
 (0)