diff options
author | Michael Koch <mkoch@gcc.gnu.org> | 2005-04-28 17:25:02 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2005-04-28 17:25:02 +0000 |
commit | a9eed58b76c8be866099b065e0db563735bc9cbb (patch) | |
tree | c37c7c38baa5831c3115a630fcce968c5d473fbd /libjava/gnu/java | |
parent | 15d6512462e9878ea0ab15d643c6c9200c0fadce (diff) | |
download | gcc-a9eed58b76c8be866099b065e0db563735bc9cbb.zip gcc-a9eed58b76c8be866099b065e0db563735bc9cbb.tar.gz gcc-a9eed58b76c8be866099b065e0db563735bc9cbb.tar.bz2 |
[multiple changes]
2005-04-28 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.
2005-04-28 Michael Koch <konqueror@gmx.de>
* gnu/java/net/protocol/file/Connection.java
(lineSeparator): Initialize with SystemProperties.getProperty().
From-SVN: r98929
Diffstat (limited to 'libjava/gnu/java')
-rw-r--r-- | libjava/gnu/java/net/protocol/file/Connection.java | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/libjava/gnu/java/net/protocol/file/Connection.java b/libjava/gnu/java/net/protocol/file/Connection.java index 0f6e4d6..05611e2 100644 --- a/libjava/gnu/java/net/protocol/file/Connection.java +++ b/libjava/gnu/java/net/protocol/file/Connection.java @@ -37,7 +37,7 @@ exception statement from your version. */ package gnu.java.net.protocol.file; -import gnu.java.security.action.GetPropertyAction; +import gnu.classpath.SystemProperties; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -56,7 +56,6 @@ import java.net.ProtocolException; import java.net.URL; import java.net.URLConnection; import java.security.Permission; -import java.security.AccessController; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; @@ -76,23 +75,19 @@ 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 String lineSeparator; - - static + private static class StaticData { - if (lineSeparator == null) - { - GetPropertyAction getProperty = new GetPropertyAction("line.separator"); - lineSeparator = (String) AccessController.doPrivileged(getProperty); - } + /** + * 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 = + SystemProperties.getProperty("line.separator"); } + /** * This is a File object for this connection @@ -182,7 +177,7 @@ public class Connection extends URLConnection for (int i = 0; i < files.length; i++) { writer.write(files[i]); - writer.write(lineSeparator); + writer.write(StaticData.lineSeparator); } directoryListing = sink.toByteArray(); @@ -271,9 +266,10 @@ public class Connection extends URLConnection } 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())); } } } |