From 822cae4dcebdbf5bd5c42c740d8b5e4798bb6cdc Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 5 Sep 2012 15:23:28 +0100 Subject: [PATCH] JAL-1162 catch security exception and just use bare modelFileName string for applet --- src/jalview/ext/jmol/JalviewJmolBinding.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 7f949c7..3f4f9f2 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -39,6 +39,7 @@ import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.io.File; import java.net.URL; +import java.security.AccessControlException; import java.util.Enumeration; import java.util.Hashtable; import java.util.Map; @@ -693,13 +694,25 @@ public abstract class JalviewJmolBinding implements StructureListener, String m=viewer.getModelFileName(0); if (m!=null) { - mset[0] = new File(m).getAbsolutePath(); + try { + mset[0] = new File(m).getAbsolutePath(); + } catch (AccessControlException x) { + // usually not allowed to do this in applet, so keep raw handle + mset[0] = m; + //System.err.println("jmolBinding: Using local file string from Jmol: "+m); + } } for (int i = 1; i < mset.length; i++) { m=viewer.getModelFileName(i); if (m!=null) { - mset[j] = new File(m).getAbsolutePath(); + try { + mset[j] = new File(m).getAbsolutePath(); + } catch (AccessControlException x) { + // usually not allowed to do this in applet, so keep raw handle + mset[j] = m; + //System.err.println("jmolBinding: Using local file string from Jmol: "+m); + } } _modelFileNameMap[j] = i; // record the model index for the filename // skip any additional models in the same file (NMR structures) -- 1.7.10.2