Skip to content

Commit 38d8ccb

Browse files
committed
Fix new checkstyle violations
1 parent 3c4fc78 commit 38d8ccb

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/FluxWriter.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2016-2017 the original author or authors.
2+
* Copyright 2019-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -45,11 +45,11 @@ class FluxWriter extends Writer {
4545

4646
private List<Object> accumulated = new ArrayList<>();
4747

48-
public FluxWriter(Supplier<DataBuffer> factory) {
48+
FluxWriter(Supplier<DataBuffer> factory) {
4949
this(factory, Charset.defaultCharset());
5050
}
5151

52-
public FluxWriter(Supplier<DataBuffer> factory, Charset charset) {
52+
FluxWriter(Supplier<DataBuffer> factory, Charset charset) {
5353
this.factory = factory;
5454
this.charset = charset;
5555
}
@@ -72,7 +72,7 @@ public Publisher<? extends Publisher<? extends DataBuffer>> getBuffers() {
7272
buffers = buffers.concatWithValues(list.toArray(new String[0]));
7373
}
7474
}
75-
return buffers.map(string -> Mono.just(buffer().write(string, this.charset)));
75+
return buffers.map((string) -> Mono.just(buffer().write(string, this.charset)));
7676
}
7777

7878
@Override
@@ -111,4 +111,4 @@ public void write(Object thing) {
111111
}
112112
}
113113

114-
}
114+
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -119,7 +119,7 @@ protected Mono<Void> renderInternal(Map<String, Object> model, MediaType content
119119
else {
120120
map = model;
121121
}
122-
rendered = rendered.doOnSuccess(template -> template.execute(map, writer));
122+
rendered = rendered.doOnSuccess((template) -> template.execute(map, writer));
123123
return rendered
124124
.thenEmpty(Mono.defer(() -> exchange.getResponse()
125125
.writeAndFlushWith(Flux.from(writer.getBuffers()))))
@@ -130,7 +130,7 @@ private void close(FluxWriter writer) {
130130
try {
131131
writer.close();
132132
}
133-
catch (IOException e) {
133+
catch (IOException ex) {
134134
writer.release();
135135
}
136136
}
@@ -142,7 +142,7 @@ private Template compile(Resource resource) {
142142
return template;
143143
}
144144
}
145-
catch (IOException e) {
145+
catch (IOException ex) {
146146
throw new IllegalStateException("Cannot close reader");
147147
}
148148
}
@@ -160,7 +160,7 @@ protected Mono<Void> resolveAsyncAttributes(Map<String, Object> model) {
160160
}
161161
}
162162
return super.resolveAsyncAttributes(result)
163-
.doOnSuccess(v -> model.putAll(result));
163+
.doOnSuccess((v) -> model.putAll(result));
164164
}
165165

166166
private Resource resolveResource() {
@@ -183,14 +183,14 @@ private Reader getReader(Resource resource) throws IOException {
183183
}
184184

185185
private Optional<Charset> getCharset(MediaType mediaType) {
186-
return Optional.ofNullable(mediaType != null ? mediaType.getCharset() : null);
186+
return Optional.ofNullable((mediaType != null) ? mediaType.getCharset() : null);
187187
}
188188

189189
private static class FluxLambda implements Mustache.Lambda {
190190

191191
private Publisher<?> publisher;
192192

193-
public FluxLambda(Publisher<?> publisher) {
193+
FluxLambda(Publisher<?> publisher) {
194194
this.publisher = publisher;
195195
}
196196

@@ -200,12 +200,12 @@ public void execute(Fragment frag, Writer out) throws IOException {
200200
if (out instanceof FluxWriter) {
201201
FluxWriter fluxWriter = (FluxWriter) out;
202202
fluxWriter.flush();
203-
fluxWriter.write(
204-
Flux.from(this.publisher).map(value -> frag.execute(value)));
203+
fluxWriter.write(Flux.from(this.publisher)
204+
.map((value) -> frag.execute(value)));
205205
}
206206
}
207-
catch (IOException e) {
208-
e.printStackTrace();
207+
catch (IOException ex) {
208+
ex.printStackTrace();
209209
}
210210
}
211211

@@ -220,19 +220,19 @@ public void execute(Fragment frag, Writer out) throws IOException {
220220
frag.execute(writer);
221221
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
222222
new ByteArrayInputStream(writer.toString().getBytes())))) {
223-
reader.lines().forEach(line -> {
223+
reader.lines().forEach((line) -> {
224224
try {
225225
out.write("data: " + line + "\n");
226226
}
227-
catch (IOException e) {
228-
throw new IllegalStateException("Cannot write data", e);
227+
catch (IOException ex) {
228+
throw new IllegalStateException("Cannot write data", ex);
229229
}
230230
});
231231
}
232232
out.write(new char[] { '\n', '\n' });
233233
}
234-
catch (IOException e) {
235-
throw new IllegalStateException("Cannot render SSE data", e);
234+
catch (IOException ex) {
235+
throw new IllegalStateException("Cannot render SSE data", ex);
236236
}
237237
}
238238

0 commit comments

Comments
 (0)