diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
index 3823dd70081..07c1620bfb1 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
@@ -509,10 +509,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
//---------------------------------------------------------------------
public void registerResolvableDependency(Class> dependencyType, Object autowiredValue) {
- Assert.notNull(dependencyType, "Type must not be null");
+ Assert.notNull(dependencyType, "Dependency type must not be null");
if (autowiredValue != null) {
- Assert.isTrue((autowiredValue instanceof ObjectFactory || dependencyType.isInstance(autowiredValue)),
- "Value [" + autowiredValue + "] does not implement specified type [" + dependencyType.getName() + "]");
+ if (!(autowiredValue instanceof ObjectFactory || dependencyType.isInstance(autowiredValue))) {
+ throw new IllegalArgumentException("Value [" + autowiredValue +
+ "] does not implement specified dependency type [" + dependencyType.getName() + "]");
+ }
this.resolvableDependencies.put(dependencyType, autowiredValue);
}
}
diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java b/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java
index f20bb57c15d..14d72e333af 100644
--- a/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java
+++ b/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java
@@ -42,6 +42,7 @@ import org.springframework.util.StringUtils;
*
"0 0 * * * *" = the top of every hour of every day.
* "*/10 * * * * *" = every ten seconds.
* "0 0 8-10 * * *" = 8, 9 and 10 o'clock of every day.
+ * "0 * 6,19 * * *" = 6:00 AM and 7:00 PM every day.
* "0 0/30 8-10 * * *" = 8:00, 8:30, 9:00, 9:30 and 10 o'clock every day.
* "0 0 9-17 * * MON-FRI" = on the hour nine-to-five weekdays
* "0 0 0 25 12 ?" = every Christmas Day at midnight
@@ -115,7 +116,7 @@ public class CronSequenceGenerator {
/*
The plan:
- 1 Round up to the next whole second
+ 1 Start with whole second (rounding up if necessary)
2 If seconds match move on, otherwise find the next match:
2.1 If next match is in the next minute then roll forwards
@@ -127,8 +128,6 @@ public class CronSequenceGenerator {
4 If hour matches move on, otherwise find the next match
4.1 If next match is in the next day then roll forwards,
4.2 Reset the minutes and seconds and go to 2
-
- ...
*/
Calendar calendar = new GregorianCalendar();
@@ -409,7 +408,7 @@ public class CronSequenceGenerator {
@Override
public String toString() {
- return (getClass().getSimpleName() + ": " + this.expression);
+ return getClass().getSimpleName() + ": " + this.expression;
}
}
diff --git a/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java
index f12e4004bf7..903abfef2c8 100644
--- a/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java
+++ b/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2016 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.
@@ -39,13 +39,13 @@ import org.springframework.util.xml.DomUtils;
* Allows for objects written using dynamic languages to be easily exposed with
* the {@link org.springframework.beans.factory.BeanFactory}.
*
- * The script for each object can be specified either as a reference to the Resource
- * containing it (using the '{@code script-source}' attribute) or inline in the XML configuration
- * itself (using the '{@code inline-script}' attribute.
+ *
The script for each object can be specified either as a reference to the
+ * resource containing it (using the '{@code script-source}' attribute) or inline
+ * in the XML configuration itself (using the '{@code inline-script}' attribute.
*
- *
By default, dynamic objects created with these tags are not refreshable.
- * To enable refreshing, specify the refresh check delay for each object (in milliseconds) using the
- * '{@code refresh-check-delay}' attribute.
+ *
By default, dynamic objects created with these tags are not
+ * refreshable. To enable refreshing, specify the refresh check delay for each
+ * object (in milliseconds) using the '{@code refresh-check-delay}' attribute.
*
* @author Rob Harrop
* @author Rod Johnson
@@ -171,14 +171,13 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
// Attach any refresh metadata.
String refreshCheckDelay = element.getAttribute(REFRESH_CHECK_DELAY_ATTRIBUTE);
if (StringUtils.hasText(refreshCheckDelay)) {
- bd.setAttribute(ScriptFactoryPostProcessor.REFRESH_CHECK_DELAY_ATTRIBUTE, new Long(refreshCheckDelay));
+ bd.setAttribute(ScriptFactoryPostProcessor.REFRESH_CHECK_DELAY_ATTRIBUTE, Long.valueOf(refreshCheckDelay));
}
// Attach any proxy target class metadata.
String proxyTargetClass = element.getAttribute(PROXY_TARGET_CLASS_ATTRIBUTE);
if (StringUtils.hasText(proxyTargetClass)) {
- Boolean flag = new Boolean(proxyTargetClass);
- bd.setAttribute(ScriptFactoryPostProcessor.PROXY_TARGET_CLASS_ATTRIBUTE, flag);
+ bd.setAttribute(ScriptFactoryPostProcessor.PROXY_TARGET_CLASS_ATTRIBUTE, Boolean.valueOf(proxyTargetClass));
}
// Add constructor arguments.
@@ -213,7 +212,7 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
*/
private String resolveScriptSource(Element element, XmlReaderContext readerContext) {
boolean hasScriptSource = element.hasAttribute(SCRIPT_SOURCE_ATTRIBUTE);
- List elements = DomUtils.getChildElementsByTagName(element, INLINE_SCRIPT_ELEMENT);
+ List elements = DomUtils.getChildElementsByTagName(element, INLINE_SCRIPT_ELEMENT);
if (hasScriptSource && !elements.isEmpty()) {
readerContext.error("Only one of 'script-source' and 'inline-script' should be specified.", element);
return null;
@@ -222,7 +221,7 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
return element.getAttribute(SCRIPT_SOURCE_ATTRIBUTE);
}
else if (!elements.isEmpty()) {
- Element inlineElement = (Element) elements.get(0);
+ Element inlineElement = elements.get(0);
return "inline:" + DomUtils.getTextValue(inlineElement);
}
else {
diff --git a/spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java b/spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java
index d0766b95f40..9a758b8c5ab 100644
--- a/spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java
+++ b/spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2016 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.
@@ -40,7 +40,7 @@ public class ScriptingDefaultsParser implements BeanDefinitionParser {
LangNamespaceUtils.registerScriptFactoryPostProcessorIfNecessary(parserContext.getRegistry());
String refreshCheckDelay = element.getAttribute(REFRESH_CHECK_DELAY_ATTRIBUTE);
if (StringUtils.hasText(refreshCheckDelay)) {
- bd.getPropertyValues().add("defaultRefreshCheckDelay", new Long(refreshCheckDelay));
+ bd.getPropertyValues().add("defaultRefreshCheckDelay", Long.valueOf(refreshCheckDelay));
}
String proxyTargetClass = element.getAttribute(PROXY_TARGET_CLASS_ATTRIBUTE);
if (StringUtils.hasText(proxyTargetClass)) {
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/ConnectionHolder.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/ConnectionHolder.java
index 6ed77ef0c13..9544749071c 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/ConnectionHolder.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/ConnectionHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2016 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.
@@ -161,9 +161,9 @@ public class ConnectionHolder extends ResourceHolderSupport {
*/
public boolean supportsSavepoints() throws SQLException {
if (this.savepointsSupported == null) {
- this.savepointsSupported = new Boolean(getConnection().getMetaData().supportsSavepoints());
+ this.savepointsSupported = getConnection().getMetaData().supportsSavepoints();
}
- return this.savepointsSupported.booleanValue();
+ return this.savepointsSupported;
}
/**
diff --git a/spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java b/spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java
index 4c347482110..f3b1809951c 100644
--- a/spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java
+++ b/spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2016 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.
@@ -95,7 +95,7 @@ class JcaListenerContainerParser extends AbstractListenerContainerParser {
String prefetch = containerEle.getAttribute(PREFETCH_ATTRIBUTE);
if (StringUtils.hasText(prefetch)) {
- configDef.getPropertyValues().add("prefetchSize", new Integer(prefetch));
+ configDef.getPropertyValues().add("prefetchSize", Integer.valueOf(prefetch));
}
String phase = containerEle.getAttribute(PHASE_ATTRIBUTE);
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java
index 8ca6708dca1..d1b9c216fec 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2016 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.
@@ -46,6 +46,7 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
/** The default name of the exception attribute: "exception". */
public static final String DEFAULT_EXCEPTION_ATTRIBUTE = "exception";
+
private Properties exceptionMappings;
private Class>[] excludedExceptions;
@@ -108,7 +109,7 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
public void setStatusCodes(Properties statusCodes) {
for (Enumeration> enumeration = statusCodes.propertyNames(); enumeration.hasMoreElements();) {
String viewName = (String) enumeration.nextElement();
- Integer statusCode = new Integer(statusCodes.getProperty(viewName));
+ Integer statusCode = Integer.valueOf(statusCodes.getProperty(viewName));
this.statusCodes.put(viewName, statusCode);
}
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java
index 8f068041e03..f1b3db51c4a 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2016 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.
@@ -312,7 +312,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
"'reportDataKey' for main report is required when specifying a value for 'subReportDataKeys'");
}
this.subReports = new HashMap(this.subReportUrls.size());
- for (Enumeration urls = this.subReportUrls.propertyNames(); urls.hasMoreElements();) {
+ for (Enumeration> urls = this.subReportUrls.propertyNames(); urls.hasMoreElements();) {
String key = (String) urls.nextElement();
String path = this.subReportUrls.getProperty(key);
Resource resource = getApplicationContext().getResource(path);
@@ -383,7 +383,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
else if (str.length() > 0 && Character.isDigit(str.charAt(0))) {
// Looks like a number... let's try.
try {
- return new Integer(str);
+ return Integer.valueOf(str);
}
catch (NumberFormatException ex) {
// OK, then let's keep it as a String value.