geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r953638 - in /geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail: authentication/ store/imap/connection/ store/nntp/newsrc/ store/pop3/connection/ transport/nntp/
Date Fri, 11 Jun 2010 10:09:01 GMT
Author: rickmcguire
Date: Fri Jun 11 10:09:00 2010
New Revision: 953638

URL: http://svn.apache.org/viewvc?rev=953638&view=rev
Log:
fix java 5 compilation errors

Modified:
    geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java
    geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseStream.java
    geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
    geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/nntp/newsrc/NNTPNewsrcFile.java
    geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/connection/POP3Connection.java
    geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java

Modified: geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java?rev=953638&r1=953637&r2=953638&view=diff
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java
Fri Jun 11 10:09:00 2010
@@ -19,7 +19,6 @@
 
 package org.apache.geronimo.javamail.authentication;
 
-import java.nio.charset.Charset;
 import java.io.UnsupportedEncodingException;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;

Modified: geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseStream.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseStream.java?rev=953638&r1=953637&r2=953638&view=diff
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseStream.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseStream.java
Fri Jun 11 10:09:00 2010
@@ -20,7 +20,7 @@ package org.apache.geronimo.javamail.sto
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.nio.charset.Charset;
+import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
@@ -131,7 +131,11 @@ public class IMAPResponseStream {
             // response is in.  There are many different untagged formats, some general,
some
             // specific to particular command types.
             if (token.getType() != Token.ATOM) {
-                throw new MessagingException("Unknown server response: " + new String(data,
Charset.forName("ISO8859-1")));
+                try {
+                    throw new MessagingException("Unknown server response: " + new String(data,
"ISO8859-1"));
+                } catch (UnsupportedEncodingException e) {
+                    throw new MessagingException("Unknown server response: " + new String(data));
+                }
             }
 
             String keyword = token.getValue();
@@ -213,7 +217,11 @@ public class IMAPResponseStream {
             // is 'OK'
             return new IMAPTaggedResponse(tag, status, tokenizer.getRemainder(), data);
         }
-        throw new MessagingException("Unknown server response: " + new String(data, Charset.forName("ISO8859-1")));
+        try {
+            throw new MessagingException("Unknown server response: " + new String(data, "ISO8859-1"));
+        } catch (UnsupportedEncodingException e) {
+            throw new MessagingException("Unknown server response: " + new String(data));
+        }
     }
 
     /**

Modified: geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java?rev=953638&r1=953637&r2=953638&view=diff
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPResponseTokenizer.java
Fri Jun 11 10:09:00 2010
@@ -19,7 +19,6 @@ package org.apache.geronimo.javamail.sto
 
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -187,7 +186,11 @@ public class IMAPResponseTokenizer {
             return "";
         }
 
-        return new String(response, pos, response.length - pos, Charset.forName("ISO8859-1"));
+        try {
+            return new String(response, pos, response.length - pos, "ISO8859-1");
+        } catch (UnsupportedEncodingException e) {
+            return null; 
+        }
     }
 
 
@@ -236,14 +239,18 @@ public class IMAPResponseTokenizer {
             }
         }
 
-        // Numeric tokens we store as a different type.
-        String value = new String(response, start, pos - start, Charset.forName("ISO8859-1"));
         try {
-            int intValue = Integer.parseInt(value);
-            return new Token(Token.NUMERIC, value);
-        } catch (NumberFormatException e) {
+            // Numeric tokens we store as a different type.
+            String value = new String(response, start, pos - start, "ISO8859-1");
+            try {
+                int intValue = Integer.parseInt(value);
+                return new Token(Token.NUMERIC, value);
+            } catch (NumberFormatException e) {
+            }
+            return new Token(Token.ATOM, value);
+        } catch (UnsupportedEncodingException e) {
+            return null; 
         }
-        return new Token(Token.ATOM, value);
     }
 
     /**
@@ -376,9 +383,12 @@ public class IMAPResponseTokenizer {
      * @exception ResponseFormatException
      */
     private Token readQuotedString() throws MessagingException {
-
-        String value = new String(readQuotedStringData(), Charset.forName("ISO8859-1"));
-        return new Token(Token.QUOTEDSTRING, value);
+        try {
+            String value = new String(readQuotedStringData(), "ISO8859-1");
+            return new Token(Token.QUOTEDSTRING, value);
+        } catch (UnsupportedEncodingException e) {
+            return null; 
+        }
     }
 
     /**
@@ -429,8 +439,12 @@ public class IMAPResponseTokenizer {
      * @exception ResponseFormatException
      */
     protected Token readLiteral() throws MessagingException {
-        String value = new String(readLiteralData(), Charset.forName("ISO8859-1"));
-        return new Token(Token.LITERAL, value);
+        try {
+            String value = new String(readLiteralData(), "ISO8859-1");
+            return new Token(Token.LITERAL, value);
+        } catch (UnsupportedEncodingException e) {
+            return null; 
+        }
     }
 
 
