summaryrefslogtreecommitdiff
path: root/gnu/java/net/protocol
diff options
context:
space:
mode:
authorJeroen Frijters <jeroen@sumatra.nl>2004-12-02 11:58:04 +0000
committerJeroen Frijters <jeroen@sumatra.nl>2004-12-02 11:58:04 +0000
commit07deb0cb592e8d4286e2e962f28a94e60d454a73 (patch)
tree344d234617e0abbdb29b35b16ee035f72efba13e /gnu/java/net/protocol
parent0db1e3f8c5e6dbdfe067bded199cc99f752d2884 (diff)
downloadclasspath-07deb0cb592e8d4286e2e962f28a94e60d454a73.tar.gz
2004-12-02 Jeroen Frijters <jeroen@frijters.net>
* gnu/java/net/protocol/file/Connection.java (StaticData): New inner class to contain statics. (connect, getHeaderField): Modified to use StaticData. * java/lang/Class.java (desiredAssertionStatus): Modified to use ClassLoader.StaticData. * java/lang/ClassLoader.java (StaticData): New inner class to contain statics. (defineClass, setPackageAssertionStatus, setClassAssertionStatus): Modified to use StaticData.
Diffstat (limited to 'gnu/java/net/protocol')
-rw-r--r--gnu/java/net/protocol/file/Connection.java33
1 files changed, 17 insertions, 16 deletions
diff --git a/gnu/java/net/protocol/file/Connection.java b/gnu/java/net/protocol/file/Connection.java
index 2754717bb..69550e7cb 100644
--- a/gnu/java/net/protocol/file/Connection.java
+++ b/gnu/java/net/protocol/file/Connection.java
@@ -73,14 +73,20 @@ public class Connection extends URLConnection
*/
private static final String DEFAULT_PERMISSION = "read";
- /**
- * HTTP-style DateFormat, used to format the last-modified header.
- */
- private static SimpleDateFormat dateFormat
- = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
- new Locale ("En", "Us", "Unix"));
+ private static class StaticData
+ {
+ /**
+ * HTTP-style DateFormat, used to format the last-modified header.
+ */
+ static SimpleDateFormat dateFormat
+ = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
+ new Locale ("En", "Us", "Unix"));
+
+ static String lineSeparator =
+ (String)AccessController.doPrivileged(
+ new GetPropertyAction("line.separator"));
+ }
- private static String lineSeparator;
/**
* This is a File object for this connection
@@ -136,17 +142,11 @@ public class Connection extends URLConnection
{
if (doInput)
{
- if (lineSeparator == null)
- {
- GetPropertyAction getProperty = new GetPropertyAction("line.separator");
- lineSeparator = (String) AccessController.doPrivileged(getProperty);
- }
-
StringBuffer sb = new StringBuffer();
String[] files = file.list();
for (int index = 0; index < files.length; ++index)
- sb.append(files[index]).append(lineSeparator);
+ sb.append(files[index]).append(StaticData.lineSeparator);
inputStream = new ByteArrayInputStream(sb.toString().getBytes());
}
@@ -234,9 +234,10 @@ public class Connection extends URLConnection
return Long.toString(file.length());
else if (field.equals("last-modified"))
{
- synchronized (dateFormat)
+ synchronized (StaticData.dateFormat)
{
- return dateFormat.format(new Date(file.lastModified()));
+ return StaticData.dateFormat.format(
+ new Date(file.lastModified()));
}
}
}