diff options
author | Andrew Su <[email protected]> | 2011-03-17 15:10:32 -0400 |
---|---|---|
committer | Andrew Su <[email protected]> | 2011-03-17 15:10:32 -0400 |
commit | 8b14e30c2894902f33653ecac38332cb4bb84f11 (patch) | |
tree | 32c6b79f79916e6938b18fd597860dc4c7e63633 /netx/net/sourceforge/jnlp/cache/CacheUtil.java | |
parent | b57ac4af342f216974001abcbf8e132f3c7d0327 (diff) |
Ensure that javaws can not clear cache while plugin or javaws is running.
Diffstat (limited to 'netx/net/sourceforge/jnlp/cache/CacheUtil.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/cache/CacheUtil.java | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/netx/net/sourceforge/jnlp/cache/CacheUtil.java b/netx/net/sourceforge/jnlp/cache/CacheUtil.java index bb88325..4143738 100644 --- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java +++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java @@ -165,23 +165,20 @@ public class CacheUtil { try { if (otherJavawsRunning.isFile()) { FileOutputStream fis = new FileOutputStream(otherJavawsRunning); - try { - FileChannel channel = fis.getChannel(); - if (channel.tryLock() == null) { - if (JNLPRuntime.isDebug()) { - System.out.println("Other instances of netx are running"); - } - return false; - } - + + FileChannel channel = fis.getChannel(); + if (channel.tryLock() == null) { if (JNLPRuntime.isDebug()) { - System.out.println("No other instances of netx are running"); + System.out.println("Other instances of netx are running"); } - return true; + return false; + } - } finally { - fis.close(); + if (JNLPRuntime.isDebug()) { + System.out.println("No other instances of netx are running"); } + return true; + } else { if (JNLPRuntime.isDebug()) { System.out.println("No instance file found"); |