Skip to content

Commit 04814e6

Browse files
committed
Polishing
(cherry picked from commit 95a56cd)
1 parent e332e32 commit 04814e6

File tree

6 files changed

+32
-35
lines changed

6 files changed

+32
-35
lines changed

spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -24,7 +24,7 @@
2424
import org.springframework.util.StringUtils;
2525

2626
/**
27-
* Default implementation of the {@link MessageSourceResolvable} interface.
27+
* Spring's default implementation of the {@link MessageSourceResolvable} interface.
2828
* Offers an easy way to store all the necessary values needed to resolve
2929
* a message via a {@link org.springframework.context.MessageSource}.
3030
*
@@ -143,8 +143,8 @@ protected final String resolvableToString() {
143143
}
144144

145145
/**
146-
* Default implementation exposes the attributes of this MessageSourceResolvable.
147-
* To be overridden in more specific subclasses, potentially including the
146+
* The default implementation exposes the attributes of this MessageSourceResolvable.
147+
* <p>To be overridden in more specific subclasses, potentially including the
148148
* resolvable content through {@code resolvableToString()}.
149149
* @see #resolvableToString()
150150
*/

spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class SpringValidatorAdapterTests {
7272
@Before
7373
public void setupSpringValidatorAdapter() {
7474
messageSource.addMessage("Size", Locale.ENGLISH, "Size of {0} is must be between {2} and {1}");
75-
messageSource.addMessage("Same", Locale.ENGLISH, "{2} must be same value with {1}");
75+
messageSource.addMessage("Same", Locale.ENGLISH, "{2} must be same value as {1}");
7676
messageSource.addMessage("password", Locale.ENGLISH, "Password");
7777
messageSource.addMessage("confirmPassword", Locale.ENGLISH, "Password(Confirm)");
7878
}
@@ -115,7 +115,7 @@ public void testApplyMessageSourceResolvableToStringArgumentValueWithResolvedLog
115115
assertThat(errors.getFieldValue("password"), is("password"));
116116
FieldError error = errors.getFieldError("password");
117117
assertNotNull(error);
118-
assertThat(messageSource.getMessage(error, Locale.ENGLISH), is("Password must be same value with Password(Confirm)"));
118+
assertThat(messageSource.getMessage(error, Locale.ENGLISH), is("Password must be same value as Password(Confirm)"));
119119
assertTrue(error.contains(ConstraintViolation.class));
120120
assertThat(error.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("password"));
121121
}
@@ -136,7 +136,7 @@ public void testApplyMessageSourceResolvableToStringArgumentValueWithUnresolvedL
136136
FieldError error2 = errors.getFieldError("confirmEmail");
137137
assertNotNull(error1);
138138
assertNotNull(error2);
139-
assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value with confirmEmail"));
139+
assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value as confirmEmail"));
140140
assertThat(messageSource.getMessage(error2, Locale.ENGLISH), is("Email required"));
141141
assertTrue(error1.contains(ConstraintViolation.class));
142142
assertThat(error1.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("email"));
@@ -162,7 +162,7 @@ public void testApplyMessageSourceResolvableToStringArgumentValueWithAlwaysUseMe
162162
FieldError error2 = errors.getFieldError("confirmEmail");
163163
assertNotNull(error1);
164164
assertNotNull(error2);
165-
assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value with confirmEmail"));
165+
assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value as confirmEmail"));
166166
assertThat(messageSource.getMessage(error2, Locale.ENGLISH), is("Email required"));
167167
assertTrue(error1.contains(ConstraintViolation.class));
168168
assertThat(error1.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("email"));
@@ -378,13 +378,13 @@ public static class Child {
378378

379379
private Integer id;
380380

381-
@javax.validation.constraints.NotNull
381+
@NotNull
382382
private String name;
383383

384-
@javax.validation.constraints.NotNull
384+
@NotNull
385385
private Integer age;
386386

387-
@javax.validation.constraints.NotNull
387+
@NotNull
388388
private Parent parent;
389389

390390
public Integer getId() {

spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ public void setValue(String value) {
429429
@Retention(RetentionPolicy.RUNTIME)
430430
@Target(ElementType.FIELD)
431431
@Constraint(validatedBy=InnerValidator.class)
432-
public static @interface InnerValid {
432+
public @interface InnerValid {
433433

434434
String message() default "NOT VALID";
435435

spring-expression/src/main/java/org/springframework/expression/spel/ast/OpEQ.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -43,8 +43,7 @@ public BooleanTypedValue getValueInternal(ExpressionState state) throws Evaluati
4343
Object right = getRightOperand().getValueInternal(state).getValue();
4444
this.leftActualDescriptor = CodeFlow.toDescriptorFromObject(left);
4545
this.rightActualDescriptor = CodeFlow.toDescriptorFromObject(right);
46-
return BooleanTypedValue.forValue(
47-
equalityCheck(state.getEvaluationContext(), left, right));
46+
return BooleanTypedValue.forValue(equalityCheck(state.getEvaluationContext(), left, right));
4847
}
4948

5049
// This check is different to the one in the other numeric operators (OpLt/etc)

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -256,14 +256,14 @@ private class LazyConnectionInvocationHandler implements InvocationHandler {
256256
@Nullable
257257
private String password;
258258

259-
private Boolean readOnly = Boolean.FALSE;
260-
261259
@Nullable
262260
private Boolean autoCommit;
263261

264262
@Nullable
265263
private Integer transactionIsolation;
266264

265+
private boolean readOnly = false;
266+
267267
private boolean closed = false;
268268

269269
@Nullable
@@ -319,11 +319,15 @@ else if (method.getName().equals("getTargetConnection")) {
319319
if (method.getName().equals("toString")) {
320320
return "Lazy Connection proxy for target DataSource [" + getTargetDataSource() + "]";
321321
}
322-
else if (method.getName().equals("isReadOnly")) {
323-
return this.readOnly;
322+
else if (method.getName().equals("getAutoCommit")) {
323+
if (this.autoCommit != null) {
324+
return this.autoCommit;
325+
}
326+
// Else fetch actual Connection and check there,
327+
// because we didn't have a default specified.
324328
}
325-
else if (method.getName().equals("setReadOnly")) {
326-
this.readOnly = (Boolean) args[0];
329+
else if (method.getName().equals("setAutoCommit")) {
330+
this.autoCommit = (Boolean) args[0];
327331
return null;
328332
}
329333
else if (method.getName().equals("getTransactionIsolation")) {
@@ -337,15 +341,11 @@ else if (method.getName().equals("setTransactionIsolation")) {
337341
this.transactionIsolation = (Integer) args[0];
338342
return null;
339343
}
340-
else if (method.getName().equals("getAutoCommit")) {
341-
if (this.autoCommit != null) {
342-
return this.autoCommit;
343-
}
344-
// Else fetch actual Connection and check there,
345-
// because we didn't have a default specified.
344+
else if (method.getName().equals("isReadOnly")) {
345+
return this.readOnly;
346346
}
347-
else if (method.getName().equals("setAutoCommit")) {
348-
this.autoCommit = (Boolean) args[0];
347+
else if (method.getName().equals("setReadOnly")) {
348+
this.readOnly = (Boolean) args[0];
349349
return null;
350350
}
351351
else if (method.getName().equals("commit")) {

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -113,10 +113,8 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
113113
* Hibernate Session, that is, whether to apply a transaction-specific
114114
* isolation level and/or the transaction's read-only flag to the underlying
115115
* JDBC Connection.
116-
* <p>Default is "true" on Hibernate EntityManager 4.x (with its 'on-close'
117-
* connection release mode.
118-
* <p>If you turn this flag off, JPA transaction management will not support
119-
* per-transaction isolation levels anymore. It will not call
116+
* <p>Default is "true". If you turn this flag off, JPA transaction management
117+
* will not support per-transaction isolation levels anymore. It will not call
120118
* {@code Connection.setReadOnly(true)} for read-only transactions anymore either.
121119
* If this flag is turned off, no cleanup of a JDBC Connection is required after
122120
* a transaction, since no Connection settings will get modified.

0 commit comments

Comments
 (0)