elharo commented on code in PR #1: URL: https://github.com/apache/xalan-test/pull/1#discussion_r1188967509
########## tests/bugzilla/Bugzilla1251.java: ########## @@ -37,6 +37,19 @@ * Testlet for reproducing Bugzilla reported bugs. * * Reported-by: sl...@matavnet.hu + * + * jkesselm May2023: CONFIRMED OPPOSITE. Despite claim from user, identity transformer reports FAIL (throws exception), + * real transformer reports PASS (exception caught and handled as intended). + * + * In real transformer, ElemCopy catches the SaxException, throws it wrapped in TransformerException; + * TransformerImpl catches that, sees that it has an m_serializationHandler. and passes it off to + * that. Since that reports checkPass, test is considered good. + * + * In TransformerIdentityImpl.startElement(), there is no equivalent catch-and-handle for exceptions. + * + * RECOMMENDATION: SANITY CHECK. User appears to have misstated the problem. If so -- if the description is Review Comment: -- -> — ########## tests/bugzilla/Bugzilla1110.java: ########## @@ -31,6 +31,12 @@ import org.w3c.dom.traversal.NodeIterator; import org.xml.sax.InputSource; +// jkesselm May 2023: CAN NOT REPRODUCE; prints what the user says they expected to see. Review Comment: nit: CANNOT ########## tests/bugzilla/Bugzilla1266.java: ########## @@ -74,52 +94,58 @@ public void execute(Datalet d) Templates templates = null; Transformer transformer = null; try - { - factory = TransformerFactory.newInstance(); - logger.logMsg(Logger.STATUSMSG, "About to factory.newTemplates(" + QetestUtils.filenameToURL("identity.xsl") + ")"); - templates = factory.newTemplates(new StreamSource(QetestUtils.filenameToURL("identity.xsl"))); - transformer = templates.newTransformer(); - - // Set the errorListener and validate it - transformer.setErrorListener(loggingErrorListener); - if (transformer.getErrorListener() == loggingErrorListener) - logger.checkPass("set/getErrorListener on transformer"); - else - logger.checkFail("set/getErrorListener on transformer"); - - logger.logMsg(Logger.STATUSMSG, "Reproduce Bugzilla1266 - warning due to bad output props not propagated"); - logger.logMsg(Logger.STATUSMSG, "transformer.setOutputProperty(encoding, illegal-encoding-value)"); - transformer.setOutputProperty("encoding", "illegal-encoding-value"); - - logger.logMsg(Logger.STATUSMSG, "about to transform(...)"); - transformer.transform(new StreamSource(QetestUtils.filenameToURL("identity.xml")), - new StreamResult("Bugzilla1266.out")); - logger.logMsg(Logger.STATUSMSG, "after transform(...)"); - logger.logMsg(Logger.STATUSMSG, "loggingErrorListener after transform:" + loggingErrorListener.getQuickCounters()); - - // Validate that one warning (about illegal-encoding-value) should have been reported - int[] errCtr = loggingErrorListener.getCounters(); - if (errCtr[LoggingErrorListener.TYPE_WARNING] > 0) - logger.checkPass("At least one Warning listned to for illegal-encoding-value"); - else - logger.checkFail("At least one Warning listned to for illegal-encoding-value"); + { + factory = TransformerFactory.newInstance(); + logger.logMsg(Logger.STATUSMSG, "About to factory.newTemplates(" + QetestUtils.filenameToURL("identity.xsl") + ")"); + templates = factory.newTemplates(new StreamSource(QetestUtils.filenameToURL("identity.xsl"))); + transformer = templates.newTransformer(); + + // Set the errorListener and validate it + transformer.setErrorListener(loggingErrorListener); + if (transformer.getErrorListener() == loggingErrorListener) + logger.checkPass("set/getErrorListener on transformer"); + else { + logger.checkFail("set/getErrorListener on transformer"); + throw new Exception("failed set/getErrorListener on transformer"); + } + + logger.logMsg(Logger.STATUSMSG, "Reproduce Bugzilla1266 - warning due to bad output props not propagated"); + logger.logMsg(Logger.STATUSMSG, "transformer.setOutputProperty(encoding, illegal-encoding-value)"); + transformer.setOutputProperty("encoding", "illegal-encoding-value"); + + logger.logMsg(Logger.STATUSMSG, "about to transform(...)"); + transformer.transform(new StreamSource(QetestUtils.filenameToURL("identity.xml")), + new StreamResult("Bugzilla1266.out")); + logger.logMsg(Logger.STATUSMSG, "after transform(...)"); + logger.logMsg(Logger.STATUSMSG, "loggingErrorListener after transform:" + loggingErrorListener.getQuickCounters()); + + // Validate that one warning (about illegal-encoding-value) should have been reported + int[] errCtr = loggingErrorListener.getCounters(); + + if (errCtr[LoggingErrorListener.TYPE_WARNING] > 0) + logger.checkPass("At least one Warning listned to for illegal-encoding-value"); + else { + logger.checkFail("No Warning reported by listener for illegal-encoding-value"); + throw new Exception("No Warning reported by listener for illegal-encoding-value"); + } - // Validate the actual output file as well: in this case, - // the stylesheet should still work - CheckService fileChecker = new XHTFileCheckService(); - fileChecker.check(logger, - new File("Bugzilla1266.out"), - new File("identity.gold"), - "transform of good xsl w/bad output props into: " + "Bugzilla1266.out"); + // Validate the actual output file as well: in this case, + // the stylesheet should still work + CheckService fileChecker = new XHTFileCheckService(); + fileChecker.check(logger, + new File("Bugzilla1266.out"), Review Comment: This indent seems excessive -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org For additional commands, e-mail: dev-h...@xalan.apache.org