prevent NPE, which occured when the AMP finalName was not complying with ${artifactId}-${version} structure

git-svn-id: http://maven-alfresco-archetypes.googlecode.com/svn/trunk@426 04253f4f-3451-0410-a141-5562f1e59037
This commit is contained in:
maoo 2012-04-14 21:18:02 +00:00
parent 824f744f84
commit cccc2201e0

View File

@ -161,7 +161,10 @@ public class AmpUnArchiver extends AbstractZipUnArchiver {
String ampName = zipFile.getName();
ampName = FileUtils.removeExtension(FileUtils.removePath(ampName));
ampName = ampName.substring(0, ampName.lastIndexOf('-'));
int ampNameIndex = ampName.lastIndexOf('-');
if (ampNameIndex > 0) {
ampName = ampName.substring(0, ampNameIndex);
}
ampMapping.put("module.properties", "WEB-INF"+ fileSeparator +"classes" + fileSeparator +"alfresco" + fileSeparator +"module" + fileSeparator + moduleId + fileSeparator);
ampMapping.put("config", "WEB-INF"+fileSeparator+"classes"+ fileSeparator);