Author: markt Date: Thu May 28 20:39:26 2015 New Revision: 1682330 URL: http://svn.apache.org/r1682330 Log: Update fork of Apache Commons codec from r1609340 to r1682326. Javadoc fixes only. No functional change.
Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/ (props changed) tomcat/trunk/java/org/apache/tomcat/util/codec/DecoderException.java tomcat/trunk/java/org/apache/tomcat/util/codec/EncoderException.java tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java Propchange: tomcat/trunk/java/org/apache/tomcat/util/codec/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu May 28 20:39:26 2015 @@ -1 +1 @@ -/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec:1459201-1609340 +/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec:1459201-1682326 Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/DecoderException.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/codec/DecoderException.java?rev=1682330&r1=1682329&r2=1682330&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/codec/DecoderException.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/codec/DecoderException.java Thu May 28 20:39:26 2015 @@ -30,7 +30,7 @@ public class DecoderException extends Ex private static final long serialVersionUID = 1L; /** - * Constructs a new exception with {@code null} as its detail message. The cause is not initialized, and may + * Constructs a new exception with <code>null</code> as its detail message. The cause is not initialized, and may * subsequently be initialized by a call to {@link #initCause}. * * @since 1.4 @@ -59,7 +59,7 @@ public class DecoderException extends Ex * @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} + * 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 */ @@ -73,7 +73,7 @@ public class DecoderException extends Ex * This constructor is useful for exceptions that are little more than wrappers for other throwables. * * @param cause - * The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null} + * 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 */ Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/EncoderException.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/codec/EncoderException.java?rev=1682330&r1=1682329&r2=1682330&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/codec/EncoderException.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/codec/EncoderException.java Thu May 28 20:39:26 2015 @@ -31,7 +31,7 @@ public class EncoderException extends Ex private static final long serialVersionUID = 1L; /** - * Constructs a new exception with {@code null} as its detail message. The cause is not initialized, and may + * Constructs a new exception with <code>null</code> as its detail message. The cause is not initialized, and may * subsequently be initialized by a call to {@link #initCause}. * * @since 1.4 @@ -62,7 +62,7 @@ public class EncoderException extends Ex * @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} + * 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 */ @@ -76,7 +76,7 @@ public class EncoderException extends Ex * This constructor is useful for exceptions that are little more than wrappers for other throwables. * * @param cause - * The cause which is saved for later retrieval by the {@link #getCause()} method. A {@code null} + * 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 */ Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java?rev=1682330&r1=1682329&r2=1682330&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/codec/binary/Base64.java Thu May 28 20:39:26 2015 @@ -35,6 +35,9 @@ import java.math.BigInteger; * <li>Line separator: Default is CRLF ("\r\n")</li> * </ul> * <p> + * The URL-safe parameter is only applied to encode operations. Decoding seamlessly handles both modes. + * </p> + * <p> * Since this class operates directly on byte streams, and not character streams, it is hard-coded to only * encode/decode character encodings which are compatible with the lower 127 ASCII chart (ISO-8859-1, Windows-1252, * UTF-8, etc). @@ -171,8 +174,7 @@ public class Base64 extends BaseNCodec { /** * Creates a Base64 codec used for decoding (all modes) and encoding in the given URL-safe mode. * <p> - * When encoding the line length is 76, the line separator is CRLF, and the encoding table is - * STANDARD_ENCODE_TABLE. + * When encoding the line length is 76, the line separator is CRLF, and the encoding table is STANDARD_ENCODE_TABLE. * </p> * * <p> @@ -180,7 +182,8 @@ public class Base64 extends BaseNCodec { * </p> * * @param urlSafe - * if {@code true}, URL-safe encoding is used. In most cases this should be set to {@code false}. + * if <code>true</code>, URL-safe encoding is used. In most cases this should be set to + * <code>false</code>. * @since 1.4 */ public Base64(final boolean urlSafe) { @@ -483,7 +486,7 @@ public class Base64 extends BaseNCodec { * * @param octet * The value to test - * @return {@code true} if the value is defined in the the base 64 alphabet, {@code false} otherwise. + * @return <code>true</code> if the value is defined in the the base 64 alphabet, <code>false</code> otherwise. * @since 1.4 */ public static boolean isBase64(final byte octet) { @@ -496,8 +499,8 @@ public class Base64 extends BaseNCodec { * * @param base64 * String to test - * @return {@code true} if all characters in the String are valid characters in the Base64 alphabet or if - * the String is empty; {@code false}, otherwise + * @return <code>true</code> if all characters in the String are valid characters in the Base64 alphabet or if + * the String is empty; <code>false</code>, otherwise * @since 1.5 */ public static boolean isBase64(final String base64) { @@ -510,8 +513,8 @@ public class Base64 extends BaseNCodec { * * @param arrayOctet * byte array to test - * @return {@code true} if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; - * {@code false}, otherwise + * @return <code>true</code> if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; + * <code>false</code>, otherwise * @since 1.5 */ public static boolean isBase64(final byte[] arrayOctet) { @@ -592,7 +595,7 @@ public class Base64 extends BaseNCodec { * @param binaryData * Array containing binary data to encode. * @param isChunked - * if {@code true} this encoder will chunk the base64 output into 76 character blocks + * if <code>true</code> this encoder will chunk the base64 output into 76 character blocks * @return Base64-encoded data. * @throws IllegalArgumentException * Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE} @@ -607,9 +610,9 @@ public class Base64 extends BaseNCodec { * @param binaryData * Array containing binary data to encode. * @param isChunked - * if {@code true} this encoder will chunk the base64 output into 76 character blocks + * if <code>true</code> this encoder will chunk the base64 output into 76 character blocks * @param urlSafe - * if {@code true} this encoder will emit - and _ instead of the usual + and / characters. + * if <code>true</code> this encoder will emit - and _ instead of the usual + and / characters. * <b>Note: no padding is added when encoding using the URL-safe alphabet.</b> * @return Base64-encoded data. * @throws IllegalArgumentException @@ -626,9 +629,9 @@ public class Base64 extends BaseNCodec { * @param binaryData * Array containing binary data to encode. * @param isChunked - * if {@code true} this encoder will chunk the base64 output into 76 character blocks + * if <code>true</code> this encoder will chunk the base64 output into 76 character blocks * @param urlSafe - * if {@code true} this encoder will emit - and _ instead of the usual + and / characters. + * if <code>true</code> this encoder will emit - and _ instead of the usual + and / characters. * <b>Note: no padding is added when encoding using the URL-safe alphabet.</b> * @param maxResultSize * The maximum result size to accept. @@ -658,7 +661,10 @@ public class Base64 extends BaseNCodec { } /** - * Decodes a Base64 String into octets + * Decodes a Base64 String into octets. + * <p> + * <b>Note:</b> this method seamlessly handles data encoded in URL-safe or normal mode. + * </p> * * @param base64String * String containing Base64 data @@ -670,7 +676,10 @@ public class Base64 extends BaseNCodec { } /** - * Decodes Base64 data into octets + * Decodes Base64 data into octets. + * <p> + * <b>Note:</b> this method seamlessly handles data encoded in URL-safe or normal mode. + * </p> * * @param base64Data * Byte array containing Base64 data @@ -689,7 +698,7 @@ public class Base64 extends BaseNCodec { // Implementation of integer encoding used for crypto /** - * Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature + * Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. * * @param pArray * a byte array containing base64 character data @@ -701,7 +710,7 @@ public class Base64 extends BaseNCodec { } /** - * Encodes to a byte64-encoded integer according to crypto standards such as W3C's XML-Signature + * Encodes to a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. * * @param bigInt * a BigInteger @@ -753,7 +762,7 @@ public class Base64 extends BaseNCodec { * * @param octet * The value to test - * @return {@code true} if the value is defined in the the Base64 alphabet {@code false} otherwise. + * @return <code>true</code> if the value is defined in the the Base64 alphabet <code>false</code> otherwise. */ @Override protected boolean isInAlphabet(final byte octet) { Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java?rev=1682330&r1=1682329&r2=1682330&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java Thu May 28 20:39:26 2015 @@ -255,6 +255,7 @@ public abstract class BaseNCodec impleme * * @param size minimum spare space required * @param context the context to be used + * @return the buffer */ protected byte[] ensureBufferSize(final int size, final Context context){ if ((context.buffer == null) || (context.buffer.length < context.pos + size)){ @@ -441,7 +442,7 @@ public abstract class BaseNCodec impleme * * @param value The value to test * - * @return {@code true} if the value is defined in the current alphabet, {@code false} otherwise. + * @return <code>true</code> if the value is defined in the current alphabet, <code>false</code> otherwise. */ protected abstract boolean isInAlphabet(byte value); @@ -450,10 +451,10 @@ public abstract class BaseNCodec impleme * The method optionally treats whitespace and pad as valid. * * @param arrayOctet byte array to test - * @param allowWSPad if {@code true}, then whitespace and PAD are also allowed + * @param allowWSPad if <code>true</code>, then whitespace and PAD are also allowed * - * @return {@code true} if all bytes are valid characters in the alphabet or if the byte array is empty; - * {@code false}, otherwise + * @return <code>true</code> if all bytes are valid characters in the alphabet or if the byte array is empty; + * <code>false</code>, otherwise */ public boolean isInAlphabet(final byte[] arrayOctet, final boolean allowWSPad) { for (int i = 0; i < arrayOctet.length; i++) { @@ -470,8 +471,8 @@ public abstract class BaseNCodec impleme * The method treats whitespace and PAD as valid. * * @param basen String to test - * @return {@code true} if all characters in the String are valid characters in the alphabet or if - * the String is empty; {@code false}, otherwise + * @return <code>true</code> if all characters in the String are valid characters in the alphabet or if + * the String is empty; <code>false</code>, otherwise * @see #isInAlphabet(byte[], boolean) */ public boolean isInAlphabet(final String basen) { @@ -485,7 +486,7 @@ public abstract class BaseNCodec impleme * * @param arrayOctet * byte array to test - * @return {@code true} if any byte is a valid character in the alphabet or PAD; {@code false} otherwise + * @return <code>true</code> if any byte is a valid character in the alphabet or PAD; <code>false</code> otherwise */ protected boolean containsAlphabetOrPad(final byte[] arrayOctet) { if (arrayOctet == null) { Modified: tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java?rev=1682330&r1=1682329&r2=1682330&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/codec/binary/StringUtils.java Thu May 28 20:39:26 2015 @@ -37,7 +37,7 @@ public class StringUtils { * @param string * The string to encode (if null, return null). * @param charset - * The {@link Charset} to encode the {@code String} + * The {@link Charset} to encode the <code>String</code> * @return the encoded bytes */ private static byte[] getBytes(final String string, final Charset charset) { @@ -52,8 +52,8 @@ public class StringUtils { * array. * * @param string - * the String to encode, may be {@code null} - * @return encoded bytes, or {@code null} if the input string was {@code null} + * the String to encode, may be <code>null</code> + * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a> */ public static byte[] getBytesUtf8(final String string) { @@ -66,9 +66,9 @@ public class StringUtils { * @param bytes * The bytes to be decoded into characters * @param charset - * The {@link Charset} to encode the {@code String} + * The {@link Charset} to encode the <code>String</code> * @return A new <code>String</code> decoded from the specified array of bytes using the given charset, - * or {@code null} if the input byte array was {@code null}. + * or <code>null</code> if the input byte array was <code>null</code>. */ private static String newString(final byte[] bytes, final Charset charset) { return bytes == null ? null : new String(bytes, charset); @@ -80,10 +80,9 @@ public class StringUtils { * @param bytes * The bytes to be decoded into characters * @return A new <code>String</code> decoded from the specified array of bytes using the UTF-8 charset, - * or {@code null} if the input byte array was {@code null}. + * or <code>null</code> if the input byte array was <code>null</code>. */ public static String newStringUtf8(final byte[] bytes) { return newString(bytes, StandardCharsets.UTF_8); } - } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org