Return-Path: X-Original-To: apmail-xml-xalan-cvs-archive@www.apache.org Delivered-To: apmail-xml-xalan-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 503A8C946 for ; Thu, 7 Jun 2012 14:47:38 +0000 (UTC) Received: (qmail 79240 invoked by uid 500); 7 Jun 2012 14:47:38 -0000 Delivered-To: apmail-xml-xalan-cvs-archive@xml.apache.org Received: (qmail 79217 invoked by uid 500); 7 Jun 2012 14:47:38 -0000 Mailing-List: contact xalan-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: List-Id: Delivered-To: mailing list xalan-cvs@xml.apache.org Received: (qmail 79210 invoked by uid 99); 7 Jun 2012 14:47:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2012 14:47:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2012 14:47:35 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C1034238896F for ; Thu, 7 Jun 2012 14:47:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1347650 - /xalan/test/trunk/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java Date: Thu, 07 Jun 2012 14:47:13 -0000 To: xalan-cvs@xml.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120607144713.C1034238896F@eris.apache.org> Author: ggregory Date: Thu Jun 7 14:47:13 2012 New Revision: 1347650 URL: http://svn.apache.org/viewvc?rev=1347650&view=rev Log: Testing [XALANJ-2546]: xsl:sort lang attribute ignores parameter value, only hard-coding works. (1) Remove use of the -s option. The Compiler class does not implement a -s option, in fact, it never calls System.exit(). (2) Clean up the base name used for the translet class name to replace illegal class chars with underscores. Modified: xalan/test/trunk/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java Modified: xalan/test/trunk/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java URL: http://svn.apache.org/viewvc/xalan/test/trunk/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java?rev=1347650&r1=1347649&r2=1347650&view=diff ============================================================================== --- xalan/test/trunk/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java (original) +++ xalan/test/trunk/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java Thu Jun 7 14:47:13 2012 @@ -44,6 +44,7 @@ import org.apache.xalan.xsltc.cmdline.Tr public class XsltcMainWrapper extends TransformWrapperHelper { + private static final char CLEAN_CHAR = '_'; protected static final String XSLTC_COMPILER_CLASS = "org.apache.xalan.xsltc.cmdline.Compile"; protected static final String XSLTC_RUNTIME_CLASS = "org.apache.xalan.xsltc.cmdline.Transform"; @@ -142,13 +143,12 @@ the translets // Timed: compile stylesheet class from XSL file // String[] args1 = new String[2]; -// args1[0] = "-s"; // Don't allow System.exit /* TWA - commented out the following for short-term Problem when local path/file is being used, somewhere a file://// prefix is being appended to the filename and xsltc can't find the file even with the -u So I strip off the protocol prefix and pass the local path/file - args1[1] = "-u"; // Using URIs - args1[2] = xslName; + args1[0] = "-u"; // Using URIs + args1[1] = xslName; */ /* TWA - temporay hack to construct and pass a directory for translets */ int last = resultName.lastIndexOf(FILE_SEPARATOR); @@ -156,15 +156,14 @@ So I strip off the protocol prefix and p int next = tdir.lastIndexOf(FILE_SEPARATOR); String transletsdirName = tdir.substring(0, next); - String[] args1 = new String[4]; - args1[0] = "-s"; - args1[1] = "-d"; - args1[2] = transletsdirName; - args1[3] = xslName; + String[] args1 = new String[3]; + args1[0] = "-d"; + args1[1] = transletsdirName; + args1[2] = xslName; int idx = xslName.indexOf("file:////"); if (idx != -1){ xslName = new String(xslName.substring(8)); - args1[3] = xslName; + args1[2] = xslName; } startTime = System.currentTimeMillis(); /// Transformer transformer = factory.newTransformer(new StreamSource(xslName)); @@ -176,9 +175,20 @@ So I strip off the protocol prefix and p int nameStart = xslName.lastIndexOf(FILE_SEPARATOR) + 1; String baseName = xslName.substring(nameStart); int extStart = baseName.lastIndexOf('.'); - if (extStart > 0) + if (extStart > 0) { baseName = baseName.substring(0, extStart); - + } + + // Replace illegal class name chars with underscores. + StringBuffer sb = new StringBuffer(baseName.length()); + char charI = baseName.charAt(0); + sb.append(Character.isJavaLetter(charI) ? charI :CLEAN_CHAR); + for (int i = 1; i < baseName.length(); i++) { + charI = baseName.charAt(i); + sb.append(Character.isJavaLetterOrDigit(charI) ? charI :CLEAN_CHAR); + } + baseName = sb.toString(); + // Untimed: Apply any parameters needed // applyParameters(transformer); --------------------------------------------------------------------- To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org For additional commands, e-mail: xalan-cvs-help@xml.apache.org