You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2006/03/24 08:50:06 UTC

svn commit: r388441 [1/2] - in /xmlgraphics/batik/trunk: ./ lib/ resources/META-INF/services/ resources/org/apache/batik/apps/svgbrowser/resources/ resources/org/apache/batik/apps/svgpp/resources/ sources/org/apache/batik/apps/svgbrowser/ sources/org/a...

Author: cam
Date: Thu Mar 23 23:50:03 2006
New Revision: 388441

URL: http://svn.apache.org/viewcvs?rev=388441&view=rev
Log:
1. Update Rhino to CVS version post 1.6R2, with some modifications,
   fixing some memory leaks from Java class caching.
2. Various updates of "xml.apache.org" to "xmlgraphics.apache.org"
   in docs and code.

Modified:
    xmlgraphics/batik/trunk/MAINTAIN
    xmlgraphics/batik/trunk/README
    xmlgraphics/batik/trunk/build.xml
    xmlgraphics/batik/trunk/lib/LICENSE.js.txt
    xmlgraphics/batik/trunk/lib/README.js.txt
    xmlgraphics/batik/trunk/lib/README.pdf-transcoder.txt
    xmlgraphics/batik/trunk/lib/js.jar
    xmlgraphics/batik/trunk/resources/META-INF/services/org.apache.batik.script.InterpreterFactory
    xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/Main.properties
    xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/StatusBarMessages.properties
    xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/squiggle.xsl
    xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgpp/resources/Messages.properties
    xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/color/NamedProfileCache.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/URLImageCache.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/Interpreter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/InterpreterException.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/jacl/JaclInterpreter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/jpython/JPythonInterpreter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/BatikSecurityController.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/EventTargetWrapper.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/RhinoClassShutter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/RhinoInterpreter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/WindowWrapper.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/svg12/GlobalWrapper.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/swing/svg/AbstractJSVGComponent.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/util/Service.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/util/SoftReferenceCache.java
    xmlgraphics/batik/trunk/xdocs/faq.xml
    xmlgraphics/batik/trunk/xdocs/images/splash.xsl
    xmlgraphics/batik/trunk/xdocs/index.xml
    xmlgraphics/batik/trunk/xdocs/pr.xml
    xmlgraphics/batik/trunk/xdocs/skins/printer/stylesheets/changes2document.xsl
    xmlgraphics/batik/trunk/xdocs/skins/xml.apache.org/stylesheets/changes2document.xsl
    xmlgraphics/batik/trunk/xdocs/svgrasterizer.xml
    xmlgraphics/batik/trunk/xdocs/whoAreWe.xml

Modified: xmlgraphics/batik/trunk/MAINTAIN
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/MAINTAIN?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/MAINTAIN (original)
+++ xmlgraphics/batik/trunk/MAINTAIN Thu Mar 23 23:50:03 2006
@@ -3,7 +3,8 @@
                          -------------------------
                      
 This document introduces newcomers to the management and maintenance of 
-the Batik project hosted under xml.apache.org (http://xml.apache.org/batik).
+the Batik project hosted under xmlgraphics.apache.org
+(http://xmlgraphics.apache.org/batik).
 
 Each project is required to use Ant as build tool and to be coherent with the
 rest of the build systems of the other projects, so that nightly builds and
@@ -27,12 +28,12 @@
     Batik if it isn't already there.  The following link has the
     details on what this means and how to do it.
 
-        http://nagoya.apache.org/wiki/apachewiki.cgi?SigningReleases
+        http://wiki.apache.org/old/SigningReleases
 
  3) Update the splash screens:
     build splash
 
- 4) Commit these changes to CVS, in general only the following files
+ 4) Commit these changes to SVN, in general only the following files
     should be modified:
 
     build.xml
@@ -41,18 +42,18 @@
     xdocs/images/splash.svg
     resources/org/apache/batik/apps/svgbrowser/resources/squiggle.png
 
- 5) tag the release on CVS:
-      cvs rtag <tag> <module>
-      e.g., cvs rtag batik-1_1rc3 xml-batik. 
+ 5) tag the release on SVN:
+      svn copy http://svn.apache.org/repos/asf/xmlgraphics/batik/trunk \
+               http://svn.apache.org/repos/asf/xmlgraphics/batik/tags/<tag>
+    where <tag> is the version name, e.g. "batik-1_1rc3".
+
     Note: sometimes, it is necessary to remove a tag because the 
     tests failed and a fix was required. To remove a tag, use
-    the rtag command:
-      cvs rtag -d <tag> <module>
-      e.g., cvs rtag -d batik-1_1rc3 xml-batik
+    the delete command:
+      svn delete http://svn.apache.org/repos/asfk/xmlgraphics/batik/tags/<tag>
 
  6) checkout the tagged release to a new directory:
-      cvs co -r <tag> xml-batik
-      e.g., cvs co -r batik-1_1rc3 xml-batik
+      svn co http://svn.apache.org/repos/asfk/xmlgraphics/batik/tags/<tag>
 
  7) run the build script with target "dist-zip"
       build dist-zip 
@@ -76,7 +77,7 @@
 
  9) Update the README file describing the content of the release and
     the modifications which have taken place:
-    http://xml.apache.org/batik/dist/README 
+    http://www.apache.org/dist/xml/batik/README
 
 10) If you are creating a release candidate, rename the distribution files
     to an rc name. For example:
@@ -86,7 +87,7 @@
     has full details on how to sign things (if you don't want to know
     anything the last section 'Using GPG' tells you what commands work).
 
-        http://nagoya.apache.org/wiki/apachewiki.cgi?SigningReleases
+        http://wiki.apache.org/old/SigningReleases
 
     e.g. gpg --detach-sig --armor --output batik-1.5.zip.asc batik-1.5.zip
          md5 batik-1.5.zip > batik-1.5.zip.md5
@@ -95,17 +96,17 @@
     files), the README, and the KEYS file under 
         /www/www.apache.org/dist/xml/batik/
 
-     e.g., 'scp batik-1.1rc1.zip* vhardy@xml.apache.org:/www/www.apache.org/dist/xml/batik/'
+     e.g., 'scp batik-1.1rc1.zip* vhardy@xmlgraphics.apache.org:/www/www.apache.org/dist/xml/batik/'
 
 11) Finish setting up the distribution directory in accordance with:
 
       http://www.apache.org/dev/mirrors.html
-      http://cvs.apache.org/~bodewig/mirror.html
+      http://people.apache.org/~bodewig/mirror.html
     
     This makes sure that the distribution is mirrored nicely around
     the world.
 
