Skip to content

Commit 0e82d92

Browse files
committed
Make code less twisty.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/codec/trunk@130370 13f79535-47bb-0310-9956-ffa450edef68
1 parent 12cb31c commit 0e82d92

5 files changed

Lines changed: 13 additions & 36 deletions

File tree

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

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
3232
* @author Apache Software Foundation
3333
* @since 1.0-dev
34-
* @version $Id: Base64.java,v 1.19 2004/03/24 18:37:25 ggregory Exp $
34+
* @version $Id: Base64.java,v 1.20 2004/05/24 00:21:24 ggregory Exp $
3535
*/
3636
public class Base64 implements BinaryEncoder, BinaryDecoder {
3737

@@ -203,17 +203,10 @@ public static byte[] encodeBase64Chunked(byte[] binaryData) {
203203
* of type byte[]
204204
*/
205205
public Object decode(Object pObject) throws DecoderException {
206-
207-
Object result;
208-
209206
if (!(pObject instanceof byte[])) {
210207
throw new DecoderException("Parameter supplied to Base64 decode is not a byte[]");
211-
} else {
212-
result = decode((byte[]) pObject);
213208
}
214-
215-
return result;
216-
209+
return decode((byte[]) pObject);
217210
}
218211

219212
/**
@@ -510,18 +503,11 @@ static byte[] discardNonBase64(byte[] data) {
510503
* of type byte[]
511504
*/
512505
public Object encode(Object pObject) throws EncoderException {
513-
514-
Object result;
515-
516506
if (!(pObject instanceof byte[])) {
517507
throw new EncoderException(
518508
"Parameter supplied to Base64 encode is not a byte[]");
519-
} else {
520-
result = encode((byte[]) pObject);
521509
}
522-
523-
return result;
524-
510+
return encode((byte[]) pObject);
525511
}
526512

527513
/**

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* </ul>
3232
*
3333
* @author Apache Software Foundation
34-
* @version $Id: DoubleMetaphone.java,v 1.20 2004/02/29 04:08:31 tobrien Exp $
34+
* @version $Id: DoubleMetaphone.java,v 1.21 2004/05/24 00:25:22 ggregory Exp $
3535
*/
3636
public class DoubleMetaphone implements StringEncoder {
3737

@@ -198,12 +198,10 @@ public String doubleMetaphone(String value, boolean alternate) {
198198
* @throws EncoderException encode parameter is not of type String
199199
*/
200200
public Object encode(Object obj) throws EncoderException {
201-
202201
if (!(obj instanceof String)) {
203202
throw new EncoderException("DoubleMetaphone encode parameter is not of type String");
204-
} else {
205-
return doubleMetaphone((String) obj);
206-
}
203+
}
204+
return doubleMetaphone((String) obj);
207205
}
208206

209207
/**

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* <i>Computer Language</i> of Dec. 1990, p 39
2929
*
3030
* @author Apache Software Foundation
31-
* @version $Id: Metaphone.java,v 1.17 2004/05/24 00:19:13 ggregory Exp $
31+
* @version $Id: Metaphone.java,v 1.18 2004/05/24 00:22:45 ggregory Exp $
3232
*/
3333
public class Metaphone implements StringEncoder {
3434

@@ -354,13 +354,10 @@ private boolean isLastChar(int wdsz, int n) {
354354
* of type java.lang.String
355355
*/
356356
public Object encode(Object pObject) throws EncoderException {
357-
Object result;
358357
if (!(pObject instanceof java.lang.String)) {
359358
throw new EncoderException("Parameter supplied to Metaphone encode is not of type java.lang.String");
360-
} else {
361-
result = metaphone((String) pObject);
362359
}
363-
return result;
360+
return metaphone((String) pObject);
364361
}
365362

366363
/**

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* Margaret Odell and Robert Russell
2626
*
2727
* @author Apache Software Foundation
28-
* @version $Id: RefinedSoundex.java,v 1.18 2004/04/18 21:31:46 tobrien Exp $
28+
* @version $Id: RefinedSoundex.java,v 1.19 2004/05/24 00:23:17 ggregory Exp $
2929
*/
3030
public class RefinedSoundex implements StringEncoder {
3131

@@ -110,13 +110,10 @@ public int difference(String s1, String s2) throws EncoderException {
110110
* if the parameter supplied is not of type java.lang.String
111111
*/
112112
public Object encode(Object pObject) throws EncoderException {
113-
Object result;
114113
if (!(pObject instanceof java.lang.String)) {
115114
throw new EncoderException("Parameter supplied to RefinedSoundex encode is not of type java.lang.String");
116-
} else {
117-
result = soundex((String) pObject);
118115
}
119-
return result;
116+
return soundex((String) pObject);
120117
}
121118

122119
/**

src/java/org/apache/commons/codec/net/QCodec.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
* @author Apache Software Foundation
4444
* @since 1.3
45-
* @version $Id: QCodec.java,v 1.5 2004/04/13 22:46:37 ggregory Exp $
45+
* @version $Id: QCodec.java,v 1.6 2004/05/24 00:24:32 ggregory Exp $
4646
*/
4747
public class QCodec extends RFC1522Codec implements StringEncoder, StringDecoder {
4848
/**
@@ -166,9 +166,8 @@ protected byte[] doDecoding(byte[] bytes) throws DecoderException {
166166
}
167167
}
168168
return QuotedPrintableCodec.decodeQuotedPrintable(tmp);
169-
} else {
170-
return QuotedPrintableCodec.decodeQuotedPrintable(bytes);
171-
}
169+
}
170+
return QuotedPrintableCodec.decodeQuotedPrintable(bytes);
172171
}
173172

174173
/**

0 commit comments

Comments
 (0)