Skip to content

Commit 8c87835

Browse files
committed
Annotate with @OverRide and @deprecated.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1087901 13f79535-47bb-0310-9956-ffa450edef68
1 parent d15181b commit 8c87835

25 files changed

Lines changed: 64 additions & 14 deletions

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@
265265
<groupId>org.apache.maven.plugins</groupId>
266266
<artifactId>maven-pmd-plugin</artifactId>
267267
<version>2.5</version>
268+
<configuration>
269+
<targetJdk>1.5</targetJdk>
270+
</configuration>
268271
</plugin>
269272
<plugin>
270273
<groupId>org.codehaus.mojo</groupId>

src/java/org/apache/commons/codec/StringEncoderComparator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class StringEncoderComparator implements Comparator {
4040
* @deprecated Creating an instance without a {@link StringEncoder} leads to a {@link NullPointerException}. Will be
4141
* removed in 2.0.
4242
*/
43+
@Deprecated
4344
public StringEncoderComparator() {
4445
this.stringEncoder = null; // Trying to use this will cause things to break
4546
}

src/java/org/apache/commons/codec/binary/Base32.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ public Base32(int lineLength, byte[] lineSeparator, boolean useHex) {
278278
*
279279
* Output is written to {@link #buffer} as 8-bit octets, using {@link #pos} as the buffer position
280280
*/
281+
@Override
281282
void decode(byte[] in, int inPos, int inAvail) { // package protected for access from I/O streams
282283
if (eof) {
283284
return;
@@ -366,6 +367,7 @@ void decode(byte[] in, int inPos, int inAvail) { // package protected for access
366367
* @param inAvail
367368
* Amount of bytes available from input for encoding.
368369
*/
370+
@Override
369371
void encode(byte[] in, int inPos, int inAvail) { // package protected for access from I/O streams
370372
if (eof) {
371373
return;
@@ -464,6 +466,7 @@ void encode(byte[] in, int inPos, int inAvail) { // package protected for access
464466
* The value to test
465467
* @return <code>true</code> if the value is defined in the the Base32 alphabet <code>false</code> otherwise.
466468
*/
469+
@Override
467470
public boolean isInAlphabet(byte octet) {
468471
return octet >= 0 && octet < decodeTable.length && decodeTable[octet] != -1;
469472
}

src/java/org/apache/commons/codec/binary/Base64.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ public boolean isUrlSafe() {
323323
* @param inAvail
324324
* Amount of bytes available from input for encoding.
325325
*/
326+
@Override
326327
void encode(byte[] in, int inPos, int inAvail) {
327328
if (eof) {
328329
return;
@@ -411,6 +412,7 @@ void encode(byte[] in, int inPos, int inAvail) {
411412
* @param inAvail
412413
* Amount of bytes available from input for encoding.
413414
*/
415+
@Override
414416
void decode(byte[] in, int inPos, int inAvail) {
415417
if (eof) {
416418
return;
@@ -501,6 +503,7 @@ public static boolean isBase64(String base64) {
501503
* <code>false</code>, otherwise
502504
* @deprecated 1.5 Use {@link #isBase64(byte[])}, will be removed in 2.0.
503505
*/
506+
@Deprecated
504507
public static boolean isArrayByteBase64(byte[] arrayOctet) {
505508
return isBase64(arrayOctet);
506509
}
@@ -748,6 +751,7 @@ static byte[] toIntegerBytes(BigInteger bigInt) {
748751
* The value to test
749752
* @return <code>true</code> if the value is defined in the the Base32 alphabet <code>false</code> otherwise.
750753
*/
754+
@Override
751755
protected boolean isInAlphabet(byte octet) {
752756
return octet >= 0 && octet < decodeTable.length && decodeTable[octet] != -1;
753757
}

src/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ protected BaseNCodecInputStream(InputStream in, BaseNCodec baseNCodec, boolean d
4747
* @throws IOException
4848
* if an I/O error occurs.
4949
*/
50+
@Override
5051
public int read() throws IOException {
5152
int r = read(singleByte, 0, 1);
5253
while (r == 0) {
@@ -77,6 +78,7 @@ public int read() throws IOException {
7778
* @throws IndexOutOfBoundsException
7879
* if offset, len or buffer size are invalid
7980
*/
81+
@Override
8082
public int read(byte b[], int offset, int len) throws IOException {
8183
if (b == null) {
8284
throw new NullPointerException();
@@ -124,6 +126,7 @@ public int read(byte b[], int offset, int len) throws IOException {
124126
*
125127
* @return false
126128
*/
129+
@Override
127130
public boolean markSupported() {
128131
return false; // not an easy job to support marks
129132
}

src/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public BaseNCodecOutputStream(OutputStream out, BaseNCodec basedCodec, boolean d
4848
* @throws IOException
4949
* if an I/O error occurs.
5050
*/
51+
@Override
5152
public void write(int i) throws IOException {
5253
singleByte[0] = (byte) i;
5354
write(singleByte, 0, 1);
@@ -71,6 +72,7 @@ public void write(int i) throws IOException {
7172
* @throws IndexOutOfBoundsException
7273
* if offset, len or buffer size are invalid
7374
*/
75+
@Override
7476
public void write(byte b[], int offset, int len) throws IOException {
7577
if (b == null) {
7678
throw new NullPointerException();
@@ -117,6 +119,7 @@ private void flush(boolean propogate) throws IOException {
117119
* @throws IOException
118120
* if an I/O error occurs.
119121
*/
122+
@Override
120123
public void flush() throws IOException {
121124
flush(true);
122125
}
@@ -127,6 +130,7 @@ public void flush() throws IOException {
127130
* @throws IOException
128131
* if an I/O error occurs.
129132
*/
133+
@Override
130134
public void close() throws IOException {
131135
// Notify encoder of EOF (-1).
132136
if (doEncode) {

src/java/org/apache/commons/codec/binary/Hex.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ public String getCharsetName() {
295295
*
296296
* @return a string representation of the object.
297297
*/
298+
@Override
298299
public String toString() {
299300
return super.toString() + "[charsetName=" + this.charsetName + "]";
300301
}

src/java/org/apache/commons/codec/language/Caverphone.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* @since 1.4
3434
* @deprecated 1.5 Replaced by {@link Caverphone2}, will be removed in 2.0.
3535
*/
36+
@Deprecated
3637
public class Caverphone implements StringEncoder {
3738

3839
/**

src/java/org/apache/commons/codec/language/ColognePhonetic.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
* Encodes a string into a Cologne Phonetic value.
2828
* </p>
2929
* <p>
30-
* Implements the <a href="http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik">“Kölner Phonetic”</a> (Cologne Phonetic)
30+
* Implements the <a href="http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik">“Kölner Phonetic�</a> (Cologne Phonetic)
3131
* algorithm issued by Hans Joachim Postel in 1969.
3232
* </p>
3333
*
3434
* <p>
35-
* The <i>Kölner Phonetik</i> is a phonetic algorithm which is optimized for the German language. It is related to the
35+
* The <i>Kölner Phonetik</i> is a phonetic algorithm which is optimized for the German language. It is related to the
3636
* well-known soundex algorithm.
3737
* </p>
3838
*
@@ -151,12 +151,12 @@
151151
* </table>
152152
* <p>
153153
* <small><i>(Source: <a href= "http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik#Buchstabencodes" >Wikipedia (de):
154-
* Kölner Phonetik Buchstabencodes</a>)</i></small>
154+
* Kölner Phonetik – Buchstabencodes</a>)</i></small>
155155
* </p>
156156
*
157157
* <h4>Example:</h4>
158158
*
159-
* {@code "Müller-Lüdenscheidt" => "MULLERLUDENSCHEIDT" => "6005507500206880022"}
159+
* {@code "Müller-Lüdenscheidt" => "MULLERLUDENSCHEIDT" => "6005507500206880022"}
160160
*
161161
* </li>
162162
*
@@ -168,15 +168,15 @@
168168
*
169169
* <li>
170170
* <h3>Step 3:</h3>
171-
* Removal of all codes “0” except at the beginning. This means that two or more identical consecutive digits can occur
171+
* Removal of all codes “0� except at the beginning. This means that two or more identical consecutive digits can occur
172172
* if they occur after removing the "0" digits.
173173
*
174174
* <h4>Example:</h4>
175175
* {@code "6050750206802" => "65752682"}</li>
176176
*
177177
* </ul>
178178
*
179-
* @see <a href="http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik">Wikipedia (de): Kölner Phonetik (in German)</a>
179+
* @see <a href="http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik">Wikipedia (de): Kölner Phonetik (in German)</a>
180180
* @author Apache Software Foundation
181181
* @since 1.5
182182
*/
@@ -204,6 +204,7 @@ public int length() {
204204
return length;
205205
}
206206

207+
@Override
207208
public String toString() {
208209
return new String(copyData(0, length));
209210
}
@@ -220,6 +221,7 @@ public void addRight(char chr) {
220221
length++;
221222
}
222223

224+
@Override
223225
protected char[] copyData(int start, final int length) {
224226
char[] newData = new char[length];
225227
System.arraycopy(data, start, newData, 0, length);
@@ -238,6 +240,7 @@ public void addLeft(char ch) {
238240
data[getNextPos()] = ch;
239241
}
240242

243+
@Override
241244
protected char[] copyData(int start, final int length) {
242245
char[] newData = new char[length];
243246
System.arraycopy(data, data.length - this.length + start, newData, 0, length);
@@ -259,10 +262,10 @@ public char removeNext() {
259262
}
260263
}
261264

262-
private static final char[][] PREPROCESS_MAP = new char[][]{{'\u00C4', 'A'}, // Ä
263-
{'\u00DC', 'U'}, // Ü
264-
{'\u00D6', 'O'}, // Ö
265-
{'\u00DF', 'S'} // ß
265+
private static final char[][] PREPROCESS_MAP = new char[][]{{'\u00C4', 'A'}, // Ä
266+
{'\u00DC', 'U'}, // Ü
267+
{'\u00D6', 'O'}, // Ö
268+
{'\u00DF', 'S'} // ß
266269
};
267270

268271
/*
@@ -279,14 +282,14 @@ private static boolean arrayContains(char[] arr, char key) {
279282

280283
/**
281284
* <p>
282-
* <b>colognePhonetic()</b> is the actual implementations of the <i>Kölner Phonetik</i> algorithm.
285+
* <b>colognePhonetic()</b> is the actual implementations of the <i>Kölner Phonetik</i> algorithm.
283286
* </p>
284287
* <p>
285288
* In contrast to the initial description of the algorithm, this implementation does the encoding in one pass.
286289
* </p>
287290
*
288291
* @param text
289-
* @return the corresponding encoding according to the <i>Kölner Phonetik</i> algorithm
292+
* @return the corresponding encoding according to the <i>Kölner Phonetik</i> algorithm
290293
*/
291294
public String colognePhonetic(String text) {
292295
if (text == null) {
@@ -376,7 +379,7 @@ public String colognePhonetic(String text) {
376379

377380
public Object encode(Object object) throws EncoderException {
378381
if (!(object instanceof String)) {
379-
throw new EncoderException("This method’s parameter was expected to be of the type " +
382+
throw new EncoderException("This method’s parameter was expected to be of the type " +
380383
String.class.getName() +
381384
". But actually it was of the type " +
382385
object.getClass().getName() +
@@ -394,7 +397,7 @@ public boolean isEncodeEqual(String text1, String text2) {
394397
}
395398

396399
/*
397-
* Converts the string to upper case and replaces germanic umlauts, and the “ß”.
400+
* Converts the string to upper case and replaces germanic umlauts, and the “ß�.
398401
*/
399402
private String preprocess(String text) {
400403
text = text.toUpperCase(Locale.GERMAN);

src/java/org/apache/commons/codec/language/Soundex.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public int difference(String s1, String s2) throws EncoderException {
8585
*
8686
* @deprecated This feature is not needed since the encoding size must be constant. Will be removed in 2.0.
8787
*/
88+
@Deprecated
8889
private int maxLength = 4;
8990

9091
/**
@@ -199,6 +200,7 @@ private char getMappingCode(String str, int index) {
199200
* @deprecated This feature is not needed since the encoding size must be constant. Will be removed in 2.0.
200201
* @return int
201202
*/
203+
@Deprecated
202204
public int getMaxLength() {
203205
return this.maxLength;
204206
}
@@ -236,6 +238,7 @@ private char map(char ch) {
236238
* @param maxLength
237239
* The maxLength to set
238240
*/
241+
@Deprecated
239242
public void setMaxLength(int maxLength) {
240243
this.maxLength = maxLength;
241244
}

0 commit comments

Comments
 (0)