Discussion:
[Classpathx-javamail] Patch Review: source/gnu/mail/providers/mbox/MboxStore.java
Conrad T. Pino
2007-11-28 08:17:46 UTC
Permalink
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;
}

}
Chris Burdess
2007-11-28 08:39:37 UTC
Permalink
Post by Conrad T. Pino
1. Reduce warnings, 2 types (see below)
2. Consistent constant use; replace '/' and "/" with separatorChar.
This looks straightforward, please commit.
--
Chris Burdess
Conrad T. Pino
2007-11-28 16:13:43 UTC
Permalink
Post by Chris Burdess
Post by Conrad T. Pino
1. Reduce warnings, 2 types (see below)
2. Consistent constant use; replace '/' and "/" with separatorChar.
This looks straightforward, please commit.
Committed with ChangeLog entry:

2007-11-28 Conrad T. Pino <***@Pino.com>

* source/gnu/mail/providers/mbox/MboxStore.java: Stop warnings; replace
'/' and "/" with private static final char separatorChar; remove unused
import java.io.IOException;

Conrad Pino

Loading...