Re: Security exception when running VisAD in a browser

Hi JR,

It looks like untrusted code can't get user-defined properties, so I've added a try/catch around the getProperties. The only problem
is that older versions of Java3D don't offer the ability to query
textureWidthMax, so the getProperties was a way for the user to
experiment and define the limit.  If this limit is exceeded by the
data, images may appear gray.  The default limit is 1024 which
seems ok with most graphics cards now.


JR Schmidt wrote:

I have discovered a problem (and solution) when running a VisAD applet in a web browser. I have created a Java applet / application (it runs as both), where I create a JFrame, insert a JPanel, and then insert a VisAD display render into the panel.

This works fantastic when running as an application, but generates a security exception (at least under Windows, Sun JDK 1.5) when the resulting VisADCanvasJ3D calls:


in its makeConfig() method. The exception is a PropertyAccess exception; evidently applets are not allowed access to that particular property.

The solution is simple: simply add a try / catch around this statement. The code already handles the case where getProperty returns null, so catching the resulting exception is all that is required. After that, the applet runs great in the browser!

Unfortunately, this method requires modifying the VisAD code. If this changes makes it (soon) into an official release, that would be great. Otherwise, I would be open to suggestions that don't require modifying the VisAD source code. (Deriving a sub-class of VisADCanvas3D didn't seem like a plausible solution, since the makeConfig() method is declared private, and thus I can't override it.)

   JR Schmidt

  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: