Commit 316b38c8 by Michael Koch Committed by Michael Koch

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.

From-SVN: r71643
parent 9554f886
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> 2003-09-20 Tom Tromey <tromey@redhat.com>
* java/awt/Component.java: Indentation cleanup from Classpath. * java/awt/Component.java: Indentation cleanup from Classpath.
......
...@@ -103,21 +103,21 @@ public abstract class JarURLConnection extends URLConnection ...@@ -103,21 +103,21 @@ public abstract class JarURLConnection extends URLConnection
* *
* @specnote This constructor is protected since JDK 1.4 * @specnote This constructor is protected since JDK 1.4
*/ */
protected JarURLConnection(URL url) protected JarURLConnection (URL url)
throws MalformedURLException throws MalformedURLException
{ {
super(url); super (url);
String spec = url.getFile(); String spec = url.getFile();
int bang = spec.indexOf ("!/", 0); int bang = spec.indexOf ("!/");
if (bang == -1) if (bang == -1)
throw new MalformedURLException (url + ": No `!/' in spec."); throw new MalformedURLException (url + ": No `!/' in spec.");
// Extact the url for the jar itself. // Extract the url for the jar itself.
jarFileURL = new URL(spec.substring (0, bang)); jarFileURL = new URL (spec.substring (0, bang));
// Get the name of the element, if any. // 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 abstract class JarURLConnection extends URLConnection ...@@ -428,7 +428,9 @@ public abstract class JarURLConnection extends URLConnection
*/ */
public Certificate[] getCertificates () throws IOException public Certificate[] getCertificates () throws IOException
{ {
return getJarEntry ().getCertificates (); JarEntry entry = getJarEntry();
return entry != null ? entry.getCertificates() : null;
} }
/** /**
...@@ -441,7 +443,9 @@ public abstract class JarURLConnection extends URLConnection ...@@ -441,7 +443,9 @@ public abstract class JarURLConnection extends URLConnection
*/ */
public Attributes getMainAttributes () throws IOException public Attributes getMainAttributes () throws IOException
{ {
return getManifest ().getMainAttributes (); Manifest manifest = getManifest();
return manifest != null ? manifest.getMainAttributes() : null;
} }
/** /**
...@@ -455,8 +459,9 @@ public abstract class JarURLConnection extends URLConnection ...@@ -455,8 +459,9 @@ public abstract class JarURLConnection extends URLConnection
*/ */
public Attributes getAttributes () throws IOException public Attributes getAttributes () throws IOException
{ {
// FIXME: implement this JarEntry entry = getJarEntry();
return null;
return entry != null ? entry.getAttributes() : null;
} }
/** /**
...@@ -469,8 +474,8 @@ public abstract class JarURLConnection extends URLConnection ...@@ -469,8 +474,8 @@ public abstract class JarURLConnection extends URLConnection
*/ */
public Manifest getManifest () throws IOException public Manifest getManifest () throws IOException
{ {
JarFile file = getJarFile (); JarFile file = getJarFile();
return (file != null) ? file.getManifest() : null; return file != null ? file.getManifest() : null;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment