cziegeler 02/04/22 23:42:22 Modified: src/java/org/apache/cocoon/util Tag: cocoon_2_0_3_branch NetUtils.java Log: Fixing bug in branch, too Revision Changes Path No revision No revision 1.6.2.1 +3 -5 xml-cocoon2/src/java/org/apache/cocoon/util/NetUtils.java Index: NetUtils.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/util/NetUtils.java,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -r1.6 -r1.6.2.1 --- NetUtils.java 28 Feb 2002 14:19:12 -0000 1.6 +++ NetUtils.java 23 Apr 2002 06:42:22 -0000 1.6.2.1 @@ -63,7 +63,7 @@ * utility methods * * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> - * @version CVS $Id: NetUtils.java,v 1.6 2002/02/28 14:19:12 vgritsenko Exp $ + * @version CVS $Id: NetUtils.java,v 1.6.2.1 2002/04/23 06:42:22 cziegeler Exp $ */ public class NetUtils { @@ -272,14 +272,12 @@ */ public static String relativize(String path, String absoluteResource) { if (("".equals(path)) || (path == null)) return absoluteResource; - int length = path.length() - 1; - boolean slashPresent = path.charAt(length) == '/'; + if (path.charAt(path.length() - 1) != '/') path += "/"; if (absoluteResource.startsWith(path)) { // resource is direct descentant - return absoluteResource.substring(length + (slashPresent ? 1 : 2)); + return absoluteResource.substring(path.length()); } else { // resource is not direct descendant - if (!slashPresent) path += "/"; int index = StringUtils.matchStrings(path, absoluteResource); if (index > 0 && path.charAt(index-1) != '/') { index = path.substring(0, index).lastIndexOf('/');
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]