commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r797688 - in /commons/proper/codec/trunk/src/java/org/apache/commons/codec: EncoderException.java binary/Hex.java net/BCodec.java net/QCodec.java net/QuotedPrintableCodec.java net/URLCodec.java
Date Fri, 24 Jul 2009 23:18:30 GMT
Author: ggregory
Date: Fri Jul 24 23:18:29 2009
New Revision: 797688

URL: http://svn.apache.org/viewvc?rev=797688&view=rev
Log:
Now that we are on Java 1.4, we can save the original exception when we re-throw another exception.

Modified:
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/EncoderException.java
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/BCodec.java
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.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/EncoderException.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/EncoderException.java?rev=797688&r1=797687&r2=797688&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/EncoderException.java (original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/EncoderException.java Fri
Jul 24 23:18:29 2009
@@ -18,10 +18,9 @@
 package org.apache.commons.codec;
 
 /**
- * Thrown when there is a failure condition during the encoding process.  This
- * exception is thrown when an Encoder encounters a encoding specific exception
- * such as invalid data, inability to calculate a checksum, characters outside of the 
- * expected range.
+ * Thrown when there is a failure condition during the encoding process. This exception is
thrown when an Encoder
+ * encounters a encoding specific exception such as invalid data, inability to calculate
a checksum, characters outside
+ * of the expected range.
  * 
  * @author Apache Software Foundation
  * @version $Id$
@@ -38,10 +37,36 @@
     /**
      * Creates a new instance of this exception with an useful message.
      * 
-     * @param message a useful message relating to the encoder specific error.
+     * @param message
+     *            a useful message relating to the encoder specific error.
      */
     public EncoderException(String message) {
         super(message);
     }
-}  
 
+    /**
+     * Creates a EncoderException.
+     * 
+     * @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 EncoderException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Creates a EncoderException.
+     * 
+     * @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 EncoderException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java?rev=797688&r1=797687&r2=797688&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java (original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Hex.java Fri Jul 24
23:18:29 2009
@@ -221,7 +221,7 @@
             byte[] byteArray = object instanceof String ? ((String) object).getBytes() :
(byte[]) object;
             return encodeHex(byteArray);
         } catch (ClassCastException e) {
-            throw new EncoderException(e.getMessage());
+            throw new EncoderException(e.getMessage(), e);
         }
     }
 

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/BCodec.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/BCodec.java?rev=797688&r1=797687&r2=797688&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/BCodec.java (original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/BCodec.java Fri Jul 24
23:18:29 2009
@@ -108,7 +108,7 @@
         try {
             return encodeText(value, charset);
         } catch (UnsupportedEncodingException e) {
-            throw new EncoderException(e.getMessage());
+            throw new EncoderException(e.getMessage(), e);
         }
     }
 

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java?rev=797688&r1=797687&r2=797688&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java (original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QCodec.java Fri Jul 24
23:18:29 2009
@@ -190,7 +190,7 @@
         try {
             return encodeText(pString, charset);
         } catch (UnsupportedEncodingException e) {
-            throw new EncoderException(e.getMessage());
+            throw new EncoderException(e.getMessage(), e);
         }
     }
 

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java?rev=797688&r1=797687&r2=797688&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
(original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
Fri Jul 24 23:18:29 2009
@@ -255,7 +255,7 @@
         try {
             return encode(pString, getDefaultCharset());
         } catch (UnsupportedEncodingException e) {
-            throw new EncoderException(e.getMessage());
+            throw new EncoderException(e.getMessage(), e);
         }
     }
 

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=797688&r1=797687&r2=797688&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 23:18:29 2009
@@ -244,7 +244,7 @@
         try {
             return encode(pString, getDefaultCharset());
         } catch (UnsupportedEncodingException e) {
-            throw new EncoderException(e.getMessage());
+            throw new EncoderException(e.getMessage(), e);
         }
     }
 



Mime
View raw message