Dave Jarvis created BATIK-1302:
----------------------------------

             Summary: SVG12TextElementBridge performs cast without instanceof
                 Key: BATIK-1302
                 URL: https://issues.apache.org/jira/browse/BATIK-1302
             Project: Batik
          Issue Type: Bug
            Reporter: Dave Jarvis


In *SVG12TextElementBridge.java*, around line 67, is the following snippet:

{{SVG12BridgeContext ctx12 = (SVG12BridgeContext) ctx}}{color:#cc7832}{{;}}
{color}

{color:#172b4d}There are situations where the *ctx* value is not such an 
instance, which results in a *ClassCastException.* Consider verifying that the 
instance is correct prior to performing the cast. Such as:{color}

{{{color:#172b4d}if( ctx instanceof SVG12BridgeContext ) {{color}}}
{{{color:#172b4d}   ctx12 = (SVG12BridgeContext) ctx;
}{color}}}

{color:#172b4d}If it is crucial that *ctx* be such an instance, then throwing 
an exception with information as to the probable root cause would be helpful. 
For example, "flowRoot not supported" or "SVG version is 1.1 but has SVG 1.2 
text elements" or whatever would be appropriate.{color}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to