[jbosstools-dev] Error in org.jboss.tools.ws.core.test
grid.qian
fqian at redhat.com
Wed Oct 22 04:24:30 EDT 2008
I have created a jira :https://jira.jboss.org/jira/browse/JBIDE-2955
I will fix it at once.
Grid
> The error happens in the
> org.jboss.tools.ws.core.classpath.JBossWSRuntimeClassPathInitializer$JBossWSRuntimeClasspathContainer.removeEntry
> method :
>
> public void removeEntry(String jarName) {
> if (entries == null) {
> return;
> }
> IClasspathEntry[] newEntries = new IClasspathEntry[entries.length -
> 1];
> int i = 0;
> for (IClasspathEntry entry : entries) {
> if (!entry.toString().contains(jarName)) {
> newEntries[i++] = entry;
> }
> }
> entries = newEntries;
> }
>
> The method will throw AIOOB exception if an entry named jarName
> doesn't exist.
> There is yet another issue in this method. If, for instance, a
> classpath contains the following entries:
> ...
> a.jar
> aa.jar
> aba.jar
> ...
> and a client calls removeEntry("a.jar"), the method will remove all
> the above mentioned entries.
> A solution for this issue would be the following :
>
> public void removeEntry(String jarName) {
> if (entries == null) {
> return;
> }
> List<IClasspathEntry> entriesList = new ArrayList<IClasspathEntry>();
> for (IClasspathEntry entry : entries) {
> 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 = entriesList.toArray(new IClasspathEntry[0]);
> }
>
> There is a similar issue in the
> org.jboss.tools.esb.core.runtime.JBossRuntimeClassPathInitializer.JBossRuntimeClasspathContainer.removeEntry
> method
>
> Snjeza
> _______________________________________________
> jbosstools-dev mailing list
> jbosstools-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
More information about the jbosstools-dev
mailing list