This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Patch: gnu.java.net.protocol.file.Connection


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I commited the attached patch to fix two mauve failures regarding 
URLConnection.getPermission(). Basically this patch is a merge from 
Classpath.


Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/y2RAWSOgCCdjSDsRArGTAJ9P/+5p647NeDEXIn7qKCocZ4FEHACeJqc0
bZTyjcgB/BM6mLivLRdr+RM=
=qSG1
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2384
diff -u -b -B -r1.2384 ChangeLog
--- ChangeLog	1 Dec 2003 14:32:24 -0000	1.2384
+++ ChangeLog	1 Dec 2003 14:42:08 -0000
@@ -1,5 +1,13 @@
 2003-12-01  Michael Koch  <konqueror@gmx.de>
 
+	* gnu/java/net/protocol/file/Connection.java
+	(DEFAULT_PERMISSION): New static field.
+	(permission): New field.
+	(Connection): Initialize permission field.
+	(getPermission): New method.
+
+2003-12-01  Michael Koch  <konqueror@gmx.de>
+
 	* gnu/java/net/natPlainSocketImplPosix.cc
 	bind(): Dont set SockedImpl.address field on succesful bind.
 	* gnu/java/net/natPlainSocketImplWin32.cc
Index: gnu/java/net/protocol/file/Connection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/protocol/file/Connection.java,v
retrieving revision 1.2
diff -u -b -B -r1.2 Connection.java
--- gnu/java/net/protocol/file/Connection.java	18 Oct 2003 12:24:56 -0000	1.2
+++ gnu/java/net/protocol/file/Connection.java	1 Dec 2003 14:42:08 -0000
@@ -45,10 +45,12 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.FilePermission;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.ProtocolException;
+import java.security.Permission;
 import java.util.Map;
 import java.util.Vector;
 import java.util.Hashtable;
@@ -60,6 +62,11 @@
  */
 public class Connection extends URLConnection
 {
+  /**
+   * Default permission for a file
+   */
+  private static final String DEFAULT_PERMISSION = "read";
+
   private Hashtable hdrHash = new Hashtable();
   private Vector hdrVec = new Vector();
   private boolean gotHeaders = false;
@@ -67,9 +74,16 @@
   private InputStream inputStream;
   private OutputStream outputStream;
 
+  /**
+   * FilePermission to read the file
+   */
+  private FilePermission permission;
+
   public Connection(URL url)
   {
     super (url);
+
+    permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION);
   }
   
   /**
@@ -238,4 +252,17 @@
     hdrHash.put(key.toLowerCase(), Long.toString(len));
   }
   
+  /**
+   * This method returns a <code>Permission</code> object representing the
+   * permissions required to access this URL.  This method returns a
+   * <code>java.io.FilePermission</code> for the file's path with a read
+   * permission.
+   *
+   * @return A Permission object
+   */
+  public Permission getPermission() throws IOException
+  {
+    return permission;
+  }
+
 } // class FileURLConnection

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]