diff --git a/spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java b/spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java index 8c2b94f48a..81c6c1d721 100644 --- a/spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java +++ b/spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; /** - * Default implementation of the {@link MessageSourceResolvable} interface. + * Spring's default implementation of the {@link MessageSourceResolvable} interface. * Offers an easy way to store all the necessary values needed to resolve * a message via a {@link org.springframework.context.MessageSource}. * @@ -143,8 +143,8 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable, } /** - * Default implementation exposes the attributes of this MessageSourceResolvable. - * To be overridden in more specific subclasses, potentially including the + * The default implementation exposes the attributes of this MessageSourceResolvable. + *

To be overridden in more specific subclasses, potentially including the * resolvable content through {@code resolvableToString()}. * @see #resolvableToString() */ diff --git a/spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java b/spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java index f8c131bcd3..11afee83d2 100644 --- a/spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java +++ b/spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java @@ -72,7 +72,7 @@ public class SpringValidatorAdapterTests { @Before public void setupSpringValidatorAdapter() { messageSource.addMessage("Size", Locale.ENGLISH, "Size of {0} is must be between {2} and {1}"); - messageSource.addMessage("Same", Locale.ENGLISH, "{2} must be same value with {1}"); + messageSource.addMessage("Same", Locale.ENGLISH, "{2} must be same value as {1}"); messageSource.addMessage("password", Locale.ENGLISH, "Password"); messageSource.addMessage("confirmPassword", Locale.ENGLISH, "Password(Confirm)"); } @@ -115,7 +115,7 @@ public class SpringValidatorAdapterTests { assertThat(errors.getFieldValue("password"), is("password")); FieldError error = errors.getFieldError("password"); assertNotNull(error); - assertThat(messageSource.getMessage(error, Locale.ENGLISH), is("Password must be same value with Password(Confirm)")); + assertThat(messageSource.getMessage(error, Locale.ENGLISH), is("Password must be same value as Password(Confirm)")); assertTrue(error.contains(ConstraintViolation.class)); assertThat(error.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("password")); } @@ -136,7 +136,7 @@ public class SpringValidatorAdapterTests { FieldError error2 = errors.getFieldError("confirmEmail"); assertNotNull(error1); assertNotNull(error2); - assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value with confirmEmail")); + assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value as confirmEmail")); assertThat(messageSource.getMessage(error2, Locale.ENGLISH), is("Email required")); assertTrue(error1.contains(ConstraintViolation.class)); assertThat(error1.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("email")); @@ -162,7 +162,7 @@ public class SpringValidatorAdapterTests { FieldError error2 = errors.getFieldError("confirmEmail"); assertNotNull(error1); assertNotNull(error2); - assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value with confirmEmail")); + assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value as confirmEmail")); assertThat(messageSource.getMessage(error2, Locale.ENGLISH), is("Email required")); assertTrue(error1.contains(ConstraintViolation.class)); assertThat(error1.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("email")); @@ -378,13 +378,13 @@ public class SpringValidatorAdapterTests { private Integer id; - @javax.validation.constraints.NotNull + @NotNull private String name; - @javax.validation.constraints.NotNull + @NotNull private Integer age; - @javax.validation.constraints.NotNull + @NotNull private Parent parent; public Integer getId() { diff --git a/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java b/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java index 4ec8cc4303..6eea92e542 100644 --- a/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java @@ -429,7 +429,7 @@ public class ValidatorFactoryTests { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) @Constraint(validatedBy=InnerValidator.class) - public static @interface InnerValid { + public @interface InnerValid { String message() default "NOT VALID"; diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpEQ.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpEQ.java index 4bca782289..1343fe9cbb 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpEQ.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpEQ.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,8 +43,7 @@ public class OpEQ extends Operator { Object right = getRightOperand().getValueInternal(state).getValue(); this.leftActualDescriptor = CodeFlow.toDescriptorFromObject(left); this.rightActualDescriptor = CodeFlow.toDescriptorFromObject(right); - return BooleanTypedValue.forValue( - equalityCheck(state.getEvaluationContext(), left, right)); + return BooleanTypedValue.forValue(equalityCheck(state.getEvaluationContext(), left, right)); } // This check is different to the one in the other numeric operators (OpLt/etc) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java index 2ea6c3f07c..24b3552b55 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -256,14 +256,14 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource { @Nullable private String password; - private Boolean readOnly = Boolean.FALSE; - @Nullable private Boolean autoCommit; @Nullable private Integer transactionIsolation; + private boolean readOnly = false; + private boolean closed = false; @Nullable @@ -319,11 +319,15 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource { if (method.getName().equals("toString")) { return "Lazy Connection proxy for target DataSource [" + getTargetDataSource() + "]"; } - else if (method.getName().equals("isReadOnly")) { - return this.readOnly; + else if (method.getName().equals("getAutoCommit")) { + if (this.autoCommit != null) { + return this.autoCommit; + } + // Else fetch actual Connection and check there, + // because we didn't have a default specified. } - else if (method.getName().equals("setReadOnly")) { - this.readOnly = (Boolean) args[0]; + else if (method.getName().equals("setAutoCommit")) { + this.autoCommit = (Boolean) args[0]; return null; } else if (method.getName().equals("getTransactionIsolation")) { @@ -337,15 +341,11 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource { this.transactionIsolation = (Integer) args[0]; return null; } - else if (method.getName().equals("getAutoCommit")) { - if (this.autoCommit != null) { - return this.autoCommit; - } - // Else fetch actual Connection and check there, - // because we didn't have a default specified. + else if (method.getName().equals("isReadOnly")) { + return this.readOnly; } - else if (method.getName().equals("setAutoCommit")) { - this.autoCommit = (Boolean) args[0]; + else if (method.getName().equals("setReadOnly")) { + this.readOnly = (Boolean) args[0]; return null; } else if (method.getName().equals("commit")) { diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java index 84cc031dd5..0af5239702 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -113,10 +113,8 @@ public class HibernateJpaDialect extends DefaultJpaDialect { * Hibernate Session, that is, whether to apply a transaction-specific * isolation level and/or the transaction's read-only flag to the underlying * JDBC Connection. - *

Default is "true" on Hibernate EntityManager 4.x (with its 'on-close' - * connection release mode. - *

If you turn this flag off, JPA transaction management will not support - * per-transaction isolation levels anymore. It will not call + *

Default is "true". If you turn this flag off, JPA transaction management + * will not support per-transaction isolation levels anymore. It will not call * {@code Connection.setReadOnly(true)} for read-only transactions anymore either. * If this flag is turned off, no cleanup of a JDBC Connection is required after * a transaction, since no Connection settings will get modified.