Skip to content

Commit 00577ed

Browse files
committed
Polishing
1 parent 9b2b485 commit 00577ed

File tree

7 files changed

+36
-40
lines changed

7 files changed

+36
-40
lines changed

Diff for: spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ void testGenericSetWithConversionFailure() {
8181
BeanWrapper bw = new BeanWrapperImpl(gb);
8282
Set<TestBean> input = new HashSet<>();
8383
input.add(new TestBean());
84-
assertThatExceptionOfType(TypeMismatchException.class).isThrownBy(() ->
85-
bw.setPropertyValue("integerSet", input))
86-
.withMessageContaining("java.lang.Integer");
84+
assertThatExceptionOfType(TypeMismatchException.class)
85+
.isThrownBy(() -> bw.setPropertyValue("integerSet", input))
86+
.withMessageContaining("java.lang.Integer");
8787
}
8888

8989
@Test

Diff for: spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ void setValidAndInvalidPropertyValuesShouldContainExceptionDetails() {
103103
pvs.addPropertyValue(new PropertyValue("age", "foobar"));
104104
pvs.addPropertyValue(new PropertyValue("name", newName));
105105
pvs.addPropertyValue(new PropertyValue("touchy", invalidTouchy));
106-
assertThatExceptionOfType(PropertyBatchUpdateException.class).isThrownBy(() ->
107-
accessor.setPropertyValues(pvs))
108-
.satisfies(ex -> {
109-
assertThat(ex.getExceptionCount()).isEqualTo(2);
110-
assertThat(ex.getPropertyAccessException("touchy").getPropertyChangeEvent()
111-
.getNewValue()).isEqualTo(invalidTouchy);
112-
});
106+
assertThatExceptionOfType(PropertyBatchUpdateException.class)
107+
.isThrownBy(() -> accessor.setPropertyValues(pvs))
108+
.satisfies(ex -> {
109+
assertThat(ex.getExceptionCount()).isEqualTo(2);
110+
assertThat(ex.getPropertyAccessException("touchy").getPropertyChangeEvent()
111+
.getNewValue()).isEqualTo(invalidTouchy);
112+
});
113113
// Test validly set property matches
114114
assertThat(target.getName()).as("Valid set property must stick").isEqualTo(newName);
115115
assertThat(target.getAge()).as("Invalid set property must retain old value").isEqualTo(0);
@@ -119,9 +119,9 @@ void setValidAndInvalidPropertyValuesShouldContainExceptionDetails() {
119119
void checkNotWritablePropertyHoldPossibleMatches() {
120120
TestBean target = new TestBean();
121121
BeanWrapper accessor = createAccessor(target);
122-
assertThatExceptionOfType(NotWritablePropertyException.class).isThrownBy(() ->
123-
accessor.setPropertyValue("ag", "foobar"))
124-
.satisfies(ex -> assertThat(ex.getPossibleMatches()).containsExactly("age"));
122+
assertThatExceptionOfType(NotWritablePropertyException.class)
123+
.isThrownBy(() -> accessor.setPropertyValue("ag", "foobar"))
124+
.satisfies(ex -> assertThat(ex.getPossibleMatches()).containsExactly("age"));
125125
}
126126

127127
@Test // Can't be shared; there is no such thing as a read-only field
@@ -294,9 +294,9 @@ void getPropertyWithOptionalAndAutoGrow() {
294294
void incompletelyQuotedKeyLeadsToPropertyException() {
295295
TestBean target = new TestBean();
296296
BeanWrapper accessor = createAccessor(target);
297-
assertThatExceptionOfType(NotWritablePropertyException.class).isThrownBy(() ->
298-
accessor.setPropertyValue("[']", "foobar"))
299-
.satisfies(ex -> assertThat(ex.getPossibleMatches()).isNull());
297+
assertThatExceptionOfType(NotWritablePropertyException.class)
298+
.isThrownBy(() -> accessor.setPropertyValue("[']", "foobar"))
299+
.satisfies(ex -> assertThat(ex.getPossibleMatches()).isNull());
300300
}
301301

302302

Diff for: spring-core/src/main/java/org/springframework/core/io/Resource.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -152,8 +152,7 @@ default byte[] getContentAsByteArray() throws IOException {
152152
}
153153

154154
/**
155-
* Returns the contents of this resource as a string, using the specified
156-
* charset.
155+
* Return the contents of this resource as a string, using the specified charset.
157156
* @param charset the charset to use for decoding
158157
* @return the contents of this resource as a {@code String}
159158
* @throws java.io.FileNotFoundException if the resource cannot be resolved as

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/core/support/AbstractLobCreatingPreparedStatementCallback.java

+3-3
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-2024 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.
@@ -45,8 +45,8 @@
4545
* lobCreator.setBlobAsBinaryStream(ps, 2, contentStream, contentLength);
4646
* lobCreator.setClobAsString(ps, 3, description);
4747
* }
48-
* }
49-
* );</pre>
48+
* });
49+
* </pre>
5050
*
5151
* @author Juergen Hoeller
5252
* @since 1.0.2

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/core/support/AbstractLobStreamingResultSetExtractor.java

+8-8
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-2024 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.
@@ -41,13 +41,13 @@
4141
* final LobHandler lobHandler = new DefaultLobHandler(); // reusable object
4242
*
4343
* jdbcTemplate.query(
44-
* "SELECT content FROM imagedb WHERE image_name=?", new Object[] {name},
45-
* new AbstractLobStreamingResultSetExtractor() {
46-
* public void streamData(ResultSet rs) throws SQLException, IOException {
47-
* FileCopyUtils.copy(lobHandler.getBlobAsBinaryStream(rs, 1), contentStream);
48-
* }
49-
* }
50-
* );</pre>
44+
* "SELECT content FROM imagedb WHERE image_name=?", new Object[] {name},
45+
* new AbstractLobStreamingResultSetExtractor() {
46+
* public void streamData(ResultSet rs) throws SQLException, IOException {
47+
* FileCopyUtils.copy(lobHandler.getBlobAsBinaryStream(rs, 1), contentStream);
48+
* }
49+
* });
50+
* </pre>
5151
*
5252
* @author Juergen Hoeller
5353
* @since 1.0.2

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/SqlXmlValue.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -20,9 +20,7 @@
2020

2121
/**
2222
* Subinterface of {@link org.springframework.jdbc.support.SqlValue}
23-
* that supports passing in XML data to specified column and adds a
24-
* cleanup callback, to be invoked after the value has been set and
25-
* the corresponding statement has been executed.
23+
* that specifically indicates passing in XML data to a specified column.
2624
*
2725
* @author Thomas Risberg
2826
* @since 2.5.5

Diff for: spring-web/src/main/java/org/springframework/http/converter/StringHttpMessageConverter.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -95,8 +95,7 @@ protected String readInternal(Class<? extends String> clazz, HttpInputMessage in
9595
Charset charset = getContentTypeCharset(inputMessage.getHeaders().getContentType());
9696
long length = inputMessage.getHeaders().getContentLength();
9797
byte[] bytes = (length >= 0 && length <= Integer.MAX_VALUE ?
98-
inputMessage.getBody().readNBytes((int) length) :
99-
inputMessage.getBody().readAllBytes());
98+
inputMessage.getBody().readNBytes((int) length) : inputMessage.getBody().readAllBytes());
10099
return new String(bytes, charset);
101100
}
102101

@@ -110,10 +109,9 @@ protected Long getContentLength(String str, @Nullable MediaType contentType) {
110109
@Override
111110
protected void addDefaultHeaders(HttpHeaders headers, String s, @Nullable MediaType type) throws IOException {
112111
if (headers.getContentType() == null ) {
113-
if (type != null && type.isConcrete() &&
114-
(type.isCompatibleWith(MediaType.APPLICATION_JSON) ||
112+
if (type != null && type.isConcrete() && (type.isCompatibleWith(MediaType.APPLICATION_JSON) ||
115113
type.isCompatibleWith(APPLICATION_PLUS_JSON))) {
116-
// Prevent charset parameter for JSON..
114+
// Prevent charset parameter for JSON.
117115
headers.setContentType(type);
118116
}
119117
}
@@ -167,4 +165,5 @@ else if (contentType.isCompatibleWith(MediaType.APPLICATION_JSON) ||
167165
protected boolean supportsRepeatableWrites(String s) {
168166
return true;
169167
}
168+
170169
}

0 commit comments

Comments
 (0)