Lines 274-281
Link Here
|
274 |
// find the cache |
274 |
// find the cache |
275 |
if( tldCache!= null && tldCache.exists()) { |
275 |
if( tldCache!= null && tldCache.exists()) { |
276 |
// just read it... |
276 |
// just read it... |
277 |
processCache(tldCache); |
277 |
if (processCache(tldCache)) |
278 |
return; |
278 |
return; |
279 |
} |
279 |
} |
280 |
} |
280 |
} |
281 |
|
281 |
|
Lines 290-297
Link Here
|
290 |
if (tldCache != null && tldCache.exists()) { |
290 |
if (tldCache != null && tldCache.exists()) { |
291 |
long lastModified = getLastModified(resourcePaths, jarPaths); |
291 |
long lastModified = getLastModified(resourcePaths, jarPaths); |
292 |
if (lastModified < tldCache.lastModified()) { |
292 |
if (lastModified < tldCache.lastModified()) { |
293 |
processCache(tldCache); |
293 |
if (processCache(tldCache)) |
294 |
return; |
294 |
return; |
295 |
} |
295 |
} |
296 |
} |
296 |
} |
297 |
|
297 |
|
Lines 316-328
Link Here
|
316 |
|
316 |
|
317 |
if( tldCache!= null ) { |
317 |
if( tldCache!= null ) { |
318 |
log.debug( "Saving tld cache: " + tldCache + " " + list.length); |
318 |
log.debug( "Saving tld cache: " + tldCache + " " + list.length); |
|
|
319 |
FileOutputStream out = null; |
319 |
try { |
320 |
try { |
320 |
FileOutputStream out=new FileOutputStream(tldCache); |
321 |
out=new FileOutputStream(tldCache); |
321 |
ObjectOutputStream oos=new ObjectOutputStream( out ); |
322 |
ObjectOutputStream oos=new ObjectOutputStream( out ); |
322 |
oos.writeObject( list ); |
323 |
oos.writeObject( list ); |
323 |
oos.close(); |
324 |
oos.close(); |
|
|
325 |
out = null; |
324 |
} catch( IOException ex ) { |
326 |
} catch( IOException ex ) { |
325 |
ex.printStackTrace(); |
327 |
log.warn(sm.getString("tldConfig.cache.write", context |
|
|
328 |
.getPath()), ex); |
329 |
} finally { |
330 |
if (out != null) { |
331 |
try { |
332 |
out.close(); |
333 |
} catch (Exception ignored) { |
334 |
// Do nothing |
335 |
} |
336 |
try { |
337 |
tldCache.delete(); |
338 |
} catch (Exception ignored) { |
339 |
// Do nothing |
340 |
} |
341 |
} |
326 |
} |
342 |
} |
327 |
} |
343 |
} |
328 |
|
344 |
|
Lines 385-394
Link Here
|
385 |
return lastModified; |
401 |
return lastModified; |
386 |
} |
402 |
} |
387 |
|
403 |
|
388 |
private void processCache(File tldCache ) throws IOException { |
404 |
private boolean processCache(File tldCache ) throws IOException { |
389 |
// read the cache and return; |
405 |
// read the cache and return; |
|
|
406 |
FileInputStream in = null; |
390 |
try { |
407 |
try { |
391 |
FileInputStream in=new FileInputStream(tldCache); |
408 |
in =new FileInputStream(tldCache); |
392 |
ObjectInputStream ois=new ObjectInputStream( in ); |
409 |
ObjectInputStream ois=new ObjectInputStream( in ); |
393 |
String list[]=(String [])ois.readObject(); |
410 |
String list[]=(String [])ois.readObject(); |
394 |
if( log.isDebugEnabled() ) |
411 |
if( log.isDebugEnabled() ) |
Lines 397-404
Link Here
|
397 |
context.addApplicationListener(list[i]); |
414 |
context.addApplicationListener(list[i]); |
398 |
} |
415 |
} |
399 |
ois.close(); |
416 |
ois.close(); |
400 |
} catch( ClassNotFoundException ex ) { |
417 |
in = null; |
401 |
ex.printStackTrace(); |
418 |
return true; |
|
|
419 |
} catch( Exception ex ) { |
420 |
log.warn(sm.getString("tldConfig.cache.read", context |
421 |
.getPath()), ex); |
422 |
return false; |
423 |
} finally { |
424 |
if (in != null) { |
425 |
try { |
426 |
in.close(); |
427 |
} catch (Exception ignored) { |
428 |
// Do nothing |
429 |
} |
430 |
try { |
431 |
tldCache.delete(); |
432 |
} catch (Exception ignored) { |
433 |
// Do nothing |
434 |
} |
435 |
} |
402 |
} |
436 |
} |
403 |
} |
437 |
} |
404 |
|
438 |
|