Author: Grid.Qian
Date: 2008-10-22 05:11:47 -0400 (Wed, 22 Oct 2008)
New Revision: 11067
Modified:
branches/jbosstools-3.0.0.Beta1/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeClassPathInitializer.java
Log:
JBIDE-2955: fix the null exception error when remove jboss ws classpath entry
Modified:
branches/jbosstools-3.0.0.Beta1/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeClassPathInitializer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeClassPathInitializer.java 2008-10-22
08:33:10 UTC (rev 11066)
+++
branches/jbosstools-3.0.0.Beta1/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeClassPathInitializer.java 2008-10-22
09:11:47 UTC (rev 11067)
@@ -82,12 +82,14 @@
JBossWSRuntime jbws = JBossWSRuntimeManager.getInstance()
.findRuntimeByName(segment);
if (jbws != null) {
-
- List<String> jars =
JBossWSRuntimeManager.getInstance().getAllRuntimeJars(jbws);
+
+ List<String> jars = JBossWSRuntimeManager.getInstance()
+ .getAllRuntimeJars(jbws);
for (String jar : jars) {
entryList.add(getEntry(new Path(jar)));
}
- entries = entryList.toArray(new IClasspathEntry[entryList.size()]);
+ entries = entryList.toArray(new IClasspathEntry[entryList
+ .size()]);
if (entries == null)
return new IClasspathEntry[0];
}
@@ -104,14 +106,21 @@
if (entries == null) {
return;
}
- IClasspathEntry[] newEntries = new IClasspathEntry[entries.length - 1];
- int i = 0;
+
+ List<IClasspathEntry> entriesList = new ArrayList<IClasspathEntry>();
for (IClasspathEntry entry : entries) {
- if (!entry.toString().contains(jarName)) {
- newEntries[i++] = entry;
+ if (entry != null) {
+ IPath path = entry.getPath();
+ if (path != null) {
+ if (path != null && path.lastSegment() != null
+ && path.lastSegment().equals(jarName)) {
+ continue;
+ }
+ }
+ entriesList.add(entry);
}
}
- entries = newEntries;
+ entries = entriesList.toArray(new IClasspathEntry[0]);
}
}
Show replies by date