Author: akazakov
Date: 2011-02-07 05:07:32 -0500 (Mon, 07 Feb 2011)
New Revision: 29033
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java
Log:
https://issues.jboss.org/browse/JBIDE-8337 Fixed NPE in KB plug-in
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java 2011-02-07
02:55:37 UTC (rev 29032)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java 2011-02-07
10:07:32 UTC (rev 29033)
@@ -93,20 +93,22 @@
IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects();
Set<String> projectNames = new HashSet<String>();
for (IProject p: ps) projectNames.add(p.getName());
- IPath path = WebKbPlugin.getDefault().getStateLocation();
- File file = new File(path.toFile(), "projects"); //$NON-NLS-1$
- if(!file.isDirectory()) return;
- File[] fs = file.listFiles();
- if(fs != null) for (File f: fs) {
- String name = f.getName();
- if(name.endsWith(".xml")) { //$NON-NLS-1$
- name = name.substring(0, name.length() - 4);
- if(!projectNames.contains(name)) {
- f.delete();
+ WebKbPlugin plugin = WebKbPlugin.getDefault();
+ if(plugin!=null) {
+ IPath path = plugin.getStateLocation();
+ File file = new File(path.toFile(), "projects"); //$NON-NLS-1$
+ if(!file.isDirectory()) return;
+ File[] fs = file.listFiles();
+ if(fs != null) for (File f: fs) {
+ String name = f.getName();
+ if(name.endsWith(".xml")) { //$NON-NLS-1$
+ name = name.substring(0, name.length() - 4);
+ if(!projectNames.contains(name)) {
+ f.delete();
+ }
}
}
}
-
}
/*