NPE when loading old project configurations
@@ -111,7 +111,8 @@ public class Project extends ConfigFile implements IConfigFile {
IVariables variables,
ProjectConfig projectConfig,
List<String> configurationFiles,
- String environmentName) throws HopException {
+ String environmentName)
+ throws HopException {
if (variables == null) {
variables = Variables.getADefaultVariableSpace();
@@ -235,7 +236,8 @@ public class Project extends ConfigFile implements IConfigFile {
}
if (parentProjectName.equals(projectName)) {
- throw new HopException("Parent project '"+parentProjectName+"' can not be the same as the project itself");
+ throw new HopException(
+ "Parent project '" + parentProjectName + "' can not be the same as the project itself");
}
ProjectsConfig config = ProjectsConfigSingleton.getConfig();
@@ -245,6 +247,7 @@ public class Project extends ConfigFile implements IConfigFile {
while (StringUtils.isNotEmpty(realParentProjectName)) {
projectsList.add(realParentProjectName);
ProjectConfig projectConfig = config.findProjectConfig(realParentProjectName);
+ if (projectConfig != null) {
Project parentProject = projectConfig.loadProject(variables);
if (parentProject == null) {
// Can't be loaded, break out of the loop
@@ -269,6 +272,10 @@ public class Project extends ConfigFile implements IConfigFile {
}
}
}
+ } else {
+ // Project not found: config error, stop looking
+ realParentProjectName = null;
+ }
}
}