@@ -481,7 +495,11 @@ public class IMAPResponseTokenizer {
      * @return A String extracted from the buffer.
      */
     protected String substring(int start, int end ) {
-        return new String(response, start, end - start, Charset.forName("ISO8859-1"));
+        try {
+            return new String(response, start, end - start, "ISO8859-1");
+        } catch (UnsupportedEncodingException e) {
+            return null; 
+        }
     }
 
 

Modified: geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/nntp/newsrc/NNTPNewsrcFile.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/nntp/newsrc/NNTPNewsrcFile.java?rev=953638&r1=953637&r2=953638&view=diff
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/nntp/newsrc/NNTPNewsrcFile.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/nntp/newsrc/NNTPNewsrcFile.java
Fri Jun 11 10:09:00 2010
@@ -27,7 +27,6 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
-import java.nio.charset.Charset;
 
 public class NNTPNewsrcFile extends NNTPNewsrc {
     // source for the file data
@@ -51,7 +50,7 @@ public class NNTPNewsrcFile extends NNTP
      * @exception IOException
      */
     public BufferedReader getInputReader() throws IOException {
-        return new BufferedReader(new InputStreamReader(new FileInputStream(source), Charset.forName("ISO8859-1")));
+        return new BufferedReader(new InputStreamReader(new FileInputStream(source), "ISO8859-1"));
     }
 
     /**
@@ -62,6 +61,6 @@ public class NNTPNewsrcFile extends NNTP
      */
     public Writer getOutputWriter() throws IOException {
         // open this for overwriting
-        return new OutputStreamWriter(new FileOutputStream(source, false), Charset.forName("ISO8859-1"));
+        return new OutputStreamWriter(new FileOutputStream(source, false), "ISO8859-1");
     }
 }

Modified: geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/connection/POP3Connection.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/connection/POP3Connection.java?rev=953638&r1=953637&r2=953638&view=diff
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/connection/POP3Connection.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/store/pop3/connection/POP3Connection.java
Fri Jun 11 10:09:00 2010
@@ -22,7 +22,6 @@ import java.net.InetAddress;
 import java.net.Socket;
 import java.net.SocketException;
 import java.net.UnknownHostException;
-import java.nio.charset.Charset;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
@@ -158,9 +157,11 @@ public class POP3Connection extends Mail
         // The POp3 protocol is inherently a string-based protocol, so we get
         // string readers/writers for the connection streams.  Note that we explicitly
         // set the encoding to ensure that an inappropriate native encoding is not picked
up.
-        Charset iso88591 = Charset.forName("ISO8859-1");
-        reader = new BufferedReader(new InputStreamReader(inputStream, iso88591));
-        writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(outputStream),
iso88591));
+        try {
+            reader = new BufferedReader(new InputStreamReader(inputStream, "ISO8859-1"));
+            writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(outputStream),
"ISO8859-1"));
+        } catch (UnsupportedEncodingException e) {
+        }
     }
 
     protected void getWelcome() throws IOException {
@@ -307,18 +308,20 @@ public class POP3Connection extends Mail
         // it's more efficient to do this a buffer at a time.
         // the MIMEInputReader takes care of the byte-stuffing and
         // ".\r\n" input terminator for us.
-        OutputStreamWriter outWriter = new OutputStreamWriter(out, Charset.forName("ISO8859-1"));
-        char buffer[] = new char[500];
         try {
-            int charsRead = -1;
-            while ((charsRead = source.read(buffer)) >= 0) {
-                outWriter.write(buffer, 0, charsRead);
+            OutputStreamWriter outWriter = new OutputStreamWriter(out, "ISO8859-1");
+            char buffer[] = new char[500];
+            try {
+                int charsRead = -1;
+                while ((charsRead = source.read(buffer)) >= 0) {
+                    outWriter.write(buffer, 0, charsRead);
+                }
+                outWriter.flush();
+            } catch (IOException e) {
+                throw new MessagingException("Error processing a multi-line response", e);
             }
-            outWriter.flush();
-        } catch (IOException e) {
-            throw new MessagingException("Error processing a multi-line response", e);
+        } catch (UnsupportedEncodingException e) {
         }
-
         return out.toByteArray();
     }
 

Modified: geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java?rev=953638&r1=953637&r2=953638&view=diff
==============================================================================
--- geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java
(original)
+++ geronimo/javamail/trunk/geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java
Fri Jun 11 10:09:00 2010
@@ -33,7 +33,6 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.net.Socket;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -140,9 +139,11 @@ public class NNTPConnection extends Mail
         // The NNTP protocol is inherently a string-based protocol, so we get
         // string readers/writers for the connection streams.  Note that we explicitly
         // set the encoding to ensure that an inappropriate native encoding is not picked
up.
-        Charset iso88591 = Charset.forName("ISO8859-1");
-        reader = new BufferedReader(new InputStreamReader(inputStream, iso88591));
-        writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(outputStream),
iso88591));
+        try {
+            reader = new BufferedReader(new InputStreamReader(inputStream, "ISO8859-1"));
+            writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(outputStream),
"ISO8859-1"));
+        } catch (UnsupportedEncodingException e) {
+        }
     }
 
 



Mime
View raw message