|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| UrlUtils.java | 100% | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
package org.codehaus.classworlds;
|
|
| 2 |
|
|
| 3 |
/**
|
|
| 4 |
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
|
| 5 |
* @version $Id: UrlUtils.java,v 1.1.1.1 2004/07/01 13:59:19 jvanzyl Exp $
|
|
| 6 |
*/
|
|
| 7 |
public class UrlUtils |
|
| 8 |
{
|
|
| 9 | 66 |
public static String normalizeUrlPath( String name ) |
| 10 |
{
|
|
| 11 | 66 |
if ( name.startsWith( "/" ) ) |
| 12 |
{
|
|
| 13 | 2 |
name = name.substring( 1 ); |
| 14 |
} |
|
| 15 |
|
|
| 16 |
// Looking for org/codehaus/werkflow/personality/basic/../common/core-idioms.xml
|
|
| 17 |
// | i |
|
|
| 18 |
// +-------+ remove
|
|
| 19 |
//
|
|
| 20 | 66 |
int i = name.indexOf( "/.." ); |
| 21 |
|
|
| 22 |
// Can't be at the beginning because we have no root to refer to so
|
|
| 23 |
// we start at 1.
|
|
| 24 | 66 |
if ( i > 0 )
|
| 25 |
{
|
|
| 26 | 2 |
int j = name.lastIndexOf( "/", i - 1 ); |
| 27 |
|
|
| 28 | 2 |
name = name.substring( 0, j ) + name.substring( i + 3 ); |
| 29 |
} |
|
| 30 |
|
|
| 31 | 66 |
return name;
|
| 32 |
} |
|
| 33 |
} |
|
| 34 |
|
|
||||||||||