231659 EAR Libraries classpath container missing entries
diff --git a/features/org.eclipse.jst.web_core.feature.patch/buildnotes_org.eclipse.jst.web_core.feature.patch.html b/features/org.eclipse.jst.web_core.feature.patch/buildnotes_org.eclipse.jst.web_core.feature.patch.html index b8df666..c3dff6f 100644 --- a/features/org.eclipse.jst.web_core.feature.patch/buildnotes_org.eclipse.jst.web_core.feature.patch.html +++ b/features/org.eclipse.jst.web_core.feature.patch/buildnotes_org.eclipse.jst.web_core.feature.patch.html
@@ -30,4 +30,6 @@ <p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=227620'>227620</a>. EAR Import adds unnecessary dependencies</p> <p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=221229'>221229</a>. A module with linked resources should not be considered single root</p> <p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=229478'>229478</a>. ComponentSaveStrategyImpl needs to respect deploy paths</p> +<p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=231659'>231659</a>. EAR Libraries classpath container missing entries</p> + </body></html> \ No newline at end of file
diff --git a/features/org.eclipse.jst.web_core.feature.patch/feature.properties b/features/org.eclipse.jst.web_core.feature.patch/feature.properties index 9522144..5630ac0 100644 --- a/features/org.eclipse.jst.web_core.feature.patch/feature.properties +++ b/features/org.eclipse.jst.web_core.feature.patch/feature.properties
@@ -39,11 +39,12 @@ Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=215538 Several problems with J2EE and Web Dependencies properties pages\n\ Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=216460 renaming an EAR removes resources from ResourceTreeNode\n\ Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=217138 EAR Libraries needs to follow export rules\n\ -Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=159017 'J2EE Modules Dependencies' pref page fails to load if ... \n\ +Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=159017 J2EE Modules Dependencies pref page fails to load if ... \n\ Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=220958 J2EEFlexProjDeployable isSingleRootStructure is false for web modules with non-manifest binary dependencies\n\ Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=227620 EAR Import adds unnecessary dependencies \n\ Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=221229 A module with linked resources should not be considered single root\n\ Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=229478 ComponentSaveStrategyImpl needs to respect deploy paths\n\ +Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=231659 EAR Libraries classpath container missing entries\n\ \n\ # "copyright" property - text of the "Feature Update Copyright"
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java index d44054c..7c0992b 100644 --- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java +++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java
@@ -38,6 +38,7 @@ import org.eclipse.jem.util.logger.proxy.Logger; import org.eclipse.jst.common.jdt.internal.classpath.ClasspathDecorations; import org.eclipse.jst.common.jdt.internal.classpath.ClasspathDecorationsManager; +import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent; import org.eclipse.jst.j2ee.internal.common.J2EECommonMessages; import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; @@ -98,7 +99,7 @@ return true; } - IVirtualReference[] refs = component.getReferences(); + IVirtualReference[] refs = component instanceof J2EEModuleVirtualComponent ? ((J2EEModuleVirtualComponent)component).getReferences(true): component.getReferences(); IVirtualComponent comp = null; // avoid updating the container if references haven't changed @@ -160,7 +161,8 @@ IVirtualComponent comp = null; IVirtualReference ref = null; - IVirtualReference[] refs = component.getReferences(); + IVirtualReference[] refs = component instanceof J2EEModuleVirtualComponent ? ((J2EEModuleVirtualComponent)component).getReferences(true): component.getReferences(); + List refsList = new ArrayList(); Set refedComps = new HashSet(); refedComps.add(component);
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java index 9ee5720..bbfb2f8 100644 --- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java +++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java
@@ -39,6 +39,7 @@ public class J2EEModuleVirtualComponent extends VirtualComponent implements IComponentImplFactory { private IVirtualReference[] cachedReferences; + private IVirtualReference[] cachedFuzzyEARReferences; private long depGraphModStamp; public J2EEModuleVirtualComponent() { @@ -62,12 +63,16 @@ } public IVirtualReference[] getReferences() { - IVirtualReference[] cached = getCachedReferences(); + return getReferences(false); + } + + public IVirtualReference[] getReferences(boolean findFuzzyEARRefs){ + IVirtualReference[] cached = getCachedReferences(findFuzzyEARRefs); if (cached != null) return cached; IVirtualReference[] hardReferences = getNonManifestReferences(); - List dynamicReferences = J2EEModuleVirtualComponent.getManifestReferences(this, hardReferences); + List dynamicReferences = J2EEModuleVirtualComponent.getManifestReferences(this, hardReferences, findFuzzyEARRefs); IVirtualReference[] references = null; if (dynamicReferences == null) { @@ -94,9 +99,15 @@ // Returns cache if still valid or null public IVirtualReference[] getCachedReferences() { - if (cachedReferences != null && checkIfStillValid()) + return getCachedReferences(false); + } + + public IVirtualReference[] getCachedReferences(boolean findFuzzyEARRefs) { + if(findFuzzyEARRefs && cachedFuzzyEARReferences != null && checkIfStillValid()){ + return cachedFuzzyEARReferences; + } else if (cachedReferences != null && checkIfStillValid()){ return cachedReferences; - else + } depGraphModStamp = DependencyGraphManager.getInstance().getModStamp(); return null; } @@ -135,8 +146,11 @@ } - public static List getManifestReferences(IVirtualComponent moduleComponent, IVirtualReference[] hardReferences) { + return getManifestReferences(moduleComponent, hardReferences, false); + } + + public static List getManifestReferences(IVirtualComponent moduleComponent, IVirtualReference[] hardReferences, boolean findFuzzyEARRefs) { List dynamicReferences = null; String [] manifestClasspath = getManifestClasspath(moduleComponent); @@ -145,10 +159,16 @@ boolean simplePath = false; if (manifestClasspath != null && manifestClasspath.length > 0) { + boolean [] foundRefAlready = findFuzzyEARRefs ? new boolean[manifestClasspath.length]: null; + if(null != foundRefAlready){ + for(int i=0; i<foundRefAlready.length; i++){ + foundRefAlready[i] = false; + } + } IProject[] earProjects = J2EEProjectUtilities.getAllProjectsInWorkspaceOfType(J2EEProjectUtilities.ENTERPRISE_APPLICATION); - IVirtualReference[] earRefs = null; - for (int i = 0; i < earProjects.length && null == earRefs; i++) { - IVirtualComponent tempEARComponent = ComponentCore.createComponent(earProjects[i]); + for (int earIndex = 0; earIndex < earProjects.length; earIndex++) { + IVirtualReference[] earRefs = null; + IVirtualComponent tempEARComponent = ComponentCore.createComponent(earProjects[earIndex]); IVirtualReference[] tempEarRefs = tempEARComponent.getReferences(); for (int j = 0; j < tempEarRefs.length && earRefs == null; j++) { if (tempEarRefs[j].getReferencedComponent().equals(moduleComponent)) { @@ -158,46 +178,65 @@ simplePath = earArchiveURI != null ? earArchiveURI.lastIndexOf("/") == -1 : true; //$NON-NLS-1$ } } - } - - if (null != earRefs) { - for (int i = 0; i < manifestClasspath.length; i++) { - boolean found = false; - for (int j = 0; j < earRefs.length && !found; j++) { - if(foundRef != earRefs[j]){ - String archiveName = earRefs[j].getArchiveName(); - if (null != archiveName){ - boolean shouldAdd = false; - if(simplePath && manifestClasspath[i].lastIndexOf("/") == -1){ //$NON-NLS-1$ - shouldAdd = archiveName.equals(manifestClasspath[i]); - } else { - String earRelativeURI = ArchiveUtil.deriveEARRelativeURI(manifestClasspath[i], earArchiveURI); - if(null != earRelativeURI){ - shouldAdd = earRelativeURI.equals(archiveName); + if (null != earRefs) { + for (int manifestIndex = 0; manifestIndex < manifestClasspath.length; manifestIndex++) { + boolean found = false; + if(foundRefAlready != null && foundRefAlready[manifestIndex]){ + continue; + } + for (int j = 0; j < earRefs.length && !found; j++) { + if(foundRef != earRefs[j]){ + String archiveName = earRefs[j].getArchiveName(); + if (null != archiveName){ + boolean shouldAdd = false; + if(simplePath && manifestClasspath[manifestIndex].lastIndexOf("/") == -1){ //$NON-NLS-1$ + shouldAdd = archiveName.equals(manifestClasspath[manifestIndex]); + } else { + String earRelativeURI = ArchiveUtil.deriveEARRelativeURI(manifestClasspath[manifestIndex], earArchiveURI); + if(null != earRelativeURI){ + shouldAdd = earRelativeURI.equals(archiveName); + } } - } - - if(shouldAdd){ - found = true; - boolean shouldInclude = true; - IVirtualComponent dynamicComponent = earRefs[j].getReferencedComponent(); - if(null != hardReferences){ - for (int k = 0; k < hardReferences.length && shouldInclude; k++) { - if (hardReferences[k].getReferencedComponent().equals(dynamicComponent)) { - shouldInclude = false; + + if(shouldAdd){ + if(findFuzzyEARRefs){ + foundRefAlready[manifestIndex] = true; + } + found = true; + boolean shouldInclude = true; + IVirtualComponent dynamicComponent = earRefs[j].getReferencedComponent(); + if(null != hardReferences){ + for (int k = 0; k < hardReferences.length && shouldInclude; k++) { + if (hardReferences[k].getReferencedComponent().equals(dynamicComponent)) { + shouldInclude = false; + } } } - } - if (shouldInclude) { - IVirtualReference dynamicReference = ComponentCore.createReference(moduleComponent, dynamicComponent); - if (null == dynamicReferences) { - dynamicReferences = new ArrayList(); + if (shouldInclude) { + IVirtualReference dynamicReference = ComponentCore.createReference(moduleComponent, dynamicComponent); + if (null == dynamicReferences) { + dynamicReferences = new ArrayList(); + } + dynamicReferences.add(dynamicReference); } - dynamicReferences.add(dynamicReference); } } } } + + } + if(!findFuzzyEARRefs){ + break; + } else { + boolean foundAll = true; + for(int i = 0; i < foundRefAlready.length && foundAll; i++){ + if(!foundRefAlready[i]){ + foundAll = false; + } + } + if(foundAll){ + break; + } } } }