Repository: incubator-slider Updated Branches: refs/heads/develop f5efb59ef -> d82d01fc3
SLIDER-1153 Code issues - 14 null pointer deferences found (Jian He via gourksaha) Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/d82d01fc Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/d82d01fc Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/d82d01fc Branch: refs/heads/develop Commit: d82d01fc3c203aff4766b6102f57311b7d0d69b7 Parents: f5efb59 Author: Gour Saha <gourks...@apache.org> Authored: Fri Jul 15 19:50:47 2016 -0700 Committer: Gour Saha <gourks...@apache.org> Committed: Fri Jul 15 19:50:47 2016 -0700 ---------------------------------------------------------------------- .../main/java/org/apache/slider/client/SliderClient.java | 10 ++++++---- .../apache/slider/server/appmaster/state/AppState.java | 8 +++++++- 2 files changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/d82d01fc/slider-core/src/main/java/org/apache/slider/client/SliderClient.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java index 60c670b..8384fd0 100644 --- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java +++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java @@ -3796,10 +3796,12 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe // if null, it will be uploaded by Slider and thus at slider's path if (imagePath == null) { ApplicationReport appReport = findInstance(clusterName); - Path path1 = sliderFileSystem.getTempPathForCluster(clusterName); - Path subPath = new Path(path1, appReport.getApplicationId().toString() - + "/agent"); - imagePath = subPath.toString(); + if (appReport != null) { + Path path1 = sliderFileSystem.getTempPathForCluster(clusterName); + Path subPath = new Path(path1, appReport.getApplicationId().toString() + + "/agent"); + imagePath = subPath.toString(); + } } log.info("The path of slider agent tarball on HDFS is: " + imagePath); } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/d82d01fc/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java index 08a6e2e..4b76fe8 100644 --- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java +++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java @@ -816,6 +816,10 @@ public class AppState { MapOperations component = resources.getComponent(name, Collections.singletonMap(COMPONENT_PRIORITY, Integer.toString(newPriority))); + if (component == null) { + throw new BadConfigException("Component is null for name = " + name + + ", newPriority =" + newPriority); + } ProviderRole dynamicRole = createDynamicProviderRole(newName, name, component); RoleStatus roleStatus = buildRole(dynamicRole); roleStatus.setDesired(1); @@ -833,7 +837,9 @@ public class AppState { RoleStatus roleStatus = buildRole(dynamicRole); roleStatus.setDesired(getDesiredInstanceCount(resources, name)); log.info("New role {}", roleStatus); - roleHistory.addNewRole(roleStatus); + if (roleHistory != null) { + roleHistory.addNewRole(roleStatus); + } newRoles.add(dynamicRole); } }