Security exception when running VisAD in a browser

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:

System.getProperty("textureWidthMax")

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: