classpathx-javamail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Classpathx-javamail] Patch Review: source/gnu/mail/providers/mbox/MboxS


From: Conrad T. Pino
Subject: [Classpathx-javamail] Patch Review: source/gnu/mail/providers/mbox/MboxStore.java
Date: Wed, 28 Nov 2007 00:17:46 -0800

Patch goal:

1. Reduce warnings, 2 types (see below)
2. Consistent constant use; replace '/' and "/" with separatorChar.

----------
9. WARNING in source/gnu/mail/providers/mbox/MboxStore.java (at line 31)
        import java.io.IOException;
               ^^^^^^^^^^^^^^^^^^^
The import java.io.IOException is never used
----------
10. WARNING in source/gnu/mail/providers/mbox/MboxStore.java (at line 67)
        private static final char separatorChar = '/';
                                  ^^^^^^^^^^^^^
The field MboxStore.separatorChar is never read locally
----------

Index: source/gnu/mail/providers/mbox/MboxStore.java
===================================================================
RCS file: 
/sources/classpathx/mail/source/gnu/mail/providers/mbox/MboxStore.java,v
retrieving revision 1.24
diff -u -r1.24 MboxStore.java
--- source/gnu/mail/providers/mbox/MboxStore.java       27 Nov 2007 22:03:55 
-0000      1.24
+++ source/gnu/mail/providers/mbox/MboxStore.java       28 Nov 2007 07:58:07 
-0000
@@ -28,7 +28,6 @@
 package gnu.mail.providers.mbox;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.List;
@@ -109,15 +108,15 @@
             path = decodeUrlPath(path);
 
             // Relative or Windows absolute path
-            if (File.separatorChar != '/')
+            if (File.separatorChar != separatorChar)
               {
-                path = path.replace('/', File.separatorChar);
+                path = path.replace(separatorChar, File.separatorChar);
               }
             root = new File(path);
-            if (!root.exists() && File.separatorChar == '/')
+            if (!root.exists() && File.separatorChar == separatorChar)
               {
                 // Absolute path on POSIX platform
-                root = new File("/" + path);
+                root = new File(separatorChar + path);
               }
           }
       }
@@ -204,9 +203,9 @@
       }
     File file = null;
     // Convert any slashes to platform path separator
-    if (File.separatorChar != '/')
+    if (File.separatorChar != separatorChar)
       {
-        name = name.replace('/', File.separatorChar);
+        name = name.replace(separatorChar, File.separatorChar);
       }
     if (root != null && root.isDirectory())
       {
@@ -238,10 +237,10 @@
                 inbox = new File(inboxname);
               }
           }
-        if (!inbox.exists() && attemptFallback && File.separatorChar == '/')
+        if (!inbox.exists() && attemptFallback && File.separatorChar == 
separatorChar)
           {
             PrivilegedAction a;
-            if (File.separatorChar == '/')
+            if (File.separatorChar == separatorChar)
               {
                 // Try some common (UNIX) locations.
                 a = new GetSystemPropertyAction("user.name");
@@ -449,7 +448,7 @@
   {
     return (c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a) ||
       (c >= 0x30 && c <= 0x39) || c == '-' || c == '.' || c == '_' ||
-      c == '~' || c == '/';
+      c == '~' || c == separatorChar;
   }
 
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]