Author: ggregory Date: Fri Jul 24 22:17:52 2009 New Revision: 797672 URL: http://svn.apache.org/viewvc?rev=797672&view=rev Log: Since we are using the trick of catching an ArrayIndexOutOfBoundsException instead of checking bounds, let's keep the exception when we rethrow a DecoderException.
Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/DecoderException.java commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/DecoderException.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/DecoderException.java?rev=797672&r1=797671&r2=797672&view=diff ============================================================================== --- commons/proper/codec/trunk/src/java/org/apache/commons/codec/DecoderException.java (original) +++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/DecoderException.java Fri Jul 24 22:17:52 2009 @@ -18,7 +18,7 @@ package org.apache.commons.codec; /** - * Thrown when a Decoder has encountered a failure condition during a decode. + * Thrown when a Decoder has encountered a failure condition during a decode. * * @author Apache Software Foundation * @version $Id$ @@ -33,13 +33,38 @@ private static final long serialVersionUID = 1L; /** - * Creates a DecoderException + * Creates a DecoderException. * - * @param message A message with meaning to a human + * @param message + * The detail message which is saved for later retrieval by the {...@link #getMessage()} method. */ public DecoderException(String message) { super(message); } -} + /** + * Creates a DecoderException. + * + * @param cause + * The cause which is saved for later retrieval by the {...@link #getCause()} method. A <code>null</code> + * value is permitted, and indicates that the cause is nonexistent or unknown. + * @since 1.4 + */ + public DecoderException(Throwable cause) { + super(cause); + } + /** + * Creates a DecoderException. + * + * @param message + * The detail message which is saved for later retrieval by the {...@link #getMessage()} method. + * @param cause + * The cause which is saved for later retrieval by the {...@link #getCause()} method. A <code>null</code> + * value is permitted, and indicates that the cause is nonexistent or unknown. + * @since 1.4 + */ + public DecoderException(String message, Throwable cause) { + super(message, cause); + } +} Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java?rev=797672&r1=797671&r2=797672&view=diff ============================================================================== --- commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java (original) +++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/URLCodec.java Fri Jul 24 22:17:52 2009 @@ -178,7 +178,7 @@ int l = toCharacterDigit(bytes[++i]); buffer.write((char) ((u << 4) + l)); } catch (ArrayIndexOutOfBoundsException e) { - throw new DecoderException("Invalid URL encoding: "); + throw new DecoderException("Invalid URL encoding: ", e); } } else { buffer.write(b);