Skip to content

Commit c48289b

Browse files
committed
[CODEC-219] Don't deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1744153 13f79535-47bb-0310-9956-ffa450edef68
1 parent d8695b9 commit c48289b

2 files changed

Lines changed: 25 additions & 12 deletions

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The <action> type attribute can be add,update,fix,remove.
4747
<action dev="ggregory" type="fix" issue="CODEC-207" due-to="Gary Gregory">Charsets Javadoc breaks build when using Java 8</action>
4848
<action dev="ggregory" type="fix" issue="CODEC-199" due-to="Yossi Tamari">Bug in HW rule in Soundex</action>
4949
<action dev="ggregory" type="fix" issue="CODEC-209" due-to="Gary Gregory">Javadoc for SHA-224 DigestUtils methods should mention Java 1.8.0 restriction instead of 1.4.0.</action>
50+
<action dev="ggregory" type="fix" issue="CODEC-219" due-to="Gary Gregory">Don't deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets</action>
5051
<action dev="ggregory" type="add" issue="CODEC-218" due-to="Gary Gregory">Refactor HmacUtils methods into the HmacAlgorithms enum</action>
5152
<action dev="ggregory" type="add" issue="CODEC-217" due-to="Gary Gregory">Add HmacAlgorithms.HMAC_SHA_224 (Java 8 only)</action>
5253
<action dev="ggregory" type="add" issue="CODEC-213" due-to="Gary Gregory">Support JEP 287: SHA-3 Hash Algorithms</action>

src/main/java/org/apache/commons/codec/Charsets.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,66 +91,78 @@ public static Charset toCharset(final String charset) {
9191
* CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
9292
* <p>
9393
* Every implementation of the Java platform is required to support this character encoding.
94+
* </p>
95+
* <p>
96+
* On Java, use {@link java.nio.charset.StandardCharsets#ISO_8859_1} instead.
97+
* </p>
9498
*
9599
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
96-
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets#ISO_8859_1} instead
97100
*/
98-
@Deprecated
99101
public static final Charset ISO_8859_1 = Charset.forName(CharEncoding.ISO_8859_1);
100102

101103
/**
102104
* Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
103105
* <p>
104106
* Every implementation of the Java platform is required to support this character encoding.
107+
* </p>
108+
* <p>
109+
* On Java, use {@link java.nio.charset.StandardCharsets#ISO_8859_1} instead.
110+
* </p>
105111
*
106112
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
107-
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets#US_ASCII} instead
108113
*/
109-
@Deprecated
110114
public static final Charset US_ASCII = Charset.forName(CharEncoding.US_ASCII);
111115

112116
/**
113117
* Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark
114118
* (either order accepted on input, big-endian used on output)
115119
* <p>
116120
* Every implementation of the Java platform is required to support this character encoding.
121+
* </p>
122+
* <p>
123+
* On Java, use {@link java.nio.charset.StandardCharsets#ISO_8859_1} instead.
124+
* </p>
117125
*
118126
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
119-
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets#UTF_16} instead
120127
*/
121-
@Deprecated
122128
public static final Charset UTF_16 = Charset.forName(CharEncoding.UTF_16);
123129

124130
/**
125131
* Sixteen-bit Unicode Transformation Format, big-endian byte order.
126132
* <p>
127133
* Every implementation of the Java platform is required to support this character encoding.
134+
* </p>
135+
* <p>
136+
* On Java, use {@link java.nio.charset.StandardCharsets#ISO_8859_1} instead.
137+
* </p>
128138
*
129139
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
130-
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets#UTF_16BE} instead
131140
*/
132-
@Deprecated
133141
public static final Charset UTF_16BE = Charset.forName(CharEncoding.UTF_16BE);
134142

135143
/**
136144
* Sixteen-bit Unicode Transformation Format, little-endian byte order.
137145
* <p>
138146
* Every implementation of the Java platform is required to support this character encoding.
147+
* </p>
148+
* <p>
149+
* On Java, use {@link java.nio.charset.StandardCharsets#ISO_8859_1} instead.
150+
* </p>
139151
*
140152
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
141-
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets#UTF_16LE} instead
142153
*/
143-
@Deprecated
144154
public static final Charset UTF_16LE = Charset.forName(CharEncoding.UTF_16LE);
145155

146156
/**
147157
* Eight-bit Unicode Transformation Format.
148158
* <p>
149159
* Every implementation of the Java platform is required to support this character encoding.
160+
* </p>
161+
* <p>
162+
* On Java, use {@link java.nio.charset.StandardCharsets#ISO_8859_1} instead.
163+
* </p>
150164
*
151165
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
152-
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets#UTF_8}
153166
*/
154-
@Deprecated
155167
public static final Charset UTF_8 = Charset.forName(CharEncoding.UTF_8);
156168
}

0 commit comments

Comments
 (0)