You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mk...@apache.org on 2002/09/30 21:22:11 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util Util.java
mkwan 2002/09/30 12:22:11
Modified: java/src/org/apache/xalan/xsltc/compiler/util Util.java
Log:
Fix problems in the baseName() interface so that it can handle system ids like
file:abc.xsl and file:///c:\test\abc.xsl.
Revision Changes Path
1.10 +13 -4 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Util.java 25 Jun 2002 17:05:38 -0000 1.9
+++ Util.java 30 Sep 2002 19:22:11 -0000 1.10
@@ -86,11 +86,20 @@
* files.
*/
public static String baseName(String name) {
- int index = name.lastIndexOf('/');
+ int index = name.lastIndexOf('\\');
if (index < 0) {
- index = name.lastIndexOf('\\');
+ index = name.lastIndexOf('/');
+ }
+
+ if (index >= 0)
+ return name.substring(index + 1);
+ else {
+ int lastColonIndex = name.lastIndexOf(':');
+ if (lastColonIndex > 0)
+ return name.substring(lastColonIndex + 1);
+ else
+ return name;
}
- return name.substring(index + 1);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org