comparison src/org/eclipse/jetty/util/resource/JarFileResource.java @ 820:8e9db0bbf4f9

remove org.eclipse.jetty.util.log and upgrade slf4j
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 13 Sep 2016 23:13:06 -0600
parents 3428c60d7cfc
children
comparison
equal deleted inserted replaced
819:17bd0b170ed6 820:8e9db0bbf4f9
27 import java.util.Enumeration; 27 import java.util.Enumeration;
28 import java.util.List; 28 import java.util.List;
29 import java.util.jar.JarEntry; 29 import java.util.jar.JarEntry;
30 import java.util.jar.JarFile; 30 import java.util.jar.JarFile;
31 31
32 import org.eclipse.jetty.util.log.Log; 32 import org.slf4j.Logger;
33 import org.eclipse.jetty.util.log.Logger; 33 import org.slf4j.LoggerFactory;
34 34
35 /* ------------------------------------------------------------ */ 35 /* ------------------------------------------------------------ */
36 class JarFileResource extends JarResource 36 class JarFileResource extends JarResource
37 { 37 {
38 private static final Logger LOG = Log.getLogger(JarFileResource.class); 38 private static final Logger LOG = LoggerFactory.getLogger(JarFileResource.class);
39 private JarFile _jarFile; 39 private JarFile _jarFile;
40 private File _file; 40 private File _file;
41 private String[] _list; 41 private String[] _list;
42 private JarEntry _entry; 42 private JarEntry _entry;
43 private boolean _directory; 43 private boolean _directory;
76 LOG.debug("Closing JarFile "+_jarFile.getName()); 76 LOG.debug("Closing JarFile "+_jarFile.getName());
77 _jarFile.close(); 77 _jarFile.close();
78 } 78 }
79 catch ( IOException ioe ) 79 catch ( IOException ioe )
80 { 80 {
81 LOG.ignore(ioe); 81 LOG.trace("",ioe);
82 } 82 }
83 } 83 }
84 } 84 }
85 _jarFile=null; 85 _jarFile=null;
86 super.release(); 86 super.release();
143 if (_urlString.endsWith("!/")) 143 if (_urlString.endsWith("!/"))
144 { 144 {
145 145
146 String file_url=_urlString.substring(4,_urlString.length()-2); 146 String file_url=_urlString.substring(4,_urlString.length()-2);
147 try{return newResource(file_url).exists();} 147 try{return newResource(file_url).exists();}
148 catch(Exception e) {LOG.ignore(e); return false;} 148 catch(Exception e) {LOG.trace("",e); return false;}
149 } 149 }
150 150
151 boolean check=checkConnection(); 151 boolean check=checkConnection();
152 152
153 // Is this a root URL? 153 // Is this a root URL?
173 c.setUseCaches(getUseCaches()); 173 c.setUseCaches(getUseCaches());
174 jarFile=c.getJarFile(); 174 jarFile=c.getJarFile();
175 } 175 }
176 catch(Exception e) 176 catch(Exception e)
177 { 177 {
178 LOG.ignore(e); 178 LOG.trace("",e);
179 } 179 }
180 } 180 }
181 181
182 // Do we need to look more closely? 182 // Do we need to look more closely?
183 if (jarFile!=null && _entry==null && !_directory) 183 if (jarFile!=null && _entry==null && !_directory)
219 { 219 {
220 _url=new URL(_urlString); 220 _url=new URL(_urlString);
221 } 221 }
222 catch(MalformedURLException ex) 222 catch(MalformedURLException ex)
223 { 223 {
224 LOG.warn(ex); 224 LOG.warn("",ex);
225 } 225 }
226 } 226 }
227 } 227 }
228 } 228 }
229 229
278 //As their sun.net.www.protocol.jar package caches JarFiles and/or connections, we can wind up in 278 //As their sun.net.www.protocol.jar package caches JarFiles and/or connections, we can wind up in
279 //the situation where the JarFile we have remembered in our _jarFile member has actually been closed 279 //the situation where the JarFile we have remembered in our _jarFile member has actually been closed
280 //by other code. 280 //by other code.
281 //So, do one retry to drop a connection and get a fresh JarFile 281 //So, do one retry to drop a connection and get a fresh JarFile
282 LOG.warn("Retrying list:"+e); 282 LOG.warn("Retrying list:"+e);
283 LOG.debug(e); 283 LOG.debug("",e);
284 release(); 284 release();
285 list = listEntries(); 285 list = listEntries();
286 } 286 }
287 287
288 if (list != null) 288 if (list != null)
312 } 312 }
313 catch(Exception e) 313 catch(Exception e)
314 { 314 {
315 315
316 e.printStackTrace(); 316 e.printStackTrace();
317 LOG.ignore(e); 317 LOG.trace("",e);
318 } 318 }
319 } 319 }
320 320
321 Enumeration<JarEntry> e=jarFile.entries(); 321 Enumeration<JarEntry> e=jarFile.entries();
322 String dir=_urlString.substring(_urlString.indexOf("!/")+2); 322 String dir=_urlString.substring(_urlString.indexOf("!/")+2);