Adding defensive code for one more place where cleanedPath length could cause a problem with string manipulation in appendPath(..).

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@382861 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2006-03-03 15:27:25 +00:00
parent 138d77d3b0
commit 4c85dfc331
1 changed files with 7 additions and 1 deletions

View File

@ -482,6 +482,7 @@ public class DefaultModelInheritanceAssembler
return repository;
}
// TODO: This should eventually be migrated to DefaultPathTranslator.
protected String appendPath( String parentPath, String childPath, String pathAdjustment, boolean appendPaths )
{
List pathFragments = new ArrayList();
@ -570,7 +571,12 @@ public class DefaultModelInheritanceAssembler
if ( appendPaths && lastPathPart != null && !lastPathPart.endsWith( "/" ) )
{
cleanedPath.setLength( cleanedPath.length() - 1 );
int cleanedPathLen = cleanedPath.length();
if ( cleanedPathLen > 0 )
{
cleanedPath.setLength( cleanedPathLen - 1 );
}
}
return cleanedPath.toString();