From: jprocter Date: Wed, 5 Sep 2012 14:23:28 +0000 (+0100) Subject: JAL-1162 catch security exception and just use bare modelFileName string for applet X-Git-Tag: Jalview_2_9~333 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=822cae4dcebdbf5bd5c42c740d8b5e4798bb6cdc;p=jalview.git JAL-1162 catch security exception and just use bare modelFileName string for applet --- 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)