aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge
diff options
context:
space:
mode:
Diffstat (limited to 'netx/net/sourceforge')
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/CachePane.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java
index 4c97897..950dc36 100644
--- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java
+++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java
@@ -26,6 +26,10 @@ import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.channels.FileLock;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@@ -125,8 +129,25 @@ public class CachePane extends JPanel {
deleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
+ FileLock fl = null;
+ File netxRunningFile = new File(config.getProperty(DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE));
+ if (!netxRunningFile.exists()) {
+ try {
+ FileUtils.createParentDir(netxRunningFile);
+ FileUtils.createRestrictedFile(netxRunningFile, true);
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ try {
+ fl = FileUtils.getFileLock(netxRunningFile.getPath(), false, false);
+ } catch (FileNotFoundException e1) {
+ }
+
int row = cacheTable.getSelectedRow();
try {
+ if (fl == null) return;
if (row == -1 || row > cacheTable.getRowCount() - 1)
return;
int modelRow = cacheTable.convertRowIndexToModel(row);
@@ -141,6 +162,15 @@ public class CachePane extends JPanel {
} catch (Exception exception) {
//ignore
}
+
+ if (fl != null) {
+ try {
+ fl.release();
+ fl.channel().close();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
}
});
buttons.add(deleteButton);