Skip to content

Commit 0319095

Browse files
committed
polishing
1 parent 6bfead2 commit 0319095

File tree

10 files changed

+47
-43
lines changed

10 files changed

+47
-43
lines changed

org.springframework.context/src/main/java/org/springframework/cache/annotation/Cacheable.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2011 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.
@@ -30,31 +30,29 @@
3030
*
3131
* @author Costin Leau
3232
*/
33-
@Target( { ElementType.METHOD, ElementType.TYPE })
33+
@Target({ElementType.METHOD, ElementType.TYPE})
3434
@Retention(RetentionPolicy.RUNTIME)
3535
@Inherited
3636
@Documented
3737
public @interface Cacheable {
3838

3939
/**
4040
* Name of the caches in which the update takes place.
41-
* <p>
42-
* May be used to determine the target cache (or caches), matching the
41+
* <p>May be used to determine the target cache (or caches), matching the
4342
* qualifier value (or the bean name(s)) of (a) specific bean definition.
4443
*/
4544
String[] value();
4645

4746
/**
4847
* Spring Expression Language (SpEL) attribute for computing the key dynamically.
49-
* <p/>
50-
* Default is "" meaning all method parameters are considered as a key.
48+
* <p>Default is "", meaning all method parameters are considered as a key.
5149
*/
5250
String key() default "";
5351

5452
/**
5553
* Spring Expression Language (SpEL) attribute used for conditioning the method caching.
56-
* <p/>
57-
* Default is "" meaning the method is always cached.
54+
* <p>Default is "", meaning the method is always cached.
5855
*/
5956
String condition() default "";
60-
}
57+
58+
}

