james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1427831 - /james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/BasicBodyFactory.java
Date Wed, 02 Jan 2013 15:45:58 GMT
Author: olegk
Date: Wed Jan  2 15:45:57 2013
New Revision: 1427831

URL: http://svn.apache.org/viewvc?rev=1427831&view=rev
Log:
MIME4J-218: rethrow UnsupportedCharsetException as a checked I/O exception

Modified:
    james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/BasicBodyFactory.java

Modified: james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/BasicBodyFactory.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/BasicBodyFactory.java?rev=1427831&r1=1427830&r2=1427831&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/BasicBodyFactory.java
(original)
+++ james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/BasicBodyFactory.java
Wed Jan  2 15:45:57 2013
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
+import java.nio.charset.UnsupportedCharsetException;
 
 import org.apache.james.mime4j.dom.BinaryBody;
 import org.apache.james.mime4j.dom.TextBody;
@@ -38,8 +39,12 @@ public class BasicBodyFactory implements
         return new BasicBinaryBody(bufferContent(is));
     }
 
-    protected Charset resolveCharset(final String mimeCharset) {
-        return mimeCharset != null ? Charset.forName(mimeCharset) : null;
+    protected Charset resolveCharset(final String mimeCharset) throws UnsupportedEncodingException
{
+        try {
+            return mimeCharset != null ? Charset.forName(mimeCharset) : null;
+        } catch (UnsupportedCharsetException ex) {
+            throw new UnsupportedEncodingException(mimeCharset);
+        }
     }
 
     public TextBody textBody(final InputStream is, final String mimeCharset) throws IOException
{



Mime
View raw message