You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Mario Jauvin (JIRA)" <ji...@apache.org> on 2018/05/10 19:26:00 UTC

[jira] [Created] (XALANJ-2615) Exception access public method using Java extension

Mario Jauvin created XALANJ-2615:
------------------------------------

             Summary: Exception access public method using Java extension
                 Key: XALANJ-2615
                 URL: https://issues.apache.org/jira/browse/XALANJ-2615
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects.  Anybody can view the issue.)
          Components: Xalan-extensions
    Affects Versions: 2.7.2
            Reporter: Mario Jauvin
            Assignee: Steven J. Hathaway


Using this sample stylesheet:

 
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform"
   xmlns:java="http://xml.apache.org/xalan/java">
 <template match="/">
  <!-- <variable name="p" select="java:exec(java:java.lang.Runtime.getRuntime(), 'cmd /c dir /b')"/> -->
  <variable name="p" select="java:exec(java:java.lang.Runtime.getRuntime(), 'cmd /c echo oui&amp;echo non')"/>
  <variable name="is" select="java:getInputStream($p)"/>
 </template>
</stylesheet>{code}
 

and this XML file

 
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<dummy/>{code}
 

When accessing the getInputStream method of the java.lang.Process class using XALAN I get this error:

 
{noformat}
15:16:01,284 INFO  [main] Main  - javax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl
15:16:01,287 INFO  [main] Main  - java.endorsed.dirs=C:\radws\workspace\build-env\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\endorsed
15:16:01,293 INFO  [main] Main  - launchFile: C:\radws\workspace\build-env\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml
15:16:01,503 INFO  [main] JAXPSAXProcessorInvoker  - Transforming...
file:/C:/radws/workspace/build-env/add-infra/samples/t1.xsl; Line #7; Column #57; java.lang.IllegalAccessException: Class org.apache.xalan.extensions.ExtensionHandlerJavaPackage can not access a member of class java.lang.ProcessImpl with modifiers "public"
file:/C:/radws/workspace/build-env/add-infra/samples/t1.xsl; Line #7; Column #57; java.lang.NullPointerException
15:16:01,533 INFO  [main] JAXPSAXProcessorInvoker  - Done.{noformat}
This problem is due to the fact that the class ProcessImpl is not exactly identical to the interface java.lang.Process signature.  If you set the override to true in the method object (using AccessibleObject.setAccessible) you will be able to invoke the method.  This works in the JRE 8 xsl transformer.

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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