Skip to content

Commit c3ce4f0

Browse files
committed
Polish contribution
See gh-27823
1 parent e1200f3 commit c3ce4f0

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

spring-context-indexer/src/main/java/org/springframework/context/index/processor/MetadataStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -62,7 +62,7 @@ public void writeMetadata(CandidateComponentsMetadata metadata) throws IOExcepti
6262

6363

6464
private CandidateComponentsMetadata readMetadata(InputStream in) throws IOException {
65-
try (in){
65+
try (in) {
6666
return PropertiesMarshaller.read(in);
6767
}
6868
}

spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -101,8 +101,8 @@ private Map<Executable, String[]> inspectClass(Class<?> clazz) {
101101
}
102102
return NO_DEBUG_INFO_MAP;
103103
}
104-
// We cannot use try-with-resources here as, potential, exception upon closing
105-
// would still bubble up the stack
104+
// We cannot use try-with-resources here for the InputStream, since we have
105+
// custom handling of the close() method in a finally-block.
106106
try {
107107
ClassReader classReader = new ClassReader(is);
108108
Map<Executable, String[]> map = new ConcurrentHashMap<>(32);

spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -169,8 +169,8 @@ public BufferedImage read(@Nullable Class<? extends BufferedImage> clazz, HttpIn
169169

170170
ImageInputStream imageInputStream = null;
171171
ImageReader imageReader = null;
172-
// We cannot use try-with-resources here as, potential, exception upon closing
173-
// would still bubble up the stack
172+
// We cannot use try-with-resources here for the ImageInputStream, since we have
173+
// custom handling of the close() method in a finally-block.
174174
try {
175175
imageInputStream = createImageInputStream(inputMessage.getBody());
176176
MediaType contentType = inputMessage.getHeaders().getContentType();

spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -131,8 +131,8 @@ protected void writeInternal(Resource resource, HttpOutputMessage outputMessage)
131131

132132
protected void writeContent(Resource resource, HttpOutputMessage outputMessage)
133133
throws IOException, HttpMessageNotWritableException {
134-
// We cannot use try-with-resources here as, potential, exception upon closing
135-
// would still bubble up the stack
134+
// We cannot use try-with-resources here for the InputStream, since we have
135+
// custom handling of the close() method in a finally-block.
136136
try {
137137
InputStream in = resource.getInputStream();
138138
try {

spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -155,8 +155,8 @@ protected void writeResourceRegion(ResourceRegion region, HttpOutputMessage outp
155155
responseHeaders.setContentLength(rangeLength);
156156

157157
InputStream in = region.getResource().getInputStream();
158-
// We cannot use try-with-resources here as, potential, exception upon closing
159-
// would still bubble up the stack
158+
// We cannot use try-with-resources here for the InputStream, since we have
159+
// custom handling of the close() method in a finally-block.
160160
try {
161161
StreamUtils.copyRange(in, outputMessage.getBody(), start, end);
162162
}

spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -374,8 +374,8 @@ private void sendErrorMessage(WebSocketSession session, Throwable error) {
374374
headerAccessor.setMessage(error.getMessage());
375375

376376
byte[] bytes = this.stompEncoder.encode(headerAccessor.getMessageHeaders(), EMPTY_PAYLOAD);
377-
// We cannot use try-with-resources here as, potential, exception upon closing
378-
// would still bubble up the stack
377+
// We cannot use try-with-resources here for the WebSocketSession, since we have
378+
// custom handling of the close() method in a finally-block.
379379
try {
380380
session.sendMessage(new TextMessage(bytes));
381381
}

0 commit comments

Comments
 (0)