Skip to content

Commit 4b61350

Browse files
committed
source: format all source code
1 parent e3e45dc commit 4b61350

File tree

44 files changed

+271
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+271
-204
lines changed

jooby/src/main/java/io/jooby/StatusCode.java

Lines changed: 104 additions & 0 deletions
Large diffs are not rendered by default.

jooby/src/main/java/io/jooby/internal/x509/JdkSslContext.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,15 @@ public final long sessionTimeout() {
155155
*/
156156
protected static KeyManagerFactory buildKeyManagerFactory(
157157
final InputStream certChainFile, final InputStream keyFile, final String keyPassword)
158-
throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException,
159-
NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException,
160-
CertificateException, KeyException, IOException {
158+
throws UnrecoverableKeyException,
159+
KeyStoreException,
160+
NoSuchAlgorithmException,
161+
NoSuchPaddingException,
162+
InvalidKeySpecException,
163+
InvalidAlgorithmParameterException,
164+
CertificateException,
165+
KeyException,
166+
IOException {
161167
String algorithm = Security.getProperty("ssl.KeyManagerFactory.algorithm");
162168
if (algorithm == null) {
163169
algorithm = "SunX509";
@@ -183,9 +189,15 @@ protected static KeyManagerFactory buildKeyManagerFactory(
183189
final String keyAlgorithm,
184190
final InputStream keyFile,
185191
final String keyPassword)
186-
throws KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException,
187-
InvalidKeySpecException, InvalidAlgorithmParameterException, IOException,
188-
CertificateException, KeyException, UnrecoverableKeyException {
192+
throws KeyStoreException,
193+
NoSuchAlgorithmException,
194+
NoSuchPaddingException,
195+
InvalidKeySpecException,
196+
InvalidAlgorithmParameterException,
197+
IOException,
198+
CertificateException,
199+
KeyException,
200+
UnrecoverableKeyException {
189201
char[] keyPasswordChars = keyPassword == null ? EMPTY_CHARS : keyPassword.toCharArray();
190202
KeyStore ks = buildKeyStore(certChainFile, keyFile, keyPasswordChars);
191203
KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyAlgorithm);

jooby/src/main/java/io/jooby/internal/x509/SslContext.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,12 @@ public static SslContext newServerContextInternal(
125125
* faulty
126126
*/
127127
protected static PKCS8EncodedKeySpec generateKeySpec(final char[] password, final byte[] key)
128-
throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException,
129-
InvalidKeyException, InvalidAlgorithmParameterException {
128+
throws IOException,
129+
NoSuchAlgorithmException,
130+
NoSuchPaddingException,
131+
InvalidKeySpecException,
132+
InvalidKeyException,
133+
InvalidAlgorithmParameterException {
130134

131135
if (password == null || password.length == 0) {
132136
return new PKCS8EncodedKeySpec(key);
@@ -155,9 +159,14 @@ protected static PKCS8EncodedKeySpec generateKeySpec(final char[] password, fina
155159
*/
156160
static KeyStore buildKeyStore(
157161
final InputStream certChainFile, final InputStream keyFile, final char[] keyPasswordChars)
158-
throws KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException,
159-
InvalidKeySpecException, InvalidAlgorithmParameterException, CertificateException,
160-
KeyException, IOException {
162+
throws KeyStoreException,
163+
NoSuchAlgorithmException,
164+
NoSuchPaddingException,
165+
InvalidKeySpecException,
166+
InvalidAlgorithmParameterException,
167+
CertificateException,
168+
KeyException,
169+
IOException {
161170
ByteBuffer encodedKeyBuf = PemReader.readPrivateKey(keyFile);
162171
byte[] encodedKey = encodedKeyBuf.array();
163172

modules/jooby-apt/src/main/java/io/jooby/internal/apt/Annotations.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,34 +52,49 @@ public interface Annotations {
5252

5353
/** JAXRS GET. */
5454
String JAXRS_GET = "jakarta.ws.rs.GET";
55+
5556
/** JAXRS POST. */
5657
String JAXRS_POST = "jakarta.ws.rs.POST";
58+
5759
/** JAXRS PUT. */
5860
String JAXRS_PUT = "jakarta.ws.rs.PUT";
61+
5962
/** JAXRS DELETE. */
6063
String JAXRS_DELETE = "jakarta.ws.rs.DELETE";
64+
6165
/** JAXRS PATCH. */
6266
String JAXRS_PATCH = "jakarta.ws.rs.PATCH";
67+
6368
/** JAXRS HEAD. */
6469
String JAXRS_HEAD = "jakarta.ws.rs.HEAD";
70+
6571
/** JAXRS OPTIONS. */
6672
String JAXRS_OPTIONS = "jakarta.ws.rs.OPTIONS";
73+
6774
/** JAXRS Context. */
6875
String JAXRS_CONTEXT = "jakarta.ws.rs.core.Context";
76+
6977
/** JAXRS Query Param. */
7078
String JAXRS_QUERY = "jakarta.ws.rs.QueryParam";
79+
7180
/** JAXRS Path Param. */
7281
String JAXRS_PATH_PARAM = "jakarta.ws.rs.PathParam";
82+
7383
/** JAXRS Cookie Param. */
7484
String JAXRS_COOKIE = "jakarta.ws.rs.CookieParam";
85+
7586
/** JAXRS Header Param. */
7687
String JAXRS_HEADER = "jakarta.ws.rs.HeaderParam";
88+
7789
/** JAXRS Form Param. */
7890
String JAXRS_FORM = "jakarta.ws.rs.FormParam";
91+
7992
/** JAXRS PRODUCES. */
8093
String JAXRS_PRODUCES = "jakarta.ws.rs.Produces";
94+
8195
/** JAXRS CONSUMES. */
8296
String JAXRS_CONSUMES = "jakarta.ws.rs.Consumes";
97+
8398
/** JAXRS PATH. */
8499
String JAXRS_PATH = "jakarta.ws.rs.Path";
85100

modules/jooby-apt/src/test/java/source/JaxrsController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package source;
77

88
import io.jooby.Context;
9-
109
import jakarta.ws.rs.*;
1110

1211
@Path("/jaxrs")

modules/jooby-avaje-jsonb/src/main/java/io/jooby/avaje/jsonb/AvajeJsonbModule.java

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
package io.jooby.avaje.jsonb;
77

8+
import java.io.InputStream;
9+
import java.lang.reflect.Type;
10+
811
import edu.umd.cs.findbugs.annotations.NonNull;
912
import io.avaje.jsonb.Jsonb;
1013
import io.jooby.Body;
@@ -15,8 +18,6 @@
1518
import io.jooby.MessageDecoder;
1619
import io.jooby.MessageEncoder;
1720
import io.jooby.ServiceRegistry;
18-
import java.io.InputStream;
19-
import java.lang.reflect.Type;
2021

2122
/**
2223
* JSON module using Avaje-JsonB: <a
@@ -43,8 +44,8 @@
4344
* });
4445
* }
4546
* }</pre>
46-
* <p>
47-
* For body decoding the client must specify the <code>Content-Type</code> header set to <code>
47+
*
48+
* <p>For body decoding the client must specify the <code>Content-Type</code> header set to <code>
4849
* application/json</code>.
4950
*
5051
* <p>You can retrieve the {@link Jsonb} object via require call:
@@ -56,57 +57,54 @@
5657
*
5758
* }
5859
* }</pre>
60+
*
5961
* <p>
6062
*
6163
* @author ZY (kzou227@qq.com)
6264
* @since 3.0.7
6365
*/
6466
public class AvajeJsonbModule implements Extension, MessageDecoder, MessageEncoder {
6567

66-
private final Jsonb jsonb;
68+
private final Jsonb jsonb;
6769

68-
/**
69-
* Creates a new module and use an Avaje-JsonB instance.
70-
*
71-
* @param jsonb Gson to use.
72-
*/
73-
public AvajeJsonbModule(@NonNull Jsonb jsonb) {
74-
this.jsonb = jsonb;
75-
}
70+
/**
71+
* Creates a new module and use an Avaje-JsonB instance.
72+
*
73+
* @param jsonb Gson to use.
74+
*/
75+
public AvajeJsonbModule(@NonNull Jsonb jsonb) {
76+
this.jsonb = jsonb;
77+
}
7678

77-
/**
78-
* Creates a new Avaje-JsonB module.
79-
*/
80-
public AvajeJsonbModule() {
81-
this(Jsonb.builder().build());
82-
}
79+
/** Creates a new Avaje-JsonB module. */
80+
public AvajeJsonbModule() {
81+
this(Jsonb.builder().build());
82+
}
8383

84-
@Override
85-
public void install(@NonNull Jooby application) throws Exception {
86-
application.decoder(MediaType.json, this);
87-
application.encoder(MediaType.json, this);
84+
@Override
85+
public void install(@NonNull Jooby application) throws Exception {
86+
application.decoder(MediaType.json, this);
87+
application.encoder(MediaType.json, this);
8888

89-
ServiceRegistry services = application.getServices();
90-
services.put(Jsonb.class, jsonb);
91-
}
89+
ServiceRegistry services = application.getServices();
90+
services.put(Jsonb.class, jsonb);
91+
}
9292

93-
@NonNull
94-
@Override
95-
public Object decode(@NonNull Context ctx, @NonNull Type type) throws Exception {
96-
Body body = ctx.body();
97-
if (body.isInMemory()) {
98-
return jsonb.type(type).fromJson(body.bytes());
99-
} else {
100-
try (InputStream stream = body.stream()) {
101-
return jsonb.type(type).fromJson(stream);
102-
}
103-
}
93+
@NonNull @Override
94+
public Object decode(@NonNull Context ctx, @NonNull Type type) throws Exception {
95+
Body body = ctx.body();
96+
if (body.isInMemory()) {
97+
return jsonb.type(type).fromJson(body.bytes());
98+
} else {
99+
try (InputStream stream = body.stream()) {
100+
return jsonb.type(type).fromJson(stream);
101+
}
104102
}
103+
}
105104

106-
@NonNull
107-
@Override
108-
public byte[] encode(@NonNull Context ctx, @NonNull Object value) {
109-
ctx.setDefaultResponseType(MediaType.json);
110-
return jsonb.toJsonBytes(value);
111-
}
105+
@NonNull @Override
106+
public byte[] encode(@NonNull Context ctx, @NonNull Object value) {
107+
ctx.setDefaultResponseType(MediaType.json);
108+
return jsonb.toJsonBytes(value);
109+
}
112110
}

modules/jooby-avaje-jsonb/src/main/java/module-info.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
44
* Copyright 2014 Edgar Espina
55
*/
6-
/**
7-
* Avaje jsonb module.
8-
*/
6+
/** Avaje jsonb module. */
97
module io.jooby.avaje.jsonb {
108
exports io.jooby.avaje.jsonb;
119

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
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.avaje.jsonb;
27

38
import static io.avaje.jsonb.Types.listOf;
49
import static org.junit.jupiter.api.Assertions.assertEquals;
510
import static org.junit.jupiter.api.Assertions.assertTrue;
611

7-
import io.jooby.test.MockContext;
812
import java.util.List;
13+
914
import org.junit.jupiter.api.Test;
1015

16+
import io.jooby.test.MockContext;
17+
1118
/**
1219
* @author ZY (kzou227@qq.com)
1320
*/
1421
@SuppressWarnings("unchecked")
1522
class AvajeJsonbModuleTest {
1623

17-
@Test
18-
void decode() throws Exception {
19-
var decoder = new AvajeJsonbModule();
20-
var ctx = new MockContext();
21-
ctx.setBody("[1,2,3]");
22-
23-
var o = (List<Integer>) decoder.decode(ctx, listOf(Integer.class));
24-
assertTrue(o.containsAll(List.of(1, 2, 3)));
25-
}
26-
27-
@Test
28-
void encode() {
29-
var decoder = new AvajeJsonbModule();
30-
var ctx = new MockContext();
31-
var o = List.of(1, 2, 3);
32-
var json = decoder.encode(ctx, o);
33-
assertEquals("[1,2,3]", new String(json));
34-
}
35-
}
24+
@Test
25+
void decode() throws Exception {
26+
var decoder = new AvajeJsonbModule();
27+
var ctx = new MockContext();
28+
ctx.setBody("[1,2,3]");
29+
30+
var o = (List<Integer>) decoder.decode(ctx, listOf(Integer.class));
31+
assertTrue(o.containsAll(List.of(1, 2, 3)));
32+
}
33+
34+
@Test
35+
void encode() {
36+
var decoder = new AvajeJsonbModule();
37+
var ctx = new MockContext();
38+
var o = List.of(1, 2, 3);
39+
var json = decoder.encode(ctx, o);
40+
assertEquals("[1,2,3]", new String(json));
41+
}
42+
}

modules/jooby-bom/pom.template.xml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<url>https://jooby.io</url>
1919

2020
<!-- THIS FILE IS AUTO GENERATED. DON'T EDIT -->
21+
<properties>
22+
<spotless.check.skip>true</spotless.check.skip>
23+
</properties>
2124

2225
@dependencies
2326

@@ -53,18 +56,4 @@
5356
</repository>
5457
</distributionManagement>
5558

56-
<!-- We need this here for pre-commit-hook while applying formatter -->
57-
<build>
58-
<plugins>
59-
<plugin>
60-
<groupId>com.diffplug.spotless</groupId>
61-
<artifactId>spotless-maven-plugin</artifactId>
62-
<version>2.27.2</version>
63-
<configuration>
64-
<skip>true</skip>
65-
</configuration>
66-
</plugin>
67-
</plugins>
68-
</build>
69-
7059
</project>

modules/jooby-bom/pom.xml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<url>https://jooby.io</url>
1919

2020
<!-- THIS FILE IS AUTO GENERATED. DON'T EDIT -->
21+
<properties>
22+
<spotless.check.skip>true</spotless.check.skip>
23+
</properties>
2124

2225
<dependencyManagement>
2326
<dependencies>
@@ -321,18 +324,4 @@
321324
</repository>
322325
</distributionManagement>
323326

324-
<!-- We need this here for pre-commit-hook while applying formatter -->
325-
<build>
326-
<plugins>
327-
<plugin>
328-
<groupId>com.diffplug.spotless</groupId>
329-
<artifactId>spotless-maven-plugin</artifactId>
330-
<version>2.27.2</version>
331-
<configuration>
332-
<skip>true</skip>
333-
</configuration>
334-
</plugin>
335-
</plugins>
336-
</build>
337-
338327
</project>

0 commit comments

Comments
 (0)