Skip to content

Commit 8c5c6b9

Browse files
committed
CODEC-232 URLCodec is neither immutable nor threadsafe
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1789142 13f79535-47bb-0310-9956-ffa450edef68
1 parent 6a0a187 commit 8c5c6b9

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The <action> type attribute can be add,update,fix,remove.
4545
<release version="1.11" date="2017-MM-DD" description="Feature and fix release.">
4646
<!-- The first attribute below should be the issue id; makes it easier to navigate in the IDE outline -->
4747

48+
<action issue="CODEC-232" dev="sebb" type="fix">URLCodec is neither immutable nor threadsafe</action>
4849
<action issue="CODEC-231" dev="sebb" type="fix">StringUtils.equals(CharSequence cs1, CharSequence cs2) can fail with String Index OBE</action>
4950
<action issue="CODEC-230" dev="sebb" type="fix">URLCodec.WWW_FORM_URL should be private</action>
5051
<action issue="CODEC-229" dev="sebb" type="fix">StringUtils.newStringxxx(null) should return null, not NPE</action>

src/main/java/org/apache/commons/codec/net/URLCodec.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* {@link java.net.URLDecoder} on older Java platforms, as these classes in Java versions below
3838
* 1.4 rely on the platform's default charset encoding.
3939
* <p>
40-
* This class is immutable and thread-safe.
40+
* This class is thread-safe since 1.11
4141
*
4242
* @see <a href="http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1">Chapter 17.13.4 Form content types</a>
4343
* of the <a href="http://www.w3.org/TR/html4/">HTML 4.01 Specification</a>
@@ -53,7 +53,7 @@ public class URLCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, St
5353
* @deprecated TODO: This field will be changed to a private final Charset in 2.0. (CODEC-126)
5454
*/
5555
@Deprecated
56-
protected String charset;
56+
protected volatile String charset; // added volatile: see CODEC-232
5757

5858
/**
5959
* Release 1.5 made this field final.
@@ -62,7 +62,9 @@ public class URLCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, St
6262

6363
/**
6464
* BitSet of www-form-url safe characters.
65-
* @deprecated Will be removed in 2.0 (CODEC-230)
65+
* This is a copy of the internal BitSet which is now used for the conversion.
66+
* Changes to this field are ignored.
67+
* @deprecated 1.11 Will be removed in 2.0 (CODEC-230)
6668
*/
6769
@Deprecated
6870
protected static final BitSet WWW_FORM_URL;

0 commit comments

Comments
 (0)