You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by bu...@apache.org on 2009/05/23 22:19:00 UTC

DO NOT REPLY [Bug 47257] New: The class RhinoClassShutter disables instantiation of org.mozilla.javascript.EcmaError preventing handling of certain Javascript errors

https://issues.apache.org/bugzilla/show_bug.cgi?id=47257

           Summary: The class RhinoClassShutter disables instantiation of
                    org.mozilla.javascript.EcmaError preventing handling
                    of certain Javascript errors
           Product: Batik
           Version: 1.7
          Platform: All
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Scripting
        AssignedTo: batik-dev@xmlgraphics.apache.org
        ReportedBy: vgoenka@apache.org


I have a block of Javascript code that does something like:

try {
  //reference some undeclared variable
} catch (e) {}

This causes Rhino to generate an EcmaError, which it then tries to wrap in a
Java object. However the RhinoClassShutter prevents accessing all rhino classes
(for good reason) including the EcmaError class, thereby negating the
usefulness of try/catch. 

Perhaps the RhinoClassShutter should allow exception/error classes to be
referenced/instantiated even if they are in the org.mozilla.javascript package.
The only work around (other than making sure the Javascript never generates an
EcmaError) seems to be to replace RhinoInterpreterFactory with your own, just
to override the RhinoClassShutter, which has some more quirks if you are using
the batik jars (which also install the RhinoInterpreterFactory). 


Access to Java class "org.mozilla.javascript.EcmaError" is prohibited. (Inline
<script> http://....:-1#4)
    at
org.apache.batik.transcoder.SVGAbstractTranscoder$SVGAbstractTranscoderUserAgent.displayError(SVGAbstractTranscoder.java:863)
    at
org.apache.batik.bridge.BaseScriptingEnvironment.handleInterpreterException(BaseScriptingEnvironment.java:694)
    at
org.apache.batik.bridge.BaseScriptingEnvironment.loadScripts(BaseScriptingEnvironment.java:522)
    at
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:214)
    at
org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:92)
    at
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
    at
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 47257] The class RhinoClassShutter disables instantiation of org.mozilla.javascript.EcmaError preventing handling of certain Javascript errors

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47257


Helder Magalhães <he...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |minor




--- Comment #1 from Helder Magalhães <he...@gmail.com>  2009-05-24 03:07:54 PST ---
(In reply to comment #0)
> I have a block of Javascript code that does something like:
> 
> try {
>   //reference some undeclared variable
> } catch (e) {}
> 
> This causes Rhino to generate an EcmaError, which it then tries to wrap in a
> Java object. However the RhinoClassShutter prevents accessing all rhino classes
> (for good reason) including the EcmaError class, thereby negating the
> usefulness of try/catch. 

I'm sure this makes sense and, although I haven't tried to reproduce, Batik
recently (see revision 701300 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=701300 ) for example) had a few improvements which may
help (compatibility with 1.6R7). Unfortunately, I'm fairly convinced they don't
address this specific issue...


> The only work around (other than making sure the Javascript never generates an
> EcmaError) seems to be to replace RhinoInterpreterFactory with your own, just
> to override the RhinoClassShutter, which has some more quirks if you are using
> the batik jars (which also install the RhinoInterpreterFactory). 

If you are aware of this workaround, why not sharing the solution proposal?
Patches are always welcome... ;-)


Also, I've decrease importance ("critical" was just too much, specially
considering a workaround [1] was already proposed).


Hope this helps,
 Helder


[1] https://issues.apache.org/bugzilla/page.cgi?id=fields.html#importance

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 47257] The class RhinoClassShutter disables instantiation of org.mozilla.javascript.EcmaError preventing handling of certain Javascript errors

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47257





--- Comment #2 from Helder Magalhães <he...@gmail.com>  2009-05-24 03:12:59 PST ---
(In reply to comment #0)
> I have a block of Javascript code that does something like:
> 
> try {
>   //reference some undeclared variable
> } catch (e) {}
> 
> This causes Rhino to generate an EcmaError, which it then tries to wrap in a
> Java object.

(Forgot to mention in my previous message...) Could you attach a reduced test
case [1]? A self-contained SVG file seemed like appropriate. Making issues easy
to reproduce is a giant step in raising the chances someone will take a look at
them. ;-)

Hope this helps,
 Helder

[1] http://webkit.org/quality/reduction.html

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org