-    Start by logging into cvs.apache.org (e.g. 'ssh vhardy@cvs.apache.org').
+    Start by logging into svn.apache.org (e.g. 'ssh vhardy@svn.apache.org').
 
     First make sure file permissions are correct.  The
     new files should be owned by group 'xml' and be group writable.

Modified: xmlgraphics/batik/trunk/README
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/README?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/README (original)
+++ xmlgraphics/batik/trunk/README Thu Mar 23 23:50:03 2006
@@ -37,7 +37,7 @@
   ------------
 
   The home page for the Apache Batik project can be found in the Apache XML 
-  Project web site (http://xml.apache.org/batik/). There you also find 
+  Project web site (http://xmlgraphics.apache.org/batik/). There you also find 
   information on how to download the latest release as well as all the other 
   information you might need regarding this project.
 
@@ -53,15 +53,17 @@
   By default, Batik includes a scripting engine for ECMAScript. It is possible
   to add support for additional scripting languages (Python and TCL)
   
-  See : http://xml.apache.org/batik/install.html#optionalComponents for details.
+  See http://xmlgraphics.apache.org/batik/install.html#optionalComponents for
+  details.
  
   Installation Instructions and Documentation
   -------------------------------------------
 
-  Read the Install page at http://xml.apache.org/batik for the installation instructions.
+  Read the Install page at http://xmlgraphics.apache.org/batik for the
+  installation instructions.
 
   Look for the most updated documentation on the Apache Batik web site under
-  the Apache XML Project (http://xml.apache.org/batik/).
+  the Apache XML Project (http://xmlgraphics.apache.org/batik/).
 
 
   Licensing and legal issues
@@ -71,5 +73,5 @@
 
   Thanks for using Apache Batik.
 
-                                           The Apache XML Project
-                                           http://xml.apache.org/
+                                           The Apache XML Graphics Project
+                                           http://xmlgraphics.apache.org/

Modified: xmlgraphics/batik/trunk/build.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/build.xml?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/build.xml (original)
+++ xmlgraphics/batik/trunk/build.xml Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 <!--
 
-   Copyright 2000-2005  The Apache Software Foundation 
+   Copyright 2000-2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -566,7 +566,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik Java Bean"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
       <fileset dir="${dest}">
         <include name="org/w3c/**"/>
@@ -878,7 +878,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik XML Pretty Printer"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
       <fileset dir="${dest}">
         <include name="${package-prefix}/apps/svgpp/**/*.class"/>
@@ -896,7 +896,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik SVG Slide Show Tool"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
       <fileset dir="${dest}">
         <include name="${package-prefix}/apps/slideshow/**/*.class"/>
@@ -919,7 +919,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik Squiggle Viewer"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
       <fileset dir="${dest}">
         <include name="${package-prefix}/apps/svgbrowser/**/*.class"/>
@@ -944,7 +944,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik Squiggle Viewer With Extensions"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
         <fileset dir="${resources}" excludes="**/.svn/">
             <include name="META-INF/services/**"/>
@@ -966,7 +966,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik SVG Rasterizer"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
       <fileset dir="${dest}">
         <include name="${package-prefix}/apps/rasterizer/**/*.class"/>
@@ -988,7 +988,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik SVG Rasterizer With Extensions"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
         <fileset dir="${resources}" excludes="**/.svn/">
             <include name="META-INF/services/**"/>
@@ -1003,7 +1003,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik TrueType to SVG Font Converter"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
       <fileset dir="${dest}">
         <include name="${package-prefix}/apps/ttf2svg/**/*.class"/>
@@ -1018,7 +1018,7 @@
       <manifest>
         <attribute name="Implementation-Title" value="Batik All Jar"/>
         <attribute name="Implementation-Version" value="${version}${revisionType}${revisionNumber}"/>
-        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/batik/)"/>
+        <attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xmlgraphics.apache.org/batik/)"/>
       </manifest>
     </jar>
   </target>

Modified: xmlgraphics/batik/trunk/lib/LICENSE.js.txt
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/lib/LICENSE.js.txt?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/lib/LICENSE.js.txt (original)
+++ xmlgraphics/batik/trunk/lib/LICENSE.js.txt Thu Mar 23 23:50:03 2006
@@ -1,10 +1,20 @@
+This distribution includes a binary distribution of Mozilla Rhino compiled
+from CVS code (post 1.6R2) as at March 24, 2006, with modifications.
 
-This distribution includes the Mozilla Rhino 1.5 release 4.1 binary
-distribution without code modifications.
-You can also get that distribution from the following URL:
-ftp://ftp.mozilla.org/pub/js/
 Source code for Rhino is available on Mozilla web site:
-http://www.mozilla.org/rhino
+
+  http://www.mozilla.org/rhino
+
+The CVS code on which the included distribution of Rhino is based can be
+retrieved by running:
+
+  CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot cvs checkout \
+  	-D 2006-03-24 mozilla/js/rhino
+
+The modifications made to the code are available in the form of a patch at:
+
+  https://bugzilla.mozilla.org/attachment.cgi?id=214133
+
 Rhino is licensed under the NPL (Netscape Public License) which 
 is duplicated below.
 
@@ -13,7 +23,7 @@
   org.mozilla.javascript.tools.debugger.downloaded.JTreeTable.java
   org.mozilla.javascript.tools.debugger.downloaded.TreeTableModel.java
   org.mozilla.javascript.tools.debugger.downloaded.TreeTableModelAdapter.java
-Which comes from:
+Which come from:
   http://java.sun.com/products/jfc/tsc/articles/treetable2
 
 Under the following license:

Modified: xmlgraphics/batik/trunk/lib/README.js.txt
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/lib/README.js.txt?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/lib/README.js.txt (original)
+++ xmlgraphics/batik/trunk/lib/README.js.txt Thu Mar 23 23:50:03 2006
@@ -1,9 +1,19 @@
-This distribution includes the Mozilla Rhino 1.5 release 4.1 binary
-distribution without code modifications.
-You can also get that distribution from the following URL:
-ftp://ftp.mozilla.org/pub/js/
+This distribution includes a binary distribution of Mozilla Rhino compiled
+from CVS code (post 1.6R2) as at March 24, 2006, with modifications.
+
 Source code for Rhino is available on Mozilla web site:
-http://www.mozilla.org/rhino
+
+  http://www.mozilla.org/rhino
+
+The CVS code on which the included distribution of Rhino is based can be
+retrieved by running:
+
+  CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot cvs checkout \
+  	-D 2006-03-24 mozilla/js/rhino
+
+The modifications made to the code are available in the form of a patch at:
+
+  https://bugzilla.mozilla.org/attachment.cgi?id=214133
+
 Rhino is licensed under the NPL (Netscape Public License) which 
 is in the LICENSE.js.txt file
-

Modified: xmlgraphics/batik/trunk/lib/README.pdf-transcoder.txt
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/lib/README.pdf-transcoder.txt?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/lib/README.pdf-transcoder.txt (original)
+++ xmlgraphics/batik/trunk/lib/README.pdf-transcoder.txt Thu Mar 23 23:50:03 2006
@@ -1,5 +1,5 @@
 The pdf-transcoder.jar file from the Apache Fop project
-(http://xml.apache.org/fop), this is only needed if you want to
+(http://xmlgraphics.apache.org/fop), this is only needed if you want to
 transcode to PDF, otherwise it can be removed from distributions.
 
 This jar file is slightly modified from the standard

Modified: xmlgraphics/batik/trunk/lib/js.jar
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/lib/js.jar?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
Binary files - no diff available.

Modified: xmlgraphics/batik/trunk/resources/META-INF/services/org.apache.batik.script.InterpreterFactory
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/resources/META-INF/services/org.apache.batik.script.InterpreterFactory?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/resources/META-INF/services/org.apache.batik.script.InterpreterFactory (original)
+++ xmlgraphics/batik/trunk/resources/META-INF/services/org.apache.batik.script.InterpreterFactory Thu Mar 23 23:50:03 2006
@@ -1,5 +1,5 @@
 #############################################################################
-#    Copyright 2004  The Apache Software Foundation 
+#    Copyright 2004,2006  The Apache Software Foundation 
 # 
 #    Licensed under the Apache License, Version 2.0 (the "License");
 #    you may not use this file except in compliance with the License.
@@ -22,4 +22,4 @@
 # TCL
 #org.apache.batik.script.jacl.JaclInterpreterFactory
 # Python
-#org.apache.batik.script.jacl.JPythonInterpreterFactory
+#org.apache.batik.script.jpython.JPythonInterpreterFactory

Modified: xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/Main.properties
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/Main.properties?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/Main.properties (original)
+++ xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/Main.properties Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-#   Copyright 2001-2002  The Apache Software Foundation 
+#   Copyright 2001-2002,2006  The Apache Software Foundation 
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@
 Command.header = \
 \n\
 \tSquiggle SVG browser - (C) Apache Software Foundation      \n\
-\t\thttp://xml.apache.org/batik\n
+\t\thttp://xmlgraphics.apache.org/batik\n
 
 Command.syntax = \
 Syntax:\n\

Modified: xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/StatusBarMessages.properties
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/StatusBarMessages.properties?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/StatusBarMessages.properties (original)
+++ xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/StatusBarMessages.properties Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-#   Copyright 2001  The Apache Software Foundation 
+#   Copyright 2001,2006  The Apache Software Foundation 
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
 # $Id$
 #
 
-Panel.default_message = Batik SVG Browser - xml.apache.org/batik
+Panel.default_message = Batik SVG Browser - xmlgraphics.apache.org/batik
 
 Position.width_letters = w:
 Position.height_letters = h:

Modified: xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/squiggle.xsl
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/squiggle.xsl?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/squiggle.xsl (original)
+++ xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgbrowser/resources/squiggle.xsl Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 <?xml version="1.0" standalone="no"?>
 <!-- ====================================================================== 
-     Copyright 2002,2004 The Apache Software Foundation
+     Copyright 2002,2004,2006  The Apache Software Foundation
      
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
@@ -101,7 +101,7 @@
            >squiggle</tspan></text>
           <text font-size="17" x="246" y="115"><tspan
           >Built with the Batik SVG toolkit</tspan
-          ><tspan dy="1em" x="246">http://xml.apache.org/batik</tspan></text>
+          ><tspan dy="1em" x="246">http://xmlgraphics.apache.org/batik</tspan></text>
           <text x="487" y="140" text-anchor="end" font-size="16" 
             fill="red"><xsl:value-of select="$version" />
           <xsl:if test="$revisionType != 'revisionType'">

Modified: xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgpp/resources/Messages.properties
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgpp/resources/Messages.properties?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgpp/resources/Messages.properties (original)
+++ xmlgraphics/batik/trunk/resources/org/apache/batik/apps/svgpp/resources/Messages.properties Thu Mar 23 23:50:03 2006
@@ -1,5 +1,5 @@
 # 
-# Copyright 2001-2003  The Apache Software Foundation 
+# Copyright 2001-2003,2006  The Apache Software Foundation 
 # 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
 header = \
 \n\
 \tSVG pretty-printer - (C) Apache Software Foundation      \n\
-\t\thttp://xml.apache.org/batik\n
+\t\thttp://xmlgraphics.apache.org/batik\n
 
 syntax = \
 Syntax:\n\

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2001-2004  The Apache Software Foundation 
+   Copyright 2001-2004,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -102,6 +102,7 @@
 import org.apache.batik.dom.util.HashTable;
 import org.apache.batik.dom.util.DOMUtilities;
 import org.apache.batik.ext.swing.JAffineTransformChooser;
+import org.apache.batik.script.rhino.RhinoInterpreter;
 import org.apache.batik.swing.JSVGCanvas;
 import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
 import org.apache.batik.swing.gvt.GVTTreeRendererListener;
@@ -140,7 +141,7 @@
 import org.apache.batik.util.gui.resource.ToolBarFactory;
 import org.apache.batik.xml.XMLUtilities;
 import org.mozilla.javascript.Context;
-import org.mozilla.javascript.ContextListener;
+import org.mozilla.javascript.ContextFactory;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.css.ViewCSS;
@@ -164,10 +165,11 @@
 
     static private String EOL;
     static {
-        String  temp;
-        try { temp = System.getProperty ("line.separator", "\n"); }
-        catch (SecurityException e) { temp = "\n"; }
-        EOL = temp;
+        try {
+            EOL = System.getProperty("line.separator", "\n");
+        } catch (SecurityException e) {
+            EOL = "\n";
+        }
     }
 
     /**
@@ -184,97 +186,10 @@
         = "java.util.logging.LoggingPermission";
 
     static {
-        Class cl = null;
         try {
-            cl = Class.forName(JDK_1_4_PRESENCE_TEST_CLASS);
-        } catch (ClassNotFoundException e){
-        }
-
-        if (cl != null) {
+            Class.forName(JDK_1_4_PRESENCE_TEST_CLASS);
             priorJDK1_4 = false;
-        }
-    }
-
-    static JFrame debuggerFrame = null;
-    static Class  debuggerClass = null;
-    static Method clearAllBreakpoints = null;
-    static Method scriptGo = null;
-    static Method setExitAction = null;
-    static {
-        try {
-            debuggerClass = JSVGViewerFrame.class.getClassLoader().loadClass
-                ("org.mozilla.javascript.tools.debugger.Main");
-            clearAllBreakpoints = debuggerClass.getMethod
-                ("clearAllBreakpoints", (Class[])null);
-            scriptGo = debuggerClass.getMethod("go", (Class[])null);
-            setExitAction = debuggerClass.getMethod
-                ("setExitAction", new Class[] {Runnable.class});
-        } catch (ThreadDeath td) {
-            debuggerClass = null;
-            clearAllBreakpoints = null;
-            scriptGo = null;
-            setExitAction = null;
-            throw td;
-        } catch (Throwable t) {
-            debuggerClass = null;
-            clearAllBreakpoints = null;
-            scriptGo = null;
-            setExitAction = null;
-        }
-    }
-
-    public static void showDebugger() {
-        if (debuggerClass == null) return;
-        if (debuggerFrame == null) {
-            try {
-                Constructor c = debuggerClass.getConstructor
-                    (new Class [] { String.class });
-                debuggerFrame = (JFrame)c.newInstance
-                    (new Object[] { "Rhino JavaScript Debugger" });
-                // Customize the menubar a bit, disable menu
-                // items that can't be used and change 'Exit' to 'Close'.
-                JMenuBar menuBar = debuggerFrame.getJMenuBar();
-                JMenu    menu    = menuBar.getMenu(0);
-                menu.getItem(0).setEnabled(false); // Open...
-                menu.getItem(1).setEnabled(false); // Run...
-                menu.getItem(3).setText
-                    (Resources.getString("Close.text")); // Exit -> "Close"
-                menu.getItem(3).setAccelerator
-                    (KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK));
-
-                debuggerFrame.setSize(600, 460);
-                debuggerFrame.pack();
-                WindowAdapter wa = new WindowAdapter() {
-                        public void windowClosing(WindowEvent e) {
-                            hideDebugger();
-                        }};
-                setExitAction.invoke(debuggerFrame, 
-                                     new Object [] { new Runnable() {
-                                             public void run() {
-                                                 hideDebugger();
-                                             }}});
-                debuggerFrame.addWindowListener(wa);
-            } catch (Exception ex) {
-                ex.printStackTrace();
-                return;
-            }
-        }
-        if (debuggerFrame != null) {
-            debuggerFrame.setVisible(true);
-            Context.addContextListener((ContextListener)debuggerFrame);
-        }
-    }
-
-    public static void hideDebugger() {
-        if (debuggerFrame == null)
-            return;
-        Context.removeContextListener((ContextListener)debuggerFrame);
-        debuggerFrame.setVisible(false);
-        try {
-            clearAllBreakpoints.invoke(debuggerFrame, (Object[])null);
-            scriptGo.invoke(debuggerFrame, (Object[])null);
-        } catch (Exception ex) {
-            ex.printStackTrace();
+        } catch (ClassNotFoundException e) {
         }
     }
 
@@ -382,7 +297,32 @@
     /**
      * The JSVGCanvas.
      */
-    protected JSVGCanvas svgCanvas;
+    protected Canvas svgCanvas;
+
+    /**
+     * An extension of JSVGCanvas that exposes the Rhino interpreter.
+     */
+    protected static class Canvas extends JSVGCanvas {
+
+        /**
+         * Creates a new Canvas.
+         */
+        public Canvas(SVGUserAgent ua, boolean eventsEnabled,
+                      boolean selectableText) {
+            super(ua, eventsEnabled, selectableText);
+        }
+
+        /**
+         * Returns the Rhino interpreter for this canvas.
+         */
+        public RhinoInterpreter getRhinoInterpreter() {
+            if (bridgeContext == null) {
+                return null;
+            }
+            return (RhinoInterpreter)
+                bridgeContext.getInterpreter("text/ecmascript");
+        }
+    }
 
     /**
      * The panel where the svgCanvas is displayed
@@ -533,6 +473,11 @@
     protected String alternateStyleSheet;
 
     /**
+     * The debugger object.
+     */
+    protected Debugger debugger;
+
+    /**
      * Creates a new SVG viewer frame.
      */
     public JSVGViewerFrame(Application app) {
@@ -549,7 +494,7 @@
         // bigger than the screen does not cause the creation
         // of unnecessary large images.
         //
-        svgCanvas = new JSVGCanvas(userAgent, true, true){
+        svgCanvas = new Canvas(userAgent, true, true) {
                 Dimension screenSize;
                 
                 {
@@ -834,13 +779,13 @@
                 showSVGDocument(st);
             }
         });
-
     }
 
     /**
      * Call dispose on canvas as well.
      */
     public void dispose() {
+        hideDebugger();
         svgCanvas.dispose();
         super.dispose();
     }
@@ -877,6 +822,84 @@
     }
 
     /**
+     * Shows the Rhino debugger.
+     */
+    public void showDebugger() {
+        if (debugger == null) {
+            debugger = new Debugger(locationBar.getText());
+            debugger.initialize();
+        }
+    }
+
+    /**
+     * Hides and destroys the Rhino debugger.
+     */
+    public void hideDebugger() {
+        if (debugger != null) {
+            debugger.clearAllBreakpoints();
+            debugger.go();
+            debugger.dispose();
+            debugger = null;
+        }
+    }
+
+    /**
+     * Rhino debugger class.
+     */
+    protected class Debugger
+        extends org.mozilla.javascript.tools.debugger.Main {
+
+        /**
+         * Creates a new Debugger.
+         */
+        public Debugger(String url) {
+            super("JavaScript Debugger - " + url);
+        }
+
+        /**
+         * Sets the document URL to use in the window title.
+         */
+        public void setDocumentURL(String url) {
+            debugGui.setTitle("JavaScript Debugger - " + url);
+        }
+
+        /**
+         * Initializes the debugger by massaging the GUI and attaching it
+         * to the Rhino interpreter's {@link ContextFactory}.
+         */
+        public void initialize() {
+            // Customize the menubar a bit, disable menu
+            // items that can't be used and change 'Exit' to 'Close'.
+            JMenuBar menuBar = debugGui.getJMenuBar();
+            JMenu    menu    = menuBar.getMenu(0);
+            menu.getItem(0).setEnabled(false); // Open...
+            menu.getItem(1).setEnabled(false); // Run...
+            menu.getItem(3).setText
+                (Resources.getString("Close.text")); // Exit -> "Close"
+            menu.getItem(3).setAccelerator
+                (KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK));
+
+            debugGui.setSize(600, 460);
+            debugGui.pack();
+            setExitAction(new Runnable() {
+                    public void run() {
+                        hideDebugger();
+                    }});
+            WindowAdapter wa = new WindowAdapter() {
+                    public void windowClosing(WindowEvent e) {
+                        hideDebugger();
+                    }};
+            debugGui.addWindowListener(wa);
+            setVisible(true);
+            RhinoInterpreter interpreter = svgCanvas.getRhinoInterpreter();
+            if (interpreter != null) {
+                ContextFactory contextFactory = interpreter.getContextFactory();
+                attachTo(contextFactory);
+            }
+        }
+    }
+
+    /**
      * To show the about dialog
      */
     public class AboutAction extends AbstractAction {
@@ -1630,19 +1653,14 @@
     public class ToggleDebuggerAction extends AbstractAction {
         public ToggleDebuggerAction() {
             super("Toggle Debugger Action");
-            if (debuggerClass == null)
-                setEnabled(false);
         }
 
         public void actionPerformed(ActionEvent e) {
-            if (debuggerClass == null) {
-                setEnabled(false);
-                return;
-            }
-            if ((debuggerFrame == null) || !debuggerFrame.isShowing())
+            if (debugger == null) {
                 showDebugger();
-            else
+            } else {
                 hideDebugger();
+            }
         }
     }
 
@@ -2051,6 +2069,10 @@
         svgCanvas.setCursor(DEFAULT_CURSOR);
         String s = svgDocumentURL;
         locationBar.setText(s);
+        if (debugger != null) {
+            debugger.detach();
+            debugger.setDocumentURL(s);
+        }
         if (title == null) {
             title = getTitle();
         }
@@ -2147,6 +2169,10 @@
         svgCanvas.setSelectionOverlayXORMode
             (application.isSelectionOverlayXORMode());
         svgCanvas.requestFocus();  // request focus when load completes.
+        if (debugger != null) {
+            RhinoInterpreter interpreter = svgCanvas.getRhinoInterpreter();
+            debugger.attachTo(interpreter.getContextFactory());
+        }
     }
 
     /**
@@ -2339,6 +2365,10 @@
             if (s.indexOf("#") != -1) {
                 localHistory.update(s);
                 locationBar.setText(s);
+                if (debugger != null) {
+                    debugger.detach();
+                    debugger.setDocumentURL(s);
+                }
                 application.addVisitedURI(s);
                 backAction.update();
                 forwardAction.update();
@@ -2803,5 +2833,4 @@
             return extension;
         }
     }
-
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/color/NamedProfileCache.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/color/NamedProfileCache.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/color/NamedProfileCache.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/color/NamedProfileCache.java Thu Mar 23 23:50:03 2006
@@ -27,8 +27,7 @@
  * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  * @version $Id$
  */
-
-public class NamedProfileCache extends SoftReferenceCache{
+public class NamedProfileCache extends SoftReferenceCache {
 
     static NamedProfileCache theCache = new NamedProfileCache();
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/URLImageCache.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/URLImageCache.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/URLImageCache.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/URLImageCache.java Thu Mar 23 23:50:03 2006
@@ -24,16 +24,22 @@
 
 /**
  * This class manages a cache of soft references to Images that
- * we have already loaded.  Adding an image is two fold.
- * First you add the ParsedURL, this lets the cache know that someone is
- * working on this ParsedURL.  Then when the completed RenderedImage is
- * ready you put it into the cache.<P>
+ * we have already loaded.
  *
- * If someone requests a ParsedURL after it has been added but before it has
- * been put they will be blocked until the put.
+ * <p>
+ *   Adding an image is two fold. First you add the ParsedURL, this lets
+ *   the cache know that someone is working on this ParsedURL.  Then when
+ *   the completed RenderedImage is ready you put it into the cache.
+ * </p>
+ * <p>
+ *   If someone requests a ParsedURL after it has been added but before it has
+ *   been put they will be blocked until the put.
+ * </p>
+ *
+ * @author <a href="mailto:thomas.deweese@kodak.com">Thomas DeWeese</a>
+ * @version $Id$
  */
-
-public class URLImageCache extends SoftReferenceCache{
+public class URLImageCache extends SoftReferenceCache {
 
     static URLImageCache theCache = new URLImageCache();
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/script/Interpreter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/script/Interpreter.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/script/Interpreter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/script/Interpreter.java Thu Mar 23 23:50:03 2006
@@ -29,6 +29,7 @@
  * @version $Id$
  */
 public interface Interpreter extends org.apache.batik.i18n.Localizable {
+
     /**
      * This method should evaluate a piece of script associated to a given 
      * description.
@@ -39,7 +40,7 @@
      * @return if no exception is thrown during the call, should return the
      * value of the last expression evaluated in the script
      */
-    public Object evaluate(Reader scriptreader, String description)
+    Object evaluate(Reader scriptreader, String description)
         throws InterpreterException, IOException;
 
     /**
@@ -49,7 +50,7 @@
      * @return if no exception is thrown during the call, should return the
      * value of the last expression evaluated in the script
      */
-    public Object evaluate(Reader scriptreader)
+    Object evaluate(Reader scriptreader)
         throws InterpreterException, IOException;
 
     /**
@@ -61,7 +62,7 @@
      * @return if no exception is thrown during the call, should return the
      * value of the last expression evaluated in the script
      */
-    public Object evaluate(String script)
+    Object evaluate(String script)
         throws InterpreterException;
 
     /**
@@ -71,7 +72,7 @@
      * @param name the name of the script object to create
      * @param object the Java object
      */
-    public void bindObject(String name, Object object);
+    void bindObject(String name, Object object);
 
     /**
      * This method should change the output <code>Writer</code> that will be
@@ -79,12 +80,12 @@
      *
      * @param output the new out <code>Writer</code>.
      */
-    public void setOut(Writer output);
+    void setOut(Writer output);
 
     /**
      * This method can dispose resources used by the interpreter when it is
      * no longer used. Be careful, you SHOULD NOT use this interpreter instance
      * after calling this method.
      */
-    public void dispose();
+    void dispose();
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/script/InterpreterException.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/script/InterpreterException.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/script/InterpreterException.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/script/InterpreterException.java Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2000-2001  The Apache Software Foundation 
+   Copyright 2000-2001,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -20,12 +20,13 @@
 /**
  * An exception that will be thrown when a problem is encountered in the
  * script by an <code>Interpreter</code> interface implementation.
+ *
  * @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
  * @version $Id$
  */
-public class InterpreterException extends Exception {
-    private int line = -1; // -1 when unknow
-    private int column = -1; // -1 when unknow
+public class InterpreterException extends RuntimeException {
+    private int line = -1; // -1 when unknown
+    private int column = -1; // -1 when unknown
     private Exception embedded = null; // null when unknown
 
     /**

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/script/jacl/JaclInterpreter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/script/jacl/JaclInterpreter.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/script/jacl/JaclInterpreter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/script/jacl/JaclInterpreter.java Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2001-2003  The Apache Software Foundation 
+   Copyright 2001-2003,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -47,13 +47,13 @@
 
     // org.apache.batik.script.Intepreter implementation
 
-    public Object evaluate(Reader scriptreader)
-        throws InterpreterException, IOException {
+    public Object evaluate(Reader scriptreader) throws IOException {
         return evaluate(scriptreader, "");
     }
 
-    public Object evaluate(Reader scriptreader, String description) throws IOException, InterpreterException {
-        // oups jacl doesn't accept reader in its eval method :-(
+    public Object evaluate(Reader scriptreader, String description)
+        throws IOException {
+        // oops jacl doesn't accept reader in its eval method :-(
         StringBuffer sbuffer = new StringBuffer();
         char[] buffer = new char[1024];
         int val = 0;
@@ -64,8 +64,7 @@
         return evaluate(str);
     }
 
-    public Object evaluate(String script)
-        throws InterpreterException {
+    public Object evaluate(String script) {
         try {
             interpreter.eval(script, 0);
         } catch (TclException e) {

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/script/jpython/JPythonInterpreter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/script/jpython/JPythonInterpreter.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/script/jpython/JPythonInterpreter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/script/jpython/JPythonInterpreter.java Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2001-2003  The Apache Software Foundation 
+   Copyright 2001-2003,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -41,12 +41,12 @@
     // org.apache.batik.script.Intepreter implementation
 
     public Object evaluate(Reader scriptreader)
-        throws InterpreterException, IOException {
+        throws IOException {
         return evaluate(scriptreader, "");
     }
 
     public Object evaluate(Reader scriptreader, String description)
-        throws InterpreterException, IOException {
+        throws IOException {
 
         // oups jpython doesn't accept reader in its eval method :-(
         StringBuffer sbuffer = new StringBuffer();
@@ -59,8 +59,7 @@
         return evaluate(str);
     }
 
-    public Object evaluate(String script)
-        throws InterpreterException {
+    public Object evaluate(String script) {
         try {
             interpreter.exec(script);
         } catch (org.python.core.PyException e) {

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/BatikSecurityController.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/BatikSecurityController.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/BatikSecurityController.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/BatikSecurityController.java Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2003-2004  The Apache Software Foundation 
+   Copyright 2003-2004,2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -21,12 +21,13 @@
 import java.security.AccessController;
 import java.security.PrivilegedExceptionAction;
 
+import org.mozilla.javascript.Callable;
 import org.mozilla.javascript.Context;
 import org.mozilla.javascript.GeneratedClassLoader;
-import org.mozilla.javascript.JavaScriptException;
 import org.mozilla.javascript.Script;
 import org.mozilla.javascript.Scriptable;
 import org.mozilla.javascript.SecurityController;
+import org.mozilla.javascript.WrappedException;
 
 /**
  * This implementation of the Rhino <tt>SecurityController</tt> interface is
@@ -48,7 +49,7 @@
         if (securityDomain instanceof RhinoClassLoader) {
             return (RhinoClassLoader)securityDomain;
         }
-		
+
         // FIXX: This should be supported by intersecting perms.
         // Calling var script = Script(source); script(); is not supported
         throw new SecurityException("Script() objects are not supported");
@@ -75,19 +76,21 @@
     }
 
     /**
-     * Call {@link Script#exec(Context cx, Scriptable scope)} of
-     * <i>script</i> under restricted security domain where an action is
+     * Calls {@link Callable#call(Context, Scriptable, Scriptable, Object[])} of
+     * <code>callable</code> under restricted security domain where an action is
      * allowed only if it is allowed according to the Java stack on the
-     * moment of the <i>execWithDomain</i> call and <i>securityDomain</i>.
-     * Any call to {@link #getDynamicSecurityDomain(Object)} during
-     * execution of {@link Script#exec(Context cx, Scriptable scope)}
+     * moment of the <code>callWithDomain</code> call and
+     * <code>securityDomain</code>. Any call to
+     * {@link #getDynamicSecurityDomain(Object)} during execution of
+     * {@link Callable#call(Context, Scriptable, Scriptable, Object[])}
      * should return a domain incorporate restrictions imposed by
-     * <i>securityDomain</i>.
+     * <code>securityDomain</code>.
      */
-    public Object execWithDomain(final Context cx, final Scriptable scope,
-                                 final Script script, Object securityDomain)
-        throws JavaScriptException {
-        
+    public Object callWithDomain(Object securityDomain, final Context cx,
+                                 final Callable callable,
+                                 final Scriptable scope,
+                                 final Scriptable thisObj,
+                                 final Object[] args) {
         AccessControlContext acc;
         if (securityDomain instanceof AccessControlContext)
             acc = (AccessControlContext)securityDomain;
@@ -96,16 +99,15 @@
             acc = loader.rhinoAccessControlContext;
         }
 
+        PrivilegedExceptionAction execAction = new PrivilegedExceptionAction() {
+            public Object run() {
+                return callable.call(cx, scope, thisObj, args);
+            }
+        };
         try {
-            // acc = new AccessController(acc, acc.getDomainCombiner());
-            return AccessController.doPrivileged
-                (new PrivilegedExceptionAction() {
-                        public Object run() throws JavaScriptException {
-                            return script.exec(cx, scope);
-                        }
-                    }, acc );
+            return AccessController.doPrivileged(execAction, acc);
         } catch (Exception e) {
-            throw new JavaScriptException(e);
+            throw new WrappedException(e);
         }
     }
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/EventTargetWrapper.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/EventTargetWrapper.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/EventTargetWrapper.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/EventTargetWrapper.java Thu Mar 23 23:50:03 2006
@@ -1,6 +1,6 @@
 /*
 
-   Copyright 2001-2003,2005  The Apache Software Foundation 
+   Copyright 2001-2003,2005-2006  The Apache Software Foundation 
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -25,8 +25,8 @@
 import org.apache.batik.dom.events.CustomEvent;
 import org.apache.batik.script.ScriptEventWrapper;
 import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextAction;
 import org.mozilla.javascript.Function;
-import org.mozilla.javascript.JavaScriptException;
 import org.mozilla.javascript.NativeJavaObject;
 import org.mozilla.javascript.NativeObject;
 import org.mozilla.javascript.Scriptable;
@@ -62,21 +62,13 @@
             interpreter = i;
         }
         public void handleEvent(Event evt) {
-            try {
-                Object event;
-                if (evt instanceof ScriptEventWrapper) {
-                    event = ((ScriptEventWrapper) evt).getEventObject();
-                } else {
-                    event = evt;
-                }
-                interpreter.callHandler(function, event);
-            } catch (JavaScriptException e) {
-                // the only simple solution is to forward it as a
-                // RuntimeException to be catched by event dispatching
-                // in BridgeEventSupport.java
-                // another solution will to give UserAgent to interpreters
-                throw new WrappedException(e);
+            Object event;
+            if (evt instanceof ScriptEventWrapper) {
+                event = ((ScriptEventWrapper) evt).getEventObject();
+            } else {
+                event = evt;
             }
+            interpreter.callHandler(function, event);
         }
     }
 
@@ -92,23 +84,19 @@
             this.interpreter = interpreter;
         }
         public void handleEvent(Event evt) {
-            try {
-                if (evt instanceof ScriptEventWrapper) {
-                    array[0] = ((ScriptEventWrapper) evt).getEventObject();
-                } else {
-                    array[0] = evt;
+            if (evt instanceof ScriptEventWrapper) {
+                array[0] = ((ScriptEventWrapper) evt).getEventObject();
+            } else {
+                array[0] = evt;
+            }
+            ContextAction handleEventAction = new ContextAction() {
+                public Object run(Context cx) {
+                    ScriptableObject.callMethod
+                        (scriptable, HANDLE_EVENT, array);
+                    return null;
                 }
-                interpreter.enterContext();
-                ScriptableObject.callMethod(scriptable, HANDLE_EVENT, array);
-            } catch (JavaScriptException e) {
-                // the only simple solution is to forward it as a
-                // RuntimeException to be caught by event dispatching
-                // in BridgeEventSupport.java
-                // another solution will to give UserAgent to interpreters
-                throw new WrappedException(e);
-            } finally {
-                Context.exit();
-            }
+            };
+            interpreter.call(handleEventAction);
         }
     }
 
@@ -137,19 +125,17 @@
             return call(fn, null);
         }
 
-        protected Object call(String fn, Object[] args) {
-            try {
-                interpreter.enterContext();
-                return ScriptableObject.callMethod(scriptable, fn, args);
-            } catch (JavaScriptException e) {
-                throw new WrappedException(e);
-            } finally {
-                Context.exit();
-            }
+        protected Object call(final String fn, final Object[] args) {
+            ContextAction callMethodAction = new ContextAction() {
+                public Object run(Context cx) {
+                    return ScriptableObject.callMethod(scriptable, fn, args);
+                }
+            };
+            return interpreter.call(callMethodAction);
         }
 
         public String getType() {
-            return (String) Context.toType
+            return (String) Context.jsToJava
                 (scriptable.get("type", scriptable), String.class);
         }
 
@@ -176,25 +162,25 @@
 
         public short getEventPhase() {
             Object ep = scriptable.get("eventPhase", scriptable);
-            Integer i = (Integer) Context.toType(ep, Integer.class);
+            Integer i = (Integer) Context.jsToJava(ep, Integer.class);
             return (short) i.intValue();
         }
 
         public boolean getBubbles() {
             Object ep = scriptable.get("bubbles", scriptable);
-            Boolean i = (Boolean) Context.toType(ep, Boolean.class);
+            Boolean i = (Boolean) Context.jsToJava(ep, Boolean.class);
             return i.booleanValue();
         }
 
         public boolean getCancelable() {
             Object ep = scriptable.get("cancelable", scriptable);
-            Boolean i = (Boolean) Context.toType(ep, Boolean.class);
+            Boolean i = (Boolean) Context.jsToJava(ep, Boolean.class);
             return i.booleanValue();
         }
 
         public long getTimeStamp() {
             Object ts = scriptable.get("timeStamp", scriptable);
-            Double d = (Double) Context.toType(ts, Double.class);
+            Double d = (Double) Context.jsToJava(ts, Double.class);
             return (long) d.doubleValue();
         }
 
@@ -211,12 +197,12 @@
         }
 
         public String getNamespaceURI() {
-            return (String) Context.toType
+            return (String) Context.jsToJava
                 (scriptable.get("namespaceURI", scriptable), String.class);
         }
 
         public boolean isCustom() {
-            Boolean b = (Boolean) Context.toType
+            Boolean b = (Boolean) Context.jsToJava
                 (call("isCustom"), Boolean.class);
             return b.booleanValue();
         }
@@ -226,7 +212,7 @@
         }
 
         public boolean isDefaultPrevented() {
-            Boolean b = (Boolean) Context.toType
+            Boolean b = (Boolean) Context.jsToJava
                 (call("isDefaultPrevented"), Boolean.class);
             return b.booleanValue();
         }
@@ -241,13 +227,13 @@
         }
 
         public boolean isPropagationStopped() {
-            Boolean b = (Boolean) Context.toType
+            Boolean b = (Boolean) Context.jsToJava
                 (call("isPropagationStopped"), Boolean.class);
             return b.booleanValue();
         }
 
         public boolean isImmediatePropagationStopped() {
-            Boolean b = (Boolean) Context.toType
+            Boolean b = (Boolean) Context.jsToJava
                 (call("isImmediatePropagationStopped"), Boolean.class);
             return b.booleanValue();
         }
@@ -303,8 +289,7 @@
         }
 
         public Scriptable construct(Context cx,
-                                    Scriptable scope, Object[] args)
-            throws JavaScriptException {
+                                    Scriptable scope, Object[] args) {
             return this.delegate.construct(cx, scope, args);
         }
 
@@ -393,9 +378,8 @@
         }
 
         public Object call(Context ctx, Scriptable scope,
-                           Scriptable thisObj, Object[] args)
-            throws JavaScriptException {
-            NativeJavaObject  njo = (NativeJavaObject)thisObj;
+                           Scriptable thisObj, Object[] args) {
+            NativeJavaObject njo = (NativeJavaObject)thisObj;
             if (args[1] instanceof Function) {
                 EventListener evtListener = null;
                 SoftReference sr = (SoftReference)listenerMap.get(args[1]);
@@ -410,7 +394,7 @@
                 Class[] paramTypes = { String.class, Function.class,
                                        Boolean.TYPE };
                 for (int i = 0; i < args.length; i++)
-                    args[i] = Context.toType(args[i], paramTypes[i]);
+                    args[i] = Context.jsToJava(args[i], paramTypes[i]);
                 ((EventTarget)njo.unwrap()).addEventListener
                     ((String)args[0], evtListener,
                      ((Boolean)args[2]).booleanValue());
@@ -431,7 +415,7 @@
                 Class[] paramTypes = { String.class, Scriptable.class,
                                        Boolean.TYPE };
                 for (int i = 0; i < args.length; i++)
-                    args[i] = Context.toType(args[i], paramTypes[i]);
+                    args[i] = Context.jsToJava(args[i], paramTypes[i]);
                 ((EventTarget)njo.unwrap()).addEventListener
                     ((String)args[0], evtListener,
                      ((Boolean)args[2]).booleanValue());
@@ -450,9 +434,8 @@
         }
 
         public Object call(Context ctx, Scriptable scope,
-                           Scriptable thisObj, Object[] args)
-            throws JavaScriptException {
-            NativeJavaObject  njo = (NativeJavaObject)thisObj;
+                           Scriptable thisObj, Object[] args) {
+            NativeJavaObject njo = (NativeJavaObject)thisObj;
             if (args[1] instanceof Function) {
                 SoftReference sr = (SoftReference)listenerMap.get(args[1]);
                 if (sr == null)
@@ -465,7 +448,7 @@
                 Class[] paramTypes = { String.class, Function.class,
                                        Boolean.TYPE };
                 for (int i = 0; i < args.length; i++)
-                    args[i] = Context.toType(args[i], paramTypes[i]);
+                    args[i] = Context.jsToJava(args[i], paramTypes[i]);
                 ((EventTarget)njo.unwrap()).removeEventListener
                     ((String)args[0], el, ((Boolean)args[2]).booleanValue());
                 return Undefined.instance;
@@ -481,7 +464,7 @@
                 Class[] paramTypes = { String.class, Scriptable.class,
                                        Boolean.TYPE };
                 for (int i = 0; i < args.length; i++)
-                    args[i] = Context.toType(args[i], paramTypes[i]);
+                    args[i] = Context.jsToJava(args[i], paramTypes[i]);
                 ((EventTarget)njo.unwrap()).removeEventListener
                     ((String)args[0], el, ((Boolean)args[2]).booleanValue());
                 return Undefined.instance;
@@ -502,9 +485,8 @@
         }
 
         public Object call(Context ctx, Scriptable scope,
-                           Scriptable thisObj, Object[] args)
-            throws JavaScriptException {
-            NativeJavaObject  njo = (NativeJavaObject)thisObj;
+                           Scriptable thisObj, Object[] args) {
+            NativeJavaObject njo = (NativeJavaObject)thisObj;
             if (args[2] instanceof Function) {
                 EventListener evtListener = new FunctionEventListener
                     ((Function)args[2], interpreter);
@@ -514,7 +496,7 @@
                                        Function.class, Boolean.TYPE,
                                        Object.class };
                 for (int i = 0; i < args.length; i++)
-                    args[i] = Context.toType(args[i], paramTypes[i]);
+                    args[i] = Context.jsToJava(args[i], paramTypes[i]);
                 AbstractNode target = (AbstractNode) njo.unwrap();
                 target.addEventListenerNS
                     ((String)args[0],
@@ -533,7 +515,7 @@
                                        Scriptable.class, Boolean.TYPE,
                                        Object.class };
                 for (int i = 0; i < args.length; i++)
-                    args[i] = Context.toType(args[i], paramTypes[i]);
+                    args[i] = Context.jsToJava(args[i], paramTypes[i]);
                 AbstractNode target = (AbstractNode) njo.unwrap();
                 target.addEventListenerNS
                     ((String)args[0],
@@ -556,9 +538,8 @@
         }
 
         public Object call(Context ctx, Scriptable scope,
-                           Scriptable thisObj, Object[] args)
-            throws JavaScriptException {
-            NativeJavaObject  njo = (NativeJavaObject)thisObj;
+                           Scriptable thisObj, Object[] args) {
+            NativeJavaObject njo = (NativeJavaObject)thisObj;
             if (args[2] instanceof Function) {
                 SoftReference sr = (SoftReference)listenerMap.get(args[2]);
                 if (sr == null)
@@ -570,7 +551,7 @@
                 Class[] paramTypes = { String.class, String.class,
                                        Function.class, Boolean.TYPE };
                 for (int i = 0; i < args.length; i++)
-                    args[i] = Context.toType(args[i], paramTypes[i]);
+                    args[i] = Context.jsToJava(args[i], paramTypes[i]);
                 AbstractNode target = (AbstractNode) njo.unwrap();
                 target.removeEventListenerNS
                     ((String)args[0],
@@ -590,7 +571,7 @@
                 Class[] paramTypes = { String.class, String.class,
                                        Scriptable.class, Boolean.TYPE };
                 for (int i = 0; i < args.length; i++)
-                    args[i] = Context.toType(args[i], paramTypes[i]);
+                    args[i] = Context.jsToJava(args[i], paramTypes[i]);
 
                 AbstractNode target = (AbstractNode) njo.unwrap();
                 target.removeEventListenerNS
@@ -615,15 +596,14 @@
         }
 
         public Object call(Context ctx, Scriptable scope,
-                           Scriptable thisObj, Object[] args)
-            throws JavaScriptException {
+                           Scriptable thisObj, Object[] args) {
             NativeJavaObject njo = (NativeJavaObject) thisObj;
             if (args[0] instanceof NativeObject) {
                 Event evt = new ObjectCustomEvent((NativeObject) args[0],
                                                   interpreter,
                                                   eventMap);
                 eventMap.put(args[0], new SoftReference(evt));
-                args[0] = Context.toType(args[0], Scriptable.class);
+                args[0] = Context.jsToJava(args[0], Scriptable.class);
                 ((EventTarget) njo.unwrap()).dispatchEvent(evt);
                 return Undefined.instance;
             }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/RhinoClassShutter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/RhinoClassShutter.java?rev=388441&r1=388440&r2=388441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/RhinoClassShutter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/script/rhino/RhinoClassShutter.java Thu Mar 23 23:50:03 2006
@@ -20,22 +20,20 @@
 import org.mozilla.javascript.ClassShutter;
 
 /**
- * One line Class Desc
+ * Class shutter that restricts access to Batik internals from script.
  *
- * Complete Class Desc
- *
- * @author <a href="mailto:deweese@apache.org">deweese</a>
+ * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
  * @version $Id$
  */
 public class RhinoClassShutter implements ClassShutter {
     
+    /*
     public RhinoClassShutter() {
         // I suspect that we might want to initialize this
         // from a resource file.
         // test();
     }
 
-    /*
     public void test() {
         test("org.mozilla.javascript.Context");
         test("org.mozilla.javascript");
@@ -52,6 +50,9 @@
     }
     */
 
+    /**
+     * Returns whether the given class is visible to scripts.
+     */
     public boolean visibleToScripts(String fullClassName) {
         // Don't let them mess with script engine's internals.
         if (fullClassName.startsWith("org.mozilla.javascript"))
@@ -81,5 +82,4 @@
 
         return true;
     }
-    
-};
+}