DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10748>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10748 Translet class not loading due to java.long.VerifyError [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED ------- Additional Comments From [EMAIL PROTECTED] 2002-07-16 18:51 ------- Ok- I've taken your java code method 'applyXSLTransformation' and built a small java program around it to test it. (See below). The program below compiles with the current cvs version and runs fine. Here is my test program built from your module: /* * Bug # 10748- customer Java code embedded into a working Java program * for testing. This program compiles and runs with the * latest XSLTC codebase. * Assumptions: test.xsl has been pre-compiled to test.class and is in * current working directory. * To run this program: compile to Test.class (see Makefile) and run with * ksh wrapper 'run'. Takes no arguments. * G. Todd Miller 7/16/02 */ import java.io.*; import org.xml.sax.*; import org.apache.xalan.xsltc.DOM; import org.apache.xalan.xsltc.Translet; import javax.xml.parsers.*; import org.apache.xalan.xsltc.compiler.*; import org.apache.xalan.xsltc.compiler.Constants; import org.apache.xalan.xsltc.runtime.*; import org.apache.xalan.xsltc.*; import org.apache.xalan.xsltc.dom.*; class NotificationServiceException extends Exception { public NotificationServiceException(String msg){ } } public class Test { private final static String _transletName = "test"; private final static String _xmlInputString = "<?xml version='1.0'?>" + "<transaction-data>" + " <changed-data>" + " <dd-change-changed-state>" + " <changes-before-image>" + " <interest>" + " <interest-code>04</interest-code>" + " <rate-region>7</rate-region>" + " <rate-index>324</rate-index>" + " <interest-rate>0.0015</interest-rate>" + " <apy>0.0</apy>" + " </interest>" + " </changes-before-image>" + " <changes-after-image>" + " <interest>" + " <interest-code>05</interest-code>" + " <rate-region>7</rate-region>" + " <rate-index>354</rate-index>" + " <interest-rate>1.45</interest-rate>" + " <apy>1.5</apy>" + " </interest>" + " </changes-after-image>" + " </dd-change-changed-state>" + " </changed-data>" + "</transaction-data>"; public static void main(String[] args){ Test app = new Test(); String output = null; try { output = app.applyXSLTransformation(_xmlInputString, _transletName); } catch (NotificationServiceException e){ System.out.println("NotificationServiceException caught in main"); } System.out.println("Output:\n"+ output); } // customer's module follows: public String applyXSLTransformation(String xmlStr, String transletName) throws NotificationServiceException { // parse XML to DOM DOMImpl dom = new DOMImpl(); XMLReader reader = null; final SAXParserFactory factory = SAXParserFactory.newInstance(); try { factory.setFeature(Constants.NAMESPACE_FEATURE, true); } catch (Exception e) { factory.setNamespaceAware(true); } SAXParser parser = null; DTDMonitor _dtdMonitor = new DTDMonitor(); try { parser = factory.newSAXParser(); reader = parser.getXMLReader(); reader.setContentHandler(dom.getBuilder()); _dtdMonitor.handleDTD(reader); StringReader stringReader = new StringReader(xmlStr); InputSource inputSource = new InputSource(stringReader); reader.parse(inputSource); } catch (ParserConfigurationException e) { System.out.println("SAX Parser is not configured properly.\n" + e.getMessage()); throw new NotificationServiceException( "SAX Parser is not configured properly.\n" + e.getMessage()); } catch (SAXException e) { System.out.println("2 SAX Parser could not be created.\n" + e.getMessage()); throw new NotificationServiceException( "SAX Parser could not be created.\n" + e.getMessage()); } catch (IOException e) { System.out.println("XML Reader could not read xml document. " + e.getMessage()); throw new NotificationServiceException( "XML Reader could not read xml document. " + e.getMessage()); } DefaultSAXOutputHandler outputhandler = null; TextOutput textoutput = null; StringWriter stringWriter = new StringWriter(); try { outputhandler = new DefaultSAXOutputHandler(stringWriter, "utf-8"); textoutput = new TextOutput(outputhandler, "utf-8"); textoutput.setType(textoutput.TEXT); } catch (IOException e) { System.out.println("Could not create SAX Output Handler." + e.getMessage()); throw new NotificationServiceException( "Could not create SAX Output Handler." + e.getMessage()); } // instantiate the translet Translet translet = null; try { Class clazz = Class.forName(transletName); translet = (Translet) clazz.newInstance(); } catch (ClassNotFoundException e) { System.out.println("Translet class not found." + e.getMessage()); throw new NotificationServiceException( "Translet class not found." + e.getMessage()); } catch (InstantiationException e) { System.out.println("Could not instantiate Translet class." + e.getMessage()); throw new NotificationServiceException( "Could not instantiate Translet class." + e.getMessage()); } catch (IllegalAccessException e) { System.out.println("Illegal Access of Translet class." + e.getMessage()); throw new NotificationServiceException( "Illegal Access of Translet class." + e.getMessage()); } // do the transformation AbstractTranslet absTranslet = (AbstractTranslet) translet; absTranslet.setIndexSize(dom.getSize()); _dtdMonitor.buildIdIndex(dom, 0, absTranslet); try { absTranslet.transform(dom, textoutput); } catch (TransletException e) { System.out.println("Could not transform XML document." + e.getMessage()); throw new NotificationServiceException( "Could not transform XML document." + e.getMessage()); } return stringWriter.toString(); } } So I think all you need to do is grab the latest XSLTC and you'll be all set. Have fun! -Todd
