8020060: MoleculeViewerTest demo doesn't work due to SecurityPermissions
authoralexsch
Mon, 09 Sep 2013 18:34:12 +0400
changeset 20116 af846cd89e6b
parent 20115 b17c025c01bf
child 20117 44caeeb854dd
8020060: MoleculeViewerTest demo doesn't work due to SecurityPermissions Reviewed-by: malenkov, erikj
jdk/makefiles/CompileDemos.gmk
jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java
jdk/src/share/demo/applets/MoleculeViewer/example1.html
jdk/src/share/demo/applets/MoleculeViewer/example2.html
jdk/src/share/demo/applets/MoleculeViewer/example3.html
jdk/src/share/demo/applets/WireFrame/ThreeD.java
jdk/src/share/demo/applets/WireFrame/example1.html
jdk/src/share/demo/applets/WireFrame/example2.html
jdk/src/share/demo/applets/WireFrame/example3.html
jdk/src/share/demo/applets/WireFrame/example4.html
--- a/jdk/makefiles/CompileDemos.gmk	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/makefiles/CompileDemos.gmk	Mon Sep 09 18:34:12 2013 +0400
@@ -65,14 +65,10 @@
 $(eval $(call SetupAppletDemo,DrawTest))
 $(eval $(call SetupAppletDemo,Fractal))
 $(eval $(call SetupAppletDemo,GraphicsTest))
-$(eval $(call SetupAppletDemo,MoleculeViewer))
 $(eval $(call SetupAppletDemo,NervousText))
 $(eval $(call SetupAppletDemo,SimpleGraph))
 $(eval $(call SetupAppletDemo,SortDemo))
 $(eval $(call SetupAppletDemo,SpreadSheet))
-# Build WireFrame without a server since it
-# has a class Matrix3D that also exists in MoleculeViewer.
-$(eval $(call SetupAppletDemo,WireFrame,true))
 
 ifndef OPENJDK
     $(eval $(call SetupAppletDemo,Animator,,closed/))
@@ -83,7 +79,7 @@
 
 ##################################################################################################
 
-PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf
+PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf .xyz .obj
 
 define SetupDemo
     # Param 1 = Name of the demo
@@ -161,6 +157,8 @@
 
 BUILD_DEMOS+=$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
 
+$(eval $(call SetupDemo,MoleculeViewer,applets,,XYZChemModel,,,example*.html XYZApp.java))
+$(eval $(call SetupDemo,WireFrame,applets,,ThreeD,,,example*.html ThreeD.java))
 $(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*))
 $(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt))
 $(eval $(call SetupDemo,Metalworks,jfc,,Metalworks,,,README*))
--- a/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java	Mon Sep 09 18:34:12 2013 +0400
@@ -348,7 +348,7 @@
         InputStream is = null;
         try {
             Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
-            is = new URL(getDocumentBase(), mdname).openStream();
+            is = getClass().getResourceAsStream(mdname);
             XYZChemModel m = new XYZChemModel(is);
             Atom.setApplet(this);
             md = m;
--- a/jdk/src/share/demo/applets/MoleculeViewer/example1.html	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example1.html	Mon Sep 09 18:34:12 2013 +0400
@@ -2,10 +2,10 @@
   <head>
       <title>MoleculeViewer (example 1)</title>
   </head>
-  <body> 
+  <body>
       <h1>MoleculeViewer (example 1)</h1>
       <hr>
-      <applet code=XYZApp.class width=300 height=300>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=300 height=300>
 	<param name=model value="models/HyaluronicAcid.xyz">
 	alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -13,7 +13,7 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
 
 
 
--- a/jdk/src/share/demo/applets/MoleculeViewer/example2.html	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example2.html	Mon Sep 09 18:34:12 2013 +0400
@@ -2,10 +2,10 @@
   <head>
       <title>MoleculeViewer (example 2)</title>
   </head>
-  <body> 
+  <body>
       <h1>MoleculeViewer (example 2)</h1>
       <hr>
-      <applet code=XYZApp.class width=300 height=300>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=300 height=300>
 	<param name=model value="models/buckminsterfullerine.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -13,4 +13,4 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
--- a/jdk/src/share/demo/applets/MoleculeViewer/example3.html	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example3.html	Mon Sep 09 18:34:12 2013 +0400
@@ -5,25 +5,25 @@
   <body>
       <h1>MoleculeViewer (example 3)</h1>
       <hr>
-      <applet code=XYZApp.class width=100 height=100>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	<param name=model value="models/water.xyz">
 	alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	Your browser is completely ignoring the &lt;APPLET&gt; tag!
       </applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
           <param name=model value="models/benzene.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
 	</applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	  <param name=model value="models/ethane.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
 	</applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	  <param name=model value="models/cyclohexane.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -31,5 +31,5 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
 
--- a/jdk/src/share/demo/applets/WireFrame/ThreeD.java	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/WireFrame/ThreeD.java	Mon Sep 09 18:34:12 2013 +0400
@@ -416,7 +416,7 @@
         InputStream is = null;
         try {
             Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
-            is = new URL(getDocumentBase(), mdname).openStream();
+            is = getClass().getResourceAsStream(mdname);
             Model3D m = new Model3D(is);
             md = m;
             m.findBB();
--- a/jdk/src/share/demo/applets/WireFrame/example1.html	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/WireFrame/example1.html	Mon Sep 09 18:34:12 2013 +0400
@@ -5,7 +5,7 @@
   <body>
     <h1>3D Model: Cube</h1>
       <hr>
-      <applet code=ThreeD.class width=100 height=100>
+      <applet code=ThreeD.class archive=WireFrame.jar width=100 height=100>
 	<param name=model value="models/cube.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example2.html	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/WireFrame/example2.html	Mon Sep 09 18:34:12 2013 +0400
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: Dinosaur</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/dinasaur.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example3.html	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/WireFrame/example3.html	Mon Sep 09 18:34:12 2013 +0400
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: Hughes</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/hughes_500.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example4.html	Mon Sep 09 17:14:51 2013 +0400
+++ b/jdk/src/share/demo/applets/WireFrame/example4.html	Mon Sep 09 18:34:12 2013 +0400
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: knoxS</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/knoxS.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!