diff --git a/spring-web/src/main/java/org/springframework/http/HttpMethod.java b/spring-web/src/main/java/org/springframework/http/HttpMethod.java index c38c46fc7ba..31112cabd9c 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpMethod.java +++ b/spring-web/src/main/java/org/springframework/http/HttpMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 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. @@ -33,7 +33,7 @@ public enum HttpMethod { GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; - private static final Map mappings = new HashMap(8); + private static final Map mappings = new HashMap(16); static { for (HttpMethod httpMethod : values()) { diff --git a/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java b/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java index 9cf673028b7..c24d4d14453 100644 --- a/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java +++ b/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java @@ -52,7 +52,7 @@ class HtmlCharacterEntityReferences { private final String[] characterToEntityReferenceMap = new String[3000]; - private final Map entityReferenceToCharacterMap = new HashMap(252); + private final Map entityReferenceToCharacterMap = new HashMap(512); /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractDataBoundFormElementTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractDataBoundFormElementTag.java index 8a9b82528c5..bf61760cd0f 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractDataBoundFormElementTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractDataBoundFormElementTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -229,7 +229,7 @@ public abstract class AbstractDataBoundFormElementTag extends AbstractFormTag im protected final String processFieldValue(String name, String value, String type) { RequestDataValueProcessor processor = getRequestContext().getRequestDataValueProcessor(); ServletRequest request = this.pageContext.getRequest(); - if (processor != null && (request instanceof HttpServletRequest)) { + if (processor != null && request instanceof HttpServletRequest) { value = processor.processFormFieldValue((HttpServletRequest) request, name, value, type); } return value; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementBodyTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementBodyTag.java index ae4d30755fc..322ace60054 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementBodyTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementBodyTag.java @@ -57,7 +57,7 @@ public abstract class AbstractHtmlElementBodyTag extends AbstractHtmlElementTag * If {@link #shouldRender rendering}, flush any buffered * {@link BodyContent} or, if no {@link BodyContent} is supplied, * {@link #renderDefaultContent render the default content}. - * @return Tag#EVAL_PAGE + * @return a {@link javax.servlet.jsp.tagext.Tag#EVAL_PAGE} result */ @Override public int doEndTag() throws JspException { @@ -79,7 +79,7 @@ public abstract class AbstractHtmlElementBodyTag extends AbstractHtmlElementTag * override this to add additional content to the output. */ protected void renderFromBodyContent(BodyContent bodyContent, TagWriter tagWriter) throws JspException { - flushBufferedBodyContent(this.bodyContent); + flushBufferedBodyContent(bodyContent); } /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java index f3da981aa86..b6ef8157fd3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -403,7 +403,7 @@ public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElemen throw new IllegalArgumentException( "Attribute " + localName + "=\"" + value + "\" is not allowed"); } - dynamicAttributes.put(localName, value); + this.dynamicAttributes.put(localName, value); } /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ButtonTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ButtonTag.java index dd49bfc78d4..461e9d5fbe8 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ButtonTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ButtonTag.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. @@ -109,13 +109,13 @@ public class ButtonTag extends AbstractHtmlElementTag { * when the value is written. */ protected void writeValue(TagWriter tagWriter) throws JspException { - String valueToUse = (getValue() != null) ? getValue() : getDefaultValue(); + String valueToUse = (getValue() != null ? getValue() : getDefaultValue()); tagWriter.writeAttribute("value", processFieldValue(getName(), valueToUse, getType())); } /** * Return the default value. - * @return The default value if none supplied. + * @return the default value if none supplied */ protected String getDefaultValue() { return "Submit"; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/InputTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/InputTag.java index 514d9400ab5..0682d2264cf 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/InputTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/InputTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -38,10 +38,11 @@ public class InputTag extends AbstractHtmlInputElementTag { public static final String ONSELECT_ATTRIBUTE = "onselect"; - public static final String READONLY_ATTRIBUTE = "readonly"; - public static final String AUTOCOMPLETE_ATTRIBUTE = "autocomplete"; + @Deprecated + public static final String READONLY_ATTRIBUTE = "readonly"; + private String size; @@ -156,10 +157,6 @@ public class InputTag extends AbstractHtmlInputElementTag { return SKIP_BODY; } - private boolean hasDynamicTypeAttribute() { - return getDynamicAttributes() != null && getDynamicAttributes().containsKey("type"); - } - /** * Writes the '{@code value}' attribute to the supplied {@link TagWriter}. * Subclasses may choose to override this implementation to control exactly @@ -167,22 +164,21 @@ public class InputTag extends AbstractHtmlInputElementTag { */ protected void writeValue(TagWriter tagWriter) throws JspException { String value = getDisplayString(getBoundValue(), getPropertyEditor()); - String type = hasDynamicTypeAttribute() ? (String) getDynamicAttributes().get("type") : getType(); + String type = (hasDynamicTypeAttribute() ? (String) getDynamicAttributes().get("type") : getType()); tagWriter.writeAttribute("value", processFieldValue(getName(), value, type)); } + private boolean hasDynamicTypeAttribute() { + return (getDynamicAttributes() != null && getDynamicAttributes().containsKey("type")); + } + /** * Flags {@code type="checkbox"} and {@code type="radio"} as illegal * dynamic attributes. */ @Override protected boolean isValidDynamicAttribute(String localName, Object value) { - if ("type".equals(localName)) { - if ("checkbox".equals(value) || "radio".equals(value)) { - return false; - } - } - return true; + return !("type".equals(localName) && ("checkbox".equals(value) || "radio".equals(value))); } /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java index 36e381d02b1..6494c2fc4f0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -215,8 +215,8 @@ public class OptionTag extends AbstractHtmlElementBodyTag implements BodyTag { } /** - * Returns the value of the label for this '{@code option}' element. - * If the {@link #setLabel label} property is set then the resolved value + * Return the value of the label for this '{@code option}' element. + *

If the {@link #setLabel label} property is set then the resolved value * of that property is used, otherwise the value of the {@code resolvedValue} * argument is used. */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java index 2a57fe73bda..173b1d9dff4 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java @@ -100,7 +100,7 @@ class OptionWriter { /** - * Creates a new {@code OptionWriter} for the supplied {@code objectSource}. + * Create a new {@code OptionWriter} for the supplied {@code objectSource}. * @param optionSource the source of the {@code options} (never {@code null}) * @param bindStatus the {@link BindStatus} for the bound value (never {@code null}) * @param valueProperty the name of the property used to render {@code option} values @@ -145,7 +145,7 @@ class OptionWriter { } /** - * Renders the inner '{@code option}' tags using the {@link #optionSource}. + * Render the inner '{@code option}' tags using the {@link #optionSource}. * @see #doRenderFromCollection(java.util.Collection, TagWriter) */ private void renderFromArray(TagWriter tagWriter) throws JspException { @@ -153,7 +153,7 @@ class OptionWriter { } /** - * Renders the inner '{@code option}' tags using the supplied + * Render the inner '{@code option}' tags using the supplied * {@link Map} as the source. * @see #renderOption(TagWriter, Object, Object, Object) */ @@ -173,7 +173,7 @@ class OptionWriter { } /** - * Renders the inner '{@code option}' tags using the {@link #optionSource}. + * Render the inner '{@code option}' tags using the {@link #optionSource}. * @see #doRenderFromCollection(java.util.Collection, TagWriter) */ private void renderFromCollection(TagWriter tagWriter) throws JspException { @@ -181,7 +181,7 @@ class OptionWriter { } /** - * Renders the inner '{@code option}' tags using the {@link #optionSource}. + * Render the inner '{@code option}' tags using the {@link #optionSource}. * @see #doRenderFromCollection(java.util.Collection, TagWriter) */ private void renderFromEnum(TagWriter tagWriter) throws JspException { @@ -189,7 +189,7 @@ class OptionWriter { } /** - * Renders the inner '{@code option}' tags using the supplied {@link Collection} of + * Render the inner '{@code option}' tags using the supplied {@link Collection} of * objects as the source. The value of the {@link #valueProperty} field is used * when rendering the '{@code value}' of the '{@code option}' and the value of the * {@link #labelProperty} property is used when rendering the label. @@ -213,7 +213,7 @@ class OptionWriter { } /** - * Renders an HTML '{@code option}' with the supplied value and label. Marks the + * Render an HTML '{@code option}' with the supplied value and label. Marks the * value as 'selected' if either the item itself or its value match the bound value. */ private void renderOption(TagWriter tagWriter, Object item, Object value, Object label) throws JspException { @@ -239,7 +239,7 @@ class OptionWriter { } /** - * Determines the display value of the supplied {@code Object}, + * Determine the display value of the supplied {@code Object}, * HTML-escaped as required. */ private String getDisplayString(Object value) { @@ -249,7 +249,7 @@ class OptionWriter { /** * Process the option value before it is written. - * The default implementation simply returns the same value unchanged. + *

The default implementation simply returns the same value unchanged. */ protected String processOptionValue(String resolvedValue) { return resolvedValue; @@ -257,7 +257,7 @@ class OptionWriter { /** * Determine whether the supplied values matched the selected value. - * Delegates to {@link SelectedValueComparator#isSelected}. + *

Delegates to {@link SelectedValueComparator#isSelected}. */ private boolean isOptionSelected(Object resolvedValue) { return SelectedValueComparator.isSelected(this.bindStatus, resolvedValue); @@ -271,7 +271,7 @@ class OptionWriter { } /** - * Writes default attributes configured to the supplied {@link TagWriter}. + * Write default attributes configured to the supplied {@link TagWriter}. */ protected void writeCommonAttributes(TagWriter tagWriter) throws JspException { } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java index d643773dcb1..0ad45fd1221 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 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. @@ -211,7 +211,6 @@ public class OptionsTag extends AbstractHtmlElementTag { protected String processOptionValue(String value) { return processFieldValue(this.selectName, value, "option"); } - } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java index 2439a9cd657..66af667088f 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 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. @@ -57,8 +57,8 @@ public class SelectTag extends AbstractHtmlInputElementTag { /** - * The {@link Collection}, {@link Map} or array of objects used to generate the inner - * '{@code option}' tags. + * The {@link Collection}, {@link Map} or array of objects used to generate + * the inner '{@code option}' tags. */ private Object items; @@ -291,7 +291,7 @@ public class SelectTag extends AbstractHtmlInputElementTag { public int doEndTag() throws JspException { if (this.tagWriter != null) { this.tagWriter.endTag(); - writeHiddenTagIfNecessary(tagWriter); + writeHiddenTagIfNecessary(this.tagWriter); } return EVAL_PAGE; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java index ac52381d9c0..10da89cd253 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -189,7 +189,7 @@ public class TagWriter { } private boolean inTag() { - return this.tagState.size() > 0; + return !this.tagState.isEmpty(); } private TagStateEntry currentState() { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TextareaTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TextareaTag.java index 16987862c28..b6087bdefc0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TextareaTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TextareaTag.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. @@ -34,6 +34,7 @@ public class TextareaTag extends AbstractHtmlInputElementTag { public static final String ONSELECT_ATTRIBUTE = "onselect"; + @Deprecated public static final String READONLY_ATTRIBUTE = "readonly";