Fixing NPE in appendPath(..) when calculating '..' path adjustments.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@382849 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2006-03-03 15:08:31 +00:00
parent aaaf6537f6
commit 138d77d3b0
1 changed files with 9 additions and 3 deletions

View File

@ -538,10 +538,16 @@ public class DefaultModelInheritanceAssembler
lastToken = currentToken;
currentToken = tokens.nextToken();
if ( "..".equals( currentToken ) )
if ( "..".equals( currentToken ) && lastToken != null )
{
// trim the previous path part off...
cleanedPath.setLength( cleanedPath.length() - ( lastToken.length() + 1 ) );
int cleanedPathLen = cleanedPath.length();
int lastTokenLen = lastToken.length();
if ( cleanedPathLen > lastTokenLen )
{
// trim the previous path part off...
cleanedPath.setLength( cleanedPath.length() - ( lastToken.length() + 1 ) );
}
}
else if ( !".".equals( currentToken ) )
{