Bug 505676 - NullPointerException in NpmScriptContentProvider.getChildren
NPE is fixed
Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
diff --git a/nodejs/org.eclipse.wst.jsdt.js.npm/META-INF/MANIFEST.MF b/nodejs/org.eclipse.wst.jsdt.js.npm/META-INF/MANIFEST.MF
index be7a59d..db757f7 100644
--- a/nodejs/org.eclipse.wst.jsdt.js.npm/META-INF/MANIFEST.MF
+++ b/nodejs/org.eclipse.wst.jsdt.js.npm/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: org.eclipse.wst.jsdt.js.npm;singleton:=true
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.0.300.qualifier
Bundle-Activator: org.eclipse.wst.jsdt.js.npm.NpmPlugin
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
diff --git a/nodejs/org.eclipse.wst.jsdt.js.npm/pom.xml b/nodejs/org.eclipse.wst.jsdt.js.npm/pom.xml
index 4d5b6e2..616d956 100644
--- a/nodejs/org.eclipse.wst.jsdt.js.npm/pom.xml
+++ b/nodejs/org.eclipse.wst.jsdt.js.npm/pom.xml
@@ -21,6 +21,6 @@
<groupId>org.eclipse.webtools.jsdt.nodejs</groupId>
<artifactId>org.eclipse.wst.jsdt.js.npm</artifactId>
- <version>1.0.200-SNAPSHOT</version>
+ <version>1.0.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/nodejs/org.eclipse.wst.jsdt.js.npm/src/org/eclipse/wst/jsdt/js/npm/internal/ui/NpmScriptContentProvider.java b/nodejs/org.eclipse.wst.jsdt.js.npm/src/org/eclipse/wst/jsdt/js/npm/internal/ui/NpmScriptContentProvider.java
index bd9c818..ccd9da4 100644
--- a/nodejs/org.eclipse.wst.jsdt.js.npm/src/org/eclipse/wst/jsdt/js/npm/internal/ui/NpmScriptContentProvider.java
+++ b/nodejs/org.eclipse.wst.jsdt.js.npm/src/org/eclipse/wst/jsdt/js/npm/internal/ui/NpmScriptContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 Red Hat, Inc.
+ * Copyright (c) 2016, 1027 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -81,15 +81,17 @@
public Object[] getChildren(Object parentNode) {
if (parentNode instanceof IFile) {
try {
+ Set<ITask> tasks = new HashSet<ITask>();
+
PackageJson packageJson = NpmUtil.parsePackageJsonFile((IFile) parentNode);
- Set<ITask> tasks = new HashSet<ITask>();
-
- for (String scriptName : packageJson.getScripts().keySet()) {
- tasks.add(
- new NpmScriptTask(((IFile) parentNode), scriptName, null, false, new Location(0, 1)));
+ if (packageJson != null && packageJson.getScripts() != null) {
+ for (String scriptName : packageJson.getScripts().keySet()) {
+ tasks.add(
+ new NpmScriptTask(((IFile) parentNode), scriptName, null, false, new Location(0, 1)));
+ }
}
-
+
return tasks.toArray();
} catch (Exception ex) {
NpmPlugin.logError(ex, ex.getMessage());