You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by gg...@apache.org on 2012/06/07 16:47:13 UTC
svn commit: r1347650 -
/xalan/test/trunk/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java
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