[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: improved initialization of file connection

Kaffe CVS cvs-commits at kaffe.org
Fri Dec 3 20:20:08 PST 2004


PatchSet 5536 
Date: 2004/12/04 03:00:51
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: improved initialization of file connection

2004-12-03  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/gnu/java/net/protocol/file/Connection.java:
        Resynced with GNU Classpath.

        2004-12-02  Jeroen Frijters  <jeroen at frijters.net>

        * gnu/java/net/protocol/file/Connection.java
        (StaticData): New inner class to contain statics.
        (connect, getHeaderField): Modified to use StaticData.

Members: 
	ChangeLog:1.3082->1.3083 
	libraries/javalib/gnu/java/net/protocol/file/Connection.java:1.8->1.9 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3082 kaffe/ChangeLog:1.3083
--- kaffe/ChangeLog:1.3082	Sat Dec  4 02:38:16 2004
+++ kaffe/ChangeLog	Sat Dec  4 03:00:51 2004
@@ -1,5 +1,16 @@
 2004-12-03  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/gnu/java/net/protocol/file/Connection.java:
+        Resynced with GNU Classpath.
+
+	2004-12-02  Jeroen Frijters  <jeroen at frijters.net>
+
+        * gnu/java/net/protocol/file/Connection.java
+        (StaticData): New inner class to contain statics.
+        (connect, getHeaderField): Modified to use StaticData.
+
+2004-12-03  Dalibor Topic  <robilad at kaffe.org>
+
 	*  libraries/javalib/javax/swing/AbstractListModel.java,
 	libraries/javalib/javax/swing/DefaultSingleSelectionModel.java,
 	libraries/javalib/javax/swing/JPopupMenu.java:
Index: kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java:1.8 kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java:1.9
--- kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java:1.8	Sun Sep 12 15:10:58 2004
+++ kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java	Sat Dec  4 03:00:52 2004
@@ -73,14 +73,20 @@
    */
   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 @@
       {
 	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 @@
           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()));
 	      }
 	  }
       }




More information about the kaffe mailing list