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: java.net.JarURLConnection


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

Hello list,


I wrote a little patch to merge java.net.JarURLConnection more with 
classpath and to make it more error prone. Patch attached.


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

iD8DBQE/bo2wWSOgCCdjSDsRAhhxAJ9u7LM1dcCRolYaBwoO7Ug8w768+ACcCeLO
oQNHDwA5c4fOHUJyCpJk49s=
=tUBY
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2164
diff -u -b -B -r1.2164 ChangeLog
--- ChangeLog	20 Sep 2003 21:30:38 -0000	1.2164
+++ ChangeLog	22 Sep 2003 05:47:45 -0000
@@ -1,3 +1,12 @@
+2003-09-22  Michael Koch  <konqueror@gmx.de>
+
+	* java/net/JarURLConnection.java
+	(JarURLConnection): Modifed code to match classpath more, fixed comment.
+	(getCertificates): Made it more error prone.
+	(getMainAttributes): Likewise.
+	(getAttributes): Implemented.
+	(getManifest): Reformatted code.
+
 2003-09-20  Tom Tromey  <tromey@redhat.com>
 
 	* java/awt/Component.java: Indentation cleanup from Classpath.
Index: java/net/JarURLConnection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/JarURLConnection.java,v
retrieving revision 1.15
diff -u -b -B -r1.15 JarURLConnection.java
--- java/net/JarURLConnection.java	9 May 2003 07:11:11 -0000	1.15
+++ java/net/JarURLConnection.java	22 Sep 2003 05:47:45 -0000
@@ -103,21 +103,21 @@
    *
    * @specnote This constructor is protected since JDK 1.4
    */
-  protected JarURLConnection(URL url)
+  protected JarURLConnection (URL url)
     throws MalformedURLException
   {
-    super(url);
+    super (url);
 
     String spec = url.getFile();
-    int bang = spec.indexOf ("!/", 0);
+    int bang = spec.indexOf ("!/");
     if (bang == -1)
       throw new MalformedURLException (url + ": No `!/' in spec.");
 
-    // Extact the url for the jar itself.
-    jarFileURL = new URL(spec.substring (0, bang));
+    // Extract the url for the jar itself.
+    jarFileURL = new URL (spec.substring (0, bang));
 
     // Get the name of the element, if any.
-    element = (bang+2==spec.length() ? null : spec.substring (bang+2));
+    element = (spec.length() == (bang + 2) ? null : spec.substring (bang + 2));
   }
 
   /**
@@ -428,7 +428,9 @@
    */
   public Certificate[] getCertificates () throws IOException
   {
-    return getJarEntry ().getCertificates ();
+    JarEntry entry = getJarEntry();
+    
+    return entry != null ? entry.getCertificates() : null;
   }
 
   /**
@@ -441,7 +443,9 @@
    */
   public Attributes getMainAttributes () throws IOException
   {
-    return getManifest ().getMainAttributes ();
+    Manifest manifest = getManifest();
+    
+    return manifest != null ? manifest.getMainAttributes() : null;
   }
 
   /**
@@ -455,8 +459,9 @@
    */
   public Attributes getAttributes () throws IOException
   {
-    // FIXME: implement this
-    return null;
+    JarEntry entry = getJarEntry();
+
+    return entry != null ? entry.getAttributes() : null;
   }
 
   /**
@@ -469,8 +474,8 @@
    */
   public Manifest getManifest () throws IOException
   {
-    JarFile file = getJarFile ();
+    JarFile file = getJarFile();
 
-    return (file != null) ? file.getManifest() : null;
+    return file != null ? file.getManifest() : null;
   }
 }

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