Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 123302 Details for
Bug 261914
JEEDeployableFactory causing NPE because of invalid cache
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for 3.0.4
261914.txt (text/plain), 4.38 KB, created by
Jason Sholl
on 2009-01-21 17:19:13 EST
(
hide
)
Description:
patch for 3.0.4
Filename:
MIME Type:
Creator:
Jason Sholl
Created:
2009-01-21 17:19:13 EST
Size:
4.38 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.j2ee >Index: j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java >=================================================================== >RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java,v >retrieving revision 1.50.2.1 >diff -u -r1.50.2.1 J2EEDeployableFactory.java >--- j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java 2 Dec 2008 21:45:56 -0000 1.50.2.1 >+++ j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java 21 Jan 2009 22:13:36 -0000 >@@ -12,6 +12,7 @@ > > import java.util.ArrayList; > import java.util.HashMap; >+import java.util.Iterator; > import java.util.List; > import java.util.Map; > >@@ -68,7 +69,17 @@ > } > > public ModuleDelegate getModuleDelegate(IModule module) { >- return (ModuleDelegate) moduleDelegates.get(module); >+ if (module == null) >+ return null; >+ >+ ModuleDelegate md = (ModuleDelegate) moduleDelegates.get(module); >+ >+ if (md == null) { >+ createModules(module.getProject()); >+ md = (ModuleDelegate) moduleDelegates.get(module); >+ } >+ >+ return md; > } > > protected IModule[] createModuleDelegates(IVirtualComponent component) { >@@ -171,7 +182,22 @@ > }; > } > >- protected void clearCache() { >- moduleDelegates = new HashMap(5); >+ protected void clearCache(IProject project) { >+ super.clearCache(project); >+ List<IModule> modulesToRemove = null; >+ for (Iterator<IModule> iterator = moduleDelegates.keySet().iterator(); iterator.hasNext();) { >+ IModule module = iterator.next(); >+ if (module.getProject().equals(project)) { >+ if (modulesToRemove == null) { >+ modulesToRemove = new ArrayList<IModule>(); >+ } >+ modulesToRemove.add(module); >+ } >+ } >+ if (modulesToRemove != null) { >+ for (IModule module : modulesToRemove) { >+ moduleDelegates.remove(module); >+ } >+ } > } > } >#P org.eclipse.jst.jee >Index: earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java >=================================================================== >RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java,v >retrieving revision 1.5.4.2 >diff -u -r1.5.4.2 JEEDeployableFactory.java >--- earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java 2 Dec 2008 21:45:59 -0000 1.5.4.2 >+++ earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java 21 Jan 2009 22:13:37 -0000 >@@ -13,6 +13,7 @@ > import java.util.ArrayList; > import java.util.Arrays; > import java.util.HashMap; >+import java.util.Iterator; > import java.util.List; > import java.util.Map; > >@@ -40,7 +41,7 @@ > * J2EE module factory. > */ > public class JEEDeployableFactory extends ProjectModuleFactoryDelegate { >- protected Map moduleDelegates = new HashMap(5); >+ protected Map <IModule, ModuleDelegate> moduleDelegates = new HashMap<IModule, ModuleDelegate>(5); > > public static final String ID = "org.eclipse.jst.jee.server"; //$NON-NLS-1$ > >@@ -70,7 +71,17 @@ > } > > public ModuleDelegate getModuleDelegate(IModule module) { >- return (ModuleDelegate) moduleDelegates.get(module); >+ if (module == null) >+ return null; >+ >+ ModuleDelegate md = (ModuleDelegate) moduleDelegates.get(module); >+ >+ if (md == null) { >+ createModules(module.getProject()); >+ md = (ModuleDelegate) moduleDelegates.get(module); >+ } >+ >+ return md; > } > > protected IModule[] createModuleDelegates(IVirtualComponent component) { >@@ -172,8 +183,25 @@ > new Path(".settings/org.eclipse.wst.common.project.facet.core.xml") // facets > }; > } >- >- protected void clearCache() { >- moduleDelegates = new HashMap(5); >+ >+ protected void clearCache(IProject project) { >+ super.clearCache(project); >+ List<IModule> modulesToRemove = null; >+ for (Iterator<IModule> iterator = moduleDelegates.keySet().iterator(); iterator.hasNext();) { >+ IModule module = iterator.next(); >+ if (module.getProject().equals(project)) { >+ if (modulesToRemove == null) { >+ modulesToRemove = new ArrayList<IModule>(); >+ } >+ modulesToRemove.add(module); >+ } >+ } >+ if (modulesToRemove != null) { >+ for (IModule module : modulesToRemove) { >+ moduleDelegates.remove(module); >+ } >+ } > } >+ >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261914
:
123302
|
123303