org.springframework.context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskScheduler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2011 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.
@@ -118,8 +118,8 @@ public void setErrorHandler(ErrorHandler errorHandler) {
118118

119119
public ScheduledFuture schedule(Runnable task, Trigger trigger) {
120120
try {
121-
ErrorHandler errorHandler = this.errorHandler != null ?
122-
this.errorHandler : TaskUtils.getDefaultErrorHandler(true);
121+
ErrorHandler errorHandler =
122+
(this.errorHandler != null ? this.errorHandler : TaskUtils.getDefaultErrorHandler(true));
123123
return new ReschedulingRunnable(task, trigger, this.scheduledExecutor, errorHandler).schedule();
124124
}
125125
catch (RejectedExecutionException ex) {

org.springframework.context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2011 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.
@@ -159,8 +159,8 @@ public boolean prefersShortLivedTasks() {
159159
public ScheduledFuture schedule(Runnable task, Trigger trigger) {
160160
ScheduledExecutorService executor = getScheduledExecutor();
161161
try {
162-
ErrorHandler errorHandler = this.errorHandler != null ?
163-
this.errorHandler : TaskUtils.getDefaultErrorHandler(true);
162+
ErrorHandler errorHandler =
163+
(this.errorHandler != null ? this.errorHandler : TaskUtils.getDefaultErrorHandler(true));
164164
return new ReschedulingRunnable(task, trigger, executor, errorHandler).schedule();
165165
}
166166
catch (RejectedExecutionException ex) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
/**
3+
*
4+
* Support package for declarative scheduling configuration,
5+
* with XML schema being the primary configuration format.
6+
*
7+
*/
8+
package org.springframework.scheduling.config;
9+

org.springframework.context/src/main/java/org/springframework/scheduling/support/TaskUtils.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2011 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.
@@ -26,8 +26,8 @@
2626

2727
/**
2828
* Utility methods for decorating tasks with error handling.
29-
* <p>
30-
* <b>NOTE:</b> This class is intended for internal use by Spring's scheduler
29+
*
30+
* <p><b>NOTE:</b> This class is intended for internal use by Spring's scheduler
3131
* implementations. It is only public so that it may be accessed from
3232
* implementations within other packages. It is <i>not</i> intended for general
3333
* use and may change in the future.
@@ -95,7 +95,6 @@ public void handleError(Throwable t) {
9595
logger.error("Unexpected error occurred in scheduled task.", t);
9696
}
9797
}
98-
9998
}
10099

101100

@@ -109,7 +108,6 @@ public void handleError(Throwable t) {
109108
super.handleError(t);
110109
ReflectionUtils.rethrowRuntimeException(t);
111110
}
112-
113111
}
114112

115113
}

org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616

1717
package org.springframework.core.env;
1818

19-
import static java.lang.String.format;
20-
import static org.springframework.util.StringUtils.commaDelimitedListToSet;
21-
import static org.springframework.util.StringUtils.trimAllWhitespace;
22-
19+
import static java.lang.String.*;
2320
import java.security.AccessControlException;
2421
import java.util.Arrays;
2522
import java.util.LinkedHashSet;
@@ -28,9 +25,11 @@
2825

2926
import org.apache.commons.logging.Log;
3027
import org.apache.commons.logging.LogFactory;
28+
3129
import org.springframework.core.convert.ConversionService;
3230
import org.springframework.util.Assert;
3331
import org.springframework.util.StringUtils;
32+
import static org.springframework.util.StringUtils.*;
3433

3534
/**
3635
* Abstract base class for {@link Environment} implementations.
@@ -67,7 +66,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
6766
//---------------------------------------------------------------------
6867

6968
public String[] getActiveProfiles() {
70-
return this.doGetActiveProfiles().toArray(new String[]{});
69+
return StringUtils.toStringArray(doGetActiveProfiles());
7170
}
7271

7372
protected Set<String> doGetActiveProfiles() {
@@ -86,7 +85,7 @@ public void setActiveProfiles(String... profiles) {
8685
}
8786

8887
public String[] getDefaultProfiles() {
89-
return this.doGetDefaultProfiles().toArray(new String[]{});
88+
return StringUtils.toStringArray(doGetDefaultProfiles());
9089
}
9190

9291
protected Set<String> doGetDefaultProfiles() {

org.springframework.core/src/main/java/org/springframework/core/env/DefaultEnvironment.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,15 @@ public class DefaultEnvironment extends AbstractEnvironment {
8787
/**
8888
* Create a new {@code Environment} populated with property sources in the following order:
8989
* <ul>
90-
* <li>{@value #SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME}
91-
* <li>{@value #SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME}
90+
* <li>{@value #SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME}
91+
* <li>{@value #SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME}
9292
* </ul>
93-
*
9493
* <p>Properties present in {@value #SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME} will
9594
* take precedence over those in {@value #SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME}.
9695
*/
9796
public DefaultEnvironment() {
98-
this.getPropertySources().addFirst(new MapPropertySource(SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, this.getSystemEnvironment()));
99-
this.getPropertySources().addFirst(new MapPropertySource(SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, this.getSystemProperties()));
97+
getPropertySources().addFirst(new MapPropertySource(SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, getSystemEnvironment()));
98+
getPropertySources().addFirst(new MapPropertySource(SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, getSystemProperties()));
10099
}
101100

102101
}

org.springframework.core/src/main/java/org/springframework/core/env/PropertyResolver.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2011 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.
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.core.env;
1818

19-
20-
2119
/**
2220
* Interface for resolving properties against any underlying source.
2321
*

org.springframework.core/src/main/java/org/springframework/util/ErrorHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2011 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.
@@ -27,6 +27,9 @@
2727
*/
2828
public interface ErrorHandler {
2929

30+
/**
31+
* Handle the given error, possibly rethrowing it as a fatal exception
32+
*/
3033
void handleError(Throwable t);
3134

3235
}

org.springframework.web/src/main/java/org/springframework/web/context/support/DefaultWebEnvironment.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public class DefaultWebEnvironment extends DefaultEnvironment {
5656
* Create a new {@code Environment} populated with the property sources contributed by
5757
* superclasses as well as:
5858
* <ul>
59-
* <li>{@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME}
60-
* <li>{@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}
61-
* <li>(optionally) {@link JndiPropertySource#JNDI_PROPERTY_SOURCE_NAME "jndiPropertySource"}
59+
* <li>{@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME}
60+
* <li>{@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}
61+
* <li>(optionally) {@link JndiPropertySource#JNDI_PROPERTY_SOURCE_NAME "jndiPropertySource"}
6262
* </ul>
6363
* <p>Properties present in {@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME} will
6464
* take precedence over those in {@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}.
@@ -67,7 +67,6 @@ public class DefaultWebEnvironment extends DefaultEnvironment {
6767
* <p>The {@code Servlet}-related property sources are added as stubs for now, and will be
6868
* {@linkplain WebApplicationContextUtils#initServletPropertySources fully initialized}
6969
* once the actual {@link ServletConfig} and {@link ServletContext} objects are available.
70-
*
7170
* <p>If the {@link JndiPropertySource#JNDI_PROPERTY_SOURCE_ENABLED_FLAG "jndiPropertySourceEnabled"}
7271
* property is present in any of the default property sources, a {@link JndiPropertySource} will
7372
* be added as well, with precedence lower than servlet property sources, but higher than system
@@ -80,12 +79,13 @@ public class DefaultWebEnvironment extends DefaultEnvironment {
8079
* @see WebApplicationContextUtils#initServletPropertySources
8180
*/
8281
public DefaultWebEnvironment() {
83-
this.getPropertySources().addFirst(new StubPropertySource(SERVLET_CONTEXT_PROPERTY_SOURCE_NAME));
84-
this.getPropertySources().addFirst(new StubPropertySource(SERVLET_CONFIG_PROPERTY_SOURCE_NAME));
82+
getPropertySources().addFirst(new StubPropertySource(SERVLET_CONTEXT_PROPERTY_SOURCE_NAME));
83+
getPropertySources().addFirst(new StubPropertySource(SERVLET_CONFIG_PROPERTY_SOURCE_NAME));
8584

8685
Boolean jndiPropertySourceEnabled = this.getProperty(JndiPropertySource.JNDI_PROPERTY_SOURCE_ENABLED_FLAG, boolean.class);
87-
if (jndiPropertySourceEnabled != null && jndiPropertySourceEnabled != false) {
88-
this.getPropertySources().addAfter(SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, new JndiPropertySource());
86+
if (jndiPropertySourceEnabled != null && jndiPropertySourceEnabled) {
87+
getPropertySources().addAfter(SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, new JndiPropertySource());
8988
}
9089
}
90+
9191
}

0 commit comments

Comments
 (0)