/[classpath]/classpath/java/net/JarURLConnection.java
ViewVC logotype

Diff of /classpath/java/net/JarURLConnection.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by mkoch, Sun Sep 21 16:38:11 2003 UTC revision 1.13 by mkoch, Sun Sep 21 18:22:50 2003 UTC
# Line 85  public abstract class JarURLConnection e Line 85  public abstract class JarURLConnection e
85    private String entry_name;    private String entry_name;
86    
87    /**    /**
    * The JarFile object for the jar file pointed to by the real URL  
    */  
   private JarFile jar_file;  
   
   /**  
88     * Creates a JarURLConnection from an URL object     * Creates a JarURLConnection from an URL object
89     *     *
90     * @param URL url The URL object for this connection.     * @param URL url The URL object for this connection.
# Line 106  public abstract class JarURLConnection e Line 101  public abstract class JarURLConnection e
101      if (!url.getProtocol().equals ("jar"))      if (!url.getProtocol().equals ("jar"))
102        throw new MalformedURLException (url + ": Not jar protocol.");        throw new MalformedURLException (url + ": Not jar protocol.");
103    
104      // Now, strip off the "jar:" and everything from the "!/" to the end      String str = url.getFile();
     // to get the "real" URL inside  
     String url_string = url.toExternalForm();  
105    
106      int bang = url_string.indexOf ("!/");      int bang = str.indexOf ("!/");
107      if (bang == -1)      if (bang == -1)
108        throw new MalformedURLException (url + ": No `!/' in spec.");        throw new MalformedURLException (url + ": No `!/' in spec.");
109    
110      jarFileURL = new URL (url_string.substring (4, bang));      jarFileURL = new URL (str.substring (0, bang));
111      if (url_string.length() == (bang + 1))      entry_name = str.length() == (bang + 1) ? "" : str.substring (bang + 2);
       entry_name = "";  
     else  
       entry_name = url_string.substring (bang + 2);  
112    }    }
113    
114    /**    /**
# Line 153  public abstract class JarURLConnection e Line 143  public abstract class JarURLConnection e
143     */     */
144    public JarEntry getJarEntry () throws IOException    public JarEntry getJarEntry () throws IOException
145    {    {
146      if (jar_file == null)      JarFile file = getJarFile();
       jar_file = getJarFile();  
147    
148      return jar_file.getJarEntry(entry_name);      return file != null ? file.getJarEntry (entry_name) : null;
149    }    }
150    
151    /**    /**
# Line 218  public abstract class JarURLConnection e Line 207  public abstract class JarURLConnection e
207     */     */
208    public Manifest getManifest () throws IOException    public Manifest getManifest () throws IOException
209    {    {
210      if (jar_file == null)      JarFile file = getJarFile();
       jar_file = getJarFile();  
211    
212      return jar_file.getManifest();      return file != null ? file.getManifest() : null;
213    }    }
214  }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26