You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by tm...@apache.org on 2002/03/12 19:50:33 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util Util.java
tmiller 02/03/12 10:50:33
Modified: java/src/org/apache/xalan/xsltc/compiler/util Util.java
Log:
bug 6413, fix by Santiago Pericas-Geersen
Revision Changes Path
1.4 +12 -9 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/Util.java
Index: Util.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/Util.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Util.java 1 Feb 2002 20:08:11 -0000 1.3
+++ Util.java 12 Mar 2002 18:50:33 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Util.java,v 1.3 2002/02/01 20:08:11 tmiller Exp $
+ * @(#)$Id: Util.java,v 1.4 2002/03/12 18:50:33 tmiller Exp $
*
* The Apache Software License, Version 1.1
*
@@ -108,17 +108,20 @@
* Replace all illegal Java chars by '_'.
*/
public static String toJavaName(String name) {
- final StringBuffer result = new StringBuffer();
+ if (name.length() > 0) {
+ final StringBuffer result = new StringBuffer();
- char ch = name.charAt(0);
- result.append(Character.isJavaIdentifierStart(ch) ? ch : '_');
+ char ch = name.charAt(0);
+ result.append(Character.isJavaIdentifierStart(ch) ? ch : '_');
- final int n = name.length();
- for (int i = 1; i < n; i++) {
- ch = name.charAt(i);
- result.append(Character.isJavaIdentifierPart(ch) ? ch : '_');
+ final int n = name.length();
+ for (int i = 1; i < n; i++) {
+ ch = name.charAt(i);
+ result.append(Character.isJavaIdentifierPart(ch) ? ch : '_');
+ }
+ return result.toString();
}
- return result.toString();
+ return name;
}
public static Type getJCRefType(String signature) {
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org