type);
diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java b/spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java
index 5be29849429..5086c1a1df4 100644
--- a/spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java
+++ b/spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -162,13 +162,12 @@ public @interface EnableCaching {
* Indicate whether subclass-based (CGLIB) proxies are to be created as opposed
* to standard Java interface-based proxies. The default is {@code false}.
* Applicable only if {@link #mode()} is set to {@link AdviceMode#PROXY}.
- *
* Note that setting this attribute to {@code true} will affect all
- * Spring-managed beans requiring proxying, not just those marked with
- * {@code @Cacheable}. For example, other beans marked with Spring's
- * {@code @Transactional} annotation will be upgraded to subclass proxying at the same
- * time. This approach has no negative impact in practice unless one is explicitly
- * expecting one type of proxy vs another, e.g. in tests.
+ * Spring-managed beans requiring proxying, not just those marked with {@code @Cacheable}.
+ * For example, other beans marked with Spring's {@code @Transactional} annotation will
+ * be upgraded to subclass proxying at the same time. This approach has no negative
+ * impact in practice unless one is explicitly expecting one type of proxy vs another,
+ * e.g. in tests.
*/
boolean proxyTargetClass() default false;
@@ -185,4 +184,5 @@ public @interface EnableCaching {
* The default is {@link Ordered#LOWEST_PRECEDENCE}.
*/
int order() default Ordered.LOWEST_PRECEDENCE;
+
}
diff --git a/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java b/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java
index fdaa876c080..b13527543c2 100644
--- a/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java
+++ b/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 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,6 @@ import groovy.lang.MetaClass;
import groovy.lang.Script;
import org.codehaus.groovy.control.CompilationFailedException;
-import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
@@ -102,7 +101,7 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@Override
- public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+ public void setBeanFactory(BeanFactory beanFactory) {
if (beanFactory instanceof ConfigurableListableBeanFactory) {
((ConfigurableListableBeanFactory) beanFactory).ignoreDependencyType(MetaClass.class);
}
diff --git a/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java b/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java
index 01e3c206923..156e322e025 100644
--- a/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java
+++ b/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -94,7 +94,7 @@ import org.springframework.util.StringUtils;
* <property name="message" value="Hello World!"/>
* </bean>
*
- * <bean id="groovyMessenger" class="org.springframework.scripting.bsh.GroovyScriptFactory">
+ * <bean id="groovyMessenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
* <constructor-arg value="classpath:mypackage/Messenger.groovy"/>
* <property name="message" value="Hello World!"/>
* </bean>
@@ -346,17 +346,16 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
* @param scriptedObjectBeanName the name of the internal scripted object bean
*/
protected void prepareScriptBeans(BeanDefinition bd, String scriptFactoryBeanName, String scriptedObjectBeanName) {
-
// Avoid recreation of the script bean definition in case of a prototype.
synchronized (this.scriptBeanFactory) {
if (!this.scriptBeanFactory.containsBeanDefinition(scriptedObjectBeanName)) {
- this.scriptBeanFactory.registerBeanDefinition(scriptFactoryBeanName,
- createScriptFactoryBeanDefinition(bd));
- ScriptFactory scriptFactory = this.scriptBeanFactory
- .getBean(scriptFactoryBeanName, ScriptFactory.class);
- ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName,
- scriptFactory.getScriptSourceLocator());
+ this.scriptBeanFactory.registerBeanDefinition(
+ scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd));
+ ScriptFactory scriptFactory =
+ this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
+ ScriptSource scriptSource =
+ getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
Class>[] interfaces = scriptFactory.getScriptInterfaces();
Class>[] scriptedInterfaces = interfaces;
@@ -365,8 +364,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
scriptedInterfaces = ObjectUtils.addObjectToArray(interfaces, configInterface);
}
- BeanDefinition objectBd = createScriptedObjectBeanDefinition(bd, scriptFactoryBeanName, scriptSource,
- scriptedInterfaces);
+ BeanDefinition objectBd = createScriptedObjectBeanDefinition(
+ bd, scriptFactoryBeanName, scriptSource, scriptedInterfaces);
long refreshCheckDelay = resolveRefreshCheckDelay(bd);
if (refreshCheckDelay >= 0) {
objectBd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
@@ -569,7 +568,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
proxyFactory.setInterfaces(interfaces);
if (proxyTargetClass) {
classLoader = null; // force use of Class.getClassLoader()
- proxyFactory.setProxyTargetClass(proxyTargetClass);
+ proxyFactory.setProxyTargetClass(true);
}
DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
diff --git a/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java b/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java
index 2c0be0e6bb7..fcceb3fb3b7 100644
--- a/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java
+++ b/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -667,27 +667,27 @@ public class InjectAnnotationAutowireContextTests {
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
- public static @interface TestQualifier {
+ public @interface TestQualifier {
}
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
- public static @interface TestQualifierWithDefaultValue {
+ public @interface TestQualifierWithDefaultValue {
- public abstract String value() default "default";
+ String value() default "default";
}
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
- public static @interface TestQualifierWithMultipleAttributes {
+ public @interface TestQualifierWithMultipleAttributes {
- public abstract String value() default "default";
+ String value() default "default";
- public abstract int number();
+ int number();
}
}
diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
index cca30cc323f..284f3cf0c8e 100644
--- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
+++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
@@ -84,7 +84,8 @@ public abstract class ReflectionUtils {
while (!Object.class.equals(searchType) && searchType != null) {
Field[] fields = searchType.getDeclaredFields();
for (Field field : fields) {
- if ((name == null || name.equals(field.getName())) && (type == null || type.equals(field.getType()))) {
+ if ((name == null || name.equals(field.getName())) &&
+ (type == null || type.equals(field.getType()))) {
return field;
}
}
@@ -410,8 +411,7 @@ public abstract class ReflectionUtils {
i--;
}
return ((i > CGLIB_RENAMED_METHOD_PREFIX.length()) &&
- (i < name.length() - 1) &&
- (name.charAt(i) == '$'));
+ (i < name.length() - 1) && name.charAt(i) == '$');
}
return false;
}
@@ -425,7 +425,8 @@ public abstract class ReflectionUtils {
* @see java.lang.reflect.Field#setAccessible
*/
public static void makeAccessible(Field field) {
- if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) ||
+ if ((!Modifier.isPublic(field.getModifiers()) ||
+ !Modifier.isPublic(field.getDeclaringClass().getModifiers()) ||
Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
field.setAccessible(true);
}
diff --git a/spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java b/spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java
index 94c48448f5b..dc5df2c80d3 100644
--- a/spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java
+++ b/spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -67,12 +67,12 @@ public class GenericTypeResolverTests {
@Test
public void methodReturnTypes() {
assertEquals(Integer.class,
- resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "integer"), MyInterfaceType.class));
+ resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "integer"), MyInterfaceType.class));
assertEquals(String.class,
- resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "string"), MyInterfaceType.class));
+ resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "string"), MyInterfaceType.class));
assertEquals(null, resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "raw"), MyInterfaceType.class));
assertEquals(null,
- resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "object"), MyInterfaceType.class));
+ resolveReturnTypeArgument(findMethod(MyTypeWithMethods.class, "object"), MyInterfaceType.class));
}
@Test
@@ -81,13 +81,13 @@ public class GenericTypeResolverTests {
Method intMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerInputMessage", MyInterfaceType.class);
MethodParameter intMessageMethodParam = new MethodParameter(intMessageMethod, 0);
assertEquals(MyInterfaceType.class,
- resolveType(intMessageMethodParam.getGenericParameterType(), new HashMap()));
+ resolveType(intMessageMethodParam.getGenericParameterType(), new HashMap()));
Method intArrMessageMethod = findMethod(MyTypeWithMethods.class, "readIntegerArrayInputMessage",
- MyInterfaceType[].class);
+ MyInterfaceType[].class);
MethodParameter intArrMessageMethodParam = new MethodParameter(intArrMessageMethod, 0);
assertEquals(MyInterfaceType[].class,
- resolveType(intArrMessageMethodParam.getGenericParameterType(), new HashMap()));
+ resolveType(intArrMessageMethodParam.getGenericParameterType(), new HashMap()));
Method genericArrMessageMethod = findMethod(MySimpleTypeWithMethods.class, "readGenericArrayInputMessage",
Object[].class);
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java
index a76e56e933f..be91db15563 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -31,16 +31,14 @@ import org.springframework.jdbc.support.JdbcUtils;
import org.springframework.jdbc.support.MetaDataAccessException;
/**
- * Factory used to create a {@link CallMetaDataProvider} implementation based on the type of databse being used.
+ * Factory used to create a {@link CallMetaDataProvider} implementation
+ * based on the type of databse being used.
*
* @author Thomas Risberg
* @since 2.5
*/
public class CallMetaDataProviderFactory {
- /** Logger */
- private static final Log logger = LogFactory.getLog(CallMetaDataProviderFactory.class);
-
/** List of supported database products for procedure calls */
public static final List supportedDatabaseProductsForProcedures = Arrays.asList(
"Apache Derby",
@@ -51,6 +49,7 @@ public class CallMetaDataProviderFactory {
"PostgreSQL",
"Sybase"
);
+
/** List of supported database products for function calls */
public static final List supportedDatabaseProductsForFunctions = Arrays.asList(
"MySQL",
@@ -59,6 +58,9 @@ public class CallMetaDataProviderFactory {
"PostgreSQL"
);
+ private static final Log logger = LogFactory.getLog(CallMetaDataProviderFactory.class);
+
+
/**
* Create a CallMetaDataProvider based on the database metadata
* @param dataSource used to retrieve metadata
@@ -124,17 +126,16 @@ public class CallMetaDataProviderFactory {
}
provider.initializeWithMetaData(databaseMetaData);
if (accessProcedureColumnMetaData) {
- provider.initializeWithProcedureColumnMetaData(
- databaseMetaData, context.getCatalogName(), context.getSchemaName(), context.getProcedureName());
+ provider.initializeWithProcedureColumnMetaData(databaseMetaData,
+ context.getCatalogName(), context.getSchemaName(), context.getProcedureName());
}
return provider;
}
});
}
catch (MetaDataAccessException ex) {
- throw new DataAccessResourceFailureException("Error retreiving database metadata", ex);
+ throw new DataAccessResourceFailureException("Error retrieving database metadata", ex);
}
-
}
}
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java
index 24e66c42fe4..ebc4ec87fc2 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -70,7 +70,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
Arrays.asList("Apache Derby", "HSQL Database Engine");
/** Collection of TableParameterMetaData objects */
- private List insertParameterMetaData = new ArrayList();
+ private List tableParameterMetaData = new ArrayList();
/** NativeJdbcExtractor that can be used to retrieve the native connection */
private NativeJdbcExtractor nativeJdbcExtractor;
@@ -109,7 +109,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
@Override
public List getTableParameterMetaData() {
- return this.insertParameterMetaData;
+ return this.tableParameterMetaData;
}
@Override
@@ -376,17 +376,14 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
try {
tableColumns = databaseMetaData.getColumns(
- metaDataCatalogName,
- metaDataSchemaName,
- metaDataTableName,
- null);
+ metaDataCatalogName, metaDataSchemaName, metaDataTableName, null);
while (tableColumns.next()) {
String columnName = tableColumns.getString("COLUMN_NAME");
int dataType = tableColumns.getInt("DATA_TYPE");
if (dataType == Types.DECIMAL) {
String typeName = tableColumns.getString("TYPE_NAME");
int decimalDigits = tableColumns.getInt("DECIMAL_DIGITS");
- // override a DECIMAL data type for no-decimal numerics
+ // Override a DECIMAL data type for no-decimal numerics
// (this is for better Oracle support where there have been issues
// using DECIMAL for certain inserts (see SPR-6912))
if ("NUMBER".equals(typeName) && decimalDigits == 0) {
@@ -400,18 +397,11 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
}
boolean nullable = tableColumns.getBoolean("NULLABLE");
- TableParameterMetaData meta = new TableParameterMetaData(
- columnName,
- dataType,
- nullable
- );
- this.insertParameterMetaData.add(meta);
+ TableParameterMetaData meta = new TableParameterMetaData(columnName, dataType, nullable);
+ this.tableParameterMetaData.add(meta);
if (logger.isDebugEnabled()) {
- logger.debug("Retrieved metadata: "
- + meta.getParameterName() +
- " " + meta.getSqlType() +
- " " + meta.isNullable()
- );
+ logger.debug("Retrieved metadata: " + meta.getParameterName() +
+ " " + meta.getSqlType() + " " + meta.isNullable());
}
}
}
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java
index c8aaf23b6b9..63ea39ec76d 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -202,7 +202,8 @@ public class TableMetaDataContext {
* @param generatedKeyNames name of generated keys
*/
public void processMetaData(DataSource dataSource, List declaredColumns, String[] generatedKeyNames) {
- this.metaDataProvider = TableMetaDataProviderFactory.createMetaDataProvider(dataSource, this, this.nativeJdbcExtractor);
+ this.metaDataProvider =
+ TableMetaDataProviderFactory.createMetaDataProvider(dataSource, this, this.nativeJdbcExtractor);
this.tableColumns = reconcileColumnsToUse(declaredColumns, generatedKeyNames);
}
@@ -299,14 +300,14 @@ public class TableMetaDataContext {
}
StringBuilder insertStatement = new StringBuilder();
insertStatement.append("INSERT INTO ");
- if (this.getSchemaName() != null) {
- insertStatement.append(this.getSchemaName());
+ if (getSchemaName() != null) {
+ insertStatement.append(getSchemaName());
insertStatement.append(".");
}
- insertStatement.append(this.getTableName());
+ insertStatement.append(getTableName());
insertStatement.append(" (");
int columnCount = 0;
- for (String columnName : this.getTableColumns()) {
+ for (String columnName : getTableColumns()) {
if (!keys.contains(columnName.toUpperCase())) {
columnCount++;
if (columnCount > 1) {
@@ -319,11 +320,11 @@ public class TableMetaDataContext {
if (columnCount < 1) {
if (this.generatedKeyColumnsUsed) {
logger.info("Unable to locate non-key columns for table '" +
- this.getTableName() + "' so an empty insert statement is generated");
+ getTableName() + "' so an empty insert statement is generated");
}
else {
throw new InvalidDataAccessApiUsageException("Unable to locate columns for table '" +
- this.getTableName() + "' so an insert statement can't be generated");
+ getTableName() + "' so an insert statement can't be generated");
}
}
for (int i = 0; i < columnCount; i++) {
@@ -341,7 +342,7 @@ public class TableMetaDataContext {
* @return the array of types to be used
*/
public int[] createInsertTypes() {
- int[] types = new int[this.getTableColumns().size()];
+ int[] types = new int[getTableColumns().size()];
List parameters = this.metaDataProvider.getTableParameterMetaData();
Map parameterMap =
new LinkedHashMap(parameters.size());
@@ -349,7 +350,7 @@ public class TableMetaDataContext {
parameterMap.put(tpmd.getParameterName().toUpperCase(), tpmd);
}
int typeIndx = 0;
- for (String column : this.getTableColumns()) {
+ for (String column : getTableColumns()) {
if (column == null) {
types[typeIndx] = SqlTypeValue.TYPE_UNKNOWN;
}
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java
index 36bc50ed848..2d9c5b5476b 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -30,7 +30,8 @@ import org.springframework.jdbc.support.MetaDataAccessException;
import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor;
/**
- * Factory used to create a {@link TableMetaDataProvider} implementation based on the type of databse being used.
+ * Factory used to create a {@link TableMetaDataProvider} implementation
+ * based on the type of databse being used.
*
* @author Thomas Risberg
* @since 2.5
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java
index 4747c9dfdf6..78db72b10e9 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -162,7 +162,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
}
}
- private void updateStompHeadersFromSimpMessageHeaders() {
+ void updateStompHeadersFromSimpMessageHeaders() {
if (getDestination() != null) {
setNativeHeader(STOMP_DESTINATION_HEADER, getDestination());
}
@@ -218,19 +218,28 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return (StompCommand) getHeader(COMMAND_HEADER);
}
- public Set getAcceptVersion() {
- String rawValue = getFirstNativeHeader(STOMP_ACCEPT_VERSION_HEADER);
- return (rawValue != null ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.emptySet());
- }
-
public boolean isHeartbeat() {
return (SimpMessageType.HEARTBEAT == getMessageType());
}
+ public long[] getHeartbeat() {
+ String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER);
+ if (!StringUtils.hasText(rawValue)) {
+ return Arrays.copyOf(DEFAULT_HEARTBEAT, 2);
+ }
+ String[] rawValues = StringUtils.commaDelimitedListToStringArray(rawValue);
+ return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])};
+ }
+
public void setAcceptVersion(String acceptVersion) {
setNativeHeader(STOMP_ACCEPT_VERSION_HEADER, acceptVersion);
}
+ public Set getAcceptVersion() {
+ String rawValue = getFirstNativeHeader(STOMP_ACCEPT_VERSION_HEADER);
+ return (rawValue != null ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.emptySet());
+ }
+
public void setHost(String host) {
setNativeHeader(STOMP_HOST_HEADER, host);
}
@@ -245,15 +254,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
setNativeHeader(STOMP_DESTINATION_HEADER, destination);
}
- public long[] getHeartbeat() {
- String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER);
- if (!StringUtils.hasText(rawValue)) {
- return Arrays.copyOf(DEFAULT_HEARTBEAT, 2);
- }
- String[] rawValues = StringUtils.commaDelimitedListToStringArray(rawValue);
- return new long[] { Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])};
- }
-
+ @Override
public void setContentType(MimeType contentType) {
super.setContentType(contentType);
setNativeHeader(STOMP_CONTENT_TYPE_HEADER, contentType.toString());
diff --git a/spring-web/src/main/java/org/springframework/http/StreamingHttpOutputMessage.java b/spring-web/src/main/java/org/springframework/http/StreamingHttpOutputMessage.java
index f5c7a29f3e6..a01d7894bb6 100644
--- a/spring-web/src/main/java/org/springframework/http/StreamingHttpOutputMessage.java
+++ b/spring-web/src/main/java/org/springframework/http/StreamingHttpOutputMessage.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -33,12 +33,13 @@ public interface StreamingHttpOutputMessage extends HttpOutputMessage {
*/
void setBody(Body body);
+
/**
- * Defines the contract for bodies that can be written directly to a
- * {@link OutputStream}. It is useful with HTTP client libraries that provide indirect
- * access to an {@link OutputStream} via a callback mechanism.
+ * Defines the contract for bodies that can be written directly to an {@link OutputStream}.
+ * It is useful with HTTP client libraries that provide indirect access to an
+ * {@link OutputStream} via a callback mechanism.
*/
- public interface Body {
+ interface Body {
/**
* Writes this body to the given {@link OutputStream}.
@@ -46,7 +47,6 @@ public interface StreamingHttpOutputMessage extends HttpOutputMessage {
* @throws IOException in case of errors
*/
void writeTo(OutputStream outputStream) throws IOException;
-
}
}
diff --git a/spring-web/src/main/java/org/springframework/web/multipart/MaxUploadSizeExceededException.java b/spring-web/src/main/java/org/springframework/web/multipart/MaxUploadSizeExceededException.java
index 36eb573b57e..fce24534467 100644
--- a/spring-web/src/main/java/org/springframework/web/multipart/MaxUploadSizeExceededException.java
+++ b/spring-web/src/main/java/org/springframework/web/multipart/MaxUploadSizeExceededException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -52,7 +52,7 @@ public class MaxUploadSizeExceededException extends MultipartException {
* Return the maximum upload size allowed.
*/
public long getMaxUploadSize() {
- return maxUploadSize;
+ return this.maxUploadSize;
}
}
diff --git a/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java b/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java
index c8b3a0a3772..6ec3f5b580e 100644
--- a/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java
+++ b/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -147,6 +147,28 @@ public class WebRequestDataBinderTests {
assertFalse(target.isPostProcessed());
}
+ @Test
+ public void testFieldDefaultWithNestedProperty() throws Exception {
+ TestBean target = new TestBean();
+ target.setSpouse(new TestBean());
+ WebRequestDataBinder binder = new WebRequestDataBinder(target);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("!spouse.postProcessed", "on");
+ request.addParameter("_spouse.postProcessed", "visible");
+ request.addParameter("spouse.postProcessed", "on");
+ binder.bind(new ServletWebRequest(request));
+ assertTrue(((TestBean) target.getSpouse()).isPostProcessed());
+
+ request.removeParameter("spouse.postProcessed");
+ binder.bind(new ServletWebRequest(request));
+ assertTrue(((TestBean) target.getSpouse()).isPostProcessed());
+
+ request.removeParameter("!spouse.postProcessed");
+ binder.bind(new ServletWebRequest(request));
+ assertFalse(((TestBean) target.getSpouse()).isPostProcessed());
+ }
+
@Test
public void testFieldDefaultNonBoolean() throws Exception {
TestBean target = new TestBean();
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java
index b6df9f9016d..959bba6753e 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -13,20 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.web.servlet;
import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders;
/**
* Exception to be thrown if DispatcherServlet is unable to determine a corresponding
- * handler for an incoming HTTP request. The DispatcherServlet throws this exception only
- * if its throwExceptionIfNoHandlerFound property is set to "true".
+ * handler for an incoming HTTP request. The DispatcherServlet throws this exception
+ * only if its "throwExceptionIfNoHandlerFound" property is set to "true".
*
* @author Brian Clozel
* @since 4.0
- * @see org.springframework.web.servlet.DispatcherServlet
+ * @see DispatcherServlet#setThrowExceptionIfNoHandlerFound(boolean)
+ * @see DispatcherServlet#noHandlerFound(HttpServletRequest, HttpServletResponse)
*/
@SuppressWarnings("serial")
public class NoHandlerFoundException extends ServletException {