YARN-8357. Fixed NPE when YARN service is saved and not deployed.

Contributed by Chandni Singh

(cherry picked from commit d9852eb589)
This commit is contained in:
Eric Yang 2018-05-24 16:32:13 -04:00
parent 514c05abd0
commit f49e697cc8
1 changed files with 1 additions and 0 deletions

View File

@ -1198,6 +1198,7 @@ public class ServiceClient extends AppAdminClient implements SliderExitCodes,
ServiceApiUtil.validateNameFormat(serviceName, getConfig()); ServiceApiUtil.validateNameFormat(serviceName, getConfig());
Service appSpec = new Service(); Service appSpec = new Service();
appSpec.setName(serviceName); appSpec.setName(serviceName);
appSpec.setState(ServiceState.STOPPED);
ApplicationId currentAppId = getAppId(serviceName); ApplicationId currentAppId = getAppId(serviceName);
if (currentAppId == null) { if (currentAppId == null) {
LOG.info("Service {} does not have an application ID", serviceName); LOG.info("Service {} does not have an application ID", serviceName);