diff --git a/spring-core/src/main/java/org/springframework/core/env/CommandLinePropertySource.java b/spring-core/src/main/java/org/springframework/core/env/CommandLinePropertySource.java index 421eaa7988d218251c666873a6f7eccc85330b60..eceaff8057b606147a4861d1450e87d8fc9c901b 100644 --- a/spring-core/src/main/java/org/springframework/core/env/CommandLinePropertySource.java +++ b/spring-core/src/main/java/org/springframework/core/env/CommandLinePropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -193,27 +193,30 @@ public abstract class CommandLinePropertySource extends EnumerablePropertySou /** The default name of the property representing non-option arguments: {@value} */ public static final String DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME = "nonOptionArgs"; + private String nonOptionArgsPropertyName = DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME; + /** - * Create a new {@code CommandLinePropertySource} having the default name {@value - * #COMMAND_LINE_PROPERTY_SOURCE_NAME} and backed by the given source object. + * Create a new {@code CommandLinePropertySource} having the default name + * {@value #COMMAND_LINE_PROPERTY_SOURCE_NAME} and backed by the given source object. */ public CommandLinePropertySource(T source) { super(COMMAND_LINE_PROPERTY_SOURCE_NAME, source); } /** - * Create a new {@link CommandLinePropertySource} having the given name and backed by - * the given source object. + * Create a new {@link CommandLinePropertySource} having the given name + * and backed by the given source object. */ public CommandLinePropertySource(String name, T source) { super(name, source); } + /** - * Specify the name of the special "non-option arguments" property. The default is - * {@value #DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME}. + * Specify the name of the special "non-option arguments" property. + * The default is {@value #DEFAULT_NON_OPTION_ARGS_PROPERTY_NAME}. */ public void setNonOptionArgsPropertyName(String nonOptionArgsPropertyName) { this.nonOptionArgsPropertyName = nonOptionArgsPropertyName; @@ -265,6 +268,7 @@ public abstract class CommandLinePropertySource extends EnumerablePropertySou } } + /** * Return whether the set of option arguments parsed from the command line contains * an option with the given name. diff --git a/spring-core/src/main/java/org/springframework/core/env/JOptCommandLinePropertySource.java b/spring-core/src/main/java/org/springframework/core/env/JOptCommandLinePropertySource.java index fa092d1e780adabdf2d8f03c044f0b3064dda582..161cccd37c1ebb0c3c688a3bfe766ebd383da13b 100644 --- a/spring-core/src/main/java/org/springframework/core/env/JOptCommandLinePropertySource.java +++ b/spring-core/src/main/java/org/springframework/core/env/JOptCommandLinePropertySource.java @@ -44,10 +44,11 @@ import org.springframework.util.Assert; * * See {@link CommandLinePropertySource} for complete general usage examples. * - *

Requires JOpt version 3.0 or higher. Tested against JOpt up until 4.6. + *

Requires JOpt version 4.3 or higher. Tested against JOpt up until 4.6. * * @author Chris Beams * @author Juergen Hoeller + * @author Dave Syer * @since 3.1 * @see CommandLinePropertySource * @see joptsimple.OptionParser @@ -82,11 +83,11 @@ public class JOptCommandLinePropertySource extends CommandLinePropertySource names = new ArrayList(); - for (OptionSpec spec : source.specs()) { + for (OptionSpec spec : this.source.specs()) { List aliases = new ArrayList(spec.options()); if (!aliases.isEmpty()) { // Only the longest name is used for enumerating - names.add(aliases.get(aliases.size()-1)); + names.add(aliases.get(aliases.size() - 1)); } } return names.toArray(new String[names.size()]); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java index f6287256877290814fad28656679774504bcefb7..6c9cdb0d19d5edcd35ee39d98345c8b0eb91a0c8 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java @@ -55,6 +55,7 @@ public final class FlashMap extends HashMap implements Comparabl private int timeToLive; + /** * Provide a URL path to help identify the target request for this FlashMap. * The path may be absolute (e.g. /application/resource) or relative to the @@ -69,7 +70,7 @@ public final class FlashMap extends HashMap implements Comparabl * Return the target URL path or {@code null}. */ public String getTargetRequestPath() { - return targetRequestPath; + return this.targetRequestPath; } /** @@ -121,7 +122,7 @@ public final class FlashMap extends HashMap implements Comparabl */ public boolean isExpired() { if (this.expirationStartTime != 0) { - return (System.currentTimeMillis() - this.expirationStartTime) > this.timeToLive * 1000; + return (System.currentTimeMillis() - this.expirationStartTime > this.timeToLive * 1000); } else { return false; @@ -135,8 +136,8 @@ public final class FlashMap extends HashMap implements Comparabl */ @Override public int compareTo(FlashMap other) { - int thisUrlPath = (this.targetRequestPath != null) ? 1 : 0; - int otherUrlPath = (other.targetRequestPath != null) ? 1 : 0; + int thisUrlPath = (this.targetRequestPath != null ? 1 : 0); + int otherUrlPath = (other.targetRequestPath != null ? 1 : 0); if (thisUrlPath != otherUrlPath) { return otherUrlPath - thisUrlPath; } @@ -148,7 +149,7 @@ public final class FlashMap extends HashMap implements Comparabl @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("[Attributes=").append(super.toString()); + sb.append("FlashMap [attributes=").append(super.toString()); sb.append(", targetRequestPath=").append(this.targetRequestPath); sb.append(", targetRequestParams=").append(this.targetRequestParams).append("]"); return sb.toString();