[jbosstools-issues] [JBoss JIRA] (JBIDE-26304) File Eclipse bugzilla reporting J2EEDeployableFactory module cache bug
Andre Dietisheim (JIRA)
issues at jboss.org
Mon Aug 13 18:05:00 EDT 2018
[ https://issues.jboss.org/browse/JBIDE-26304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andre Dietisheim updated JBIDE-26304:
-------------------------------------
Description:
JBIDE-22318 was reported that the OpenShift Server adapter does not respect the "openshift" maven profile of a project.
While implementing it was discovered that *J2EEDeployableFactory* is not clearing it's module cache when the *deploy-name* in *.settings/org.eclipse.wst.common.component* is changed.
The following steps assume a change in maven profile which leads to a change in the deploy-name. The same can be achieved by simply editing *.settings/org.eclipse.wst.common.component* in an Eclipse editor, leaving maven aside.
I have recorded the following screencast: https://www.youtube.com/watch?v=V_SdtXYkJHA&feature=youtu.be
h2. Steps:
# ASSERT: I have a maven project "hello" where switching the profile switches the deployment name from *hello.war* (no profile selected) to *ROOT.war* (profile "openshift" selected).
# ASSERT: Initially I have
{code:title=<workspace>hello/.settings/org.eclipse.wst.common.component}
deploy-name="hello"
{code}.
# ASSERT: Looking at the configured modules for my server adapter I see the module being called *hello*.
# EXEC: I go project preferences > Maven and choose the "openshift" profile
# ASSERT: I see component settings being updated on disk.
{code:title=<workspace>hello/.settings/org.eclipse.wst.common.component}
deploy-name="ROOT"
{code}.
# RESULT: the configured module for my OpenShift server adapter is still called *hello*.
# ASSERT: the configured module for my OpenShift server adapter should be called *hello(ROOT)*.
# EXEC: If I now go to some project property which updates the maven config (ex. Web Content Settings) and hit "Apply and Close"
# RESULT: The available modules for my OpenShift Server adapter are updated, the configured module is now updated and called *hello(ROOT)*
h2. Fix:
To fix this bad behaviour one has to change *J2EEDeployableFactory* in the following way:
{code:title=org.eclipse.jst.j2ee.internal.deployables.J2EEDeployableFactory}
protected void cleanAllDelegates() {
Iterator<FlatComponentDeployable> i = moduleDelegates.values().iterator();
while(i.hasNext()) {
i.next().clearCache();
}
+ clearModuleCache();
modulesChanged();
}
+ @Override
+ public void clearModuleCache() {
+ clearCache(null);
+ }
{code}
ps. notice the oddness in terms of API:
{code}protected void clearCache(IProject project){code} has a parameter *IProject* but it's not being used in this class, nor in the super classes.
h2. Task
We need to file a bugzilla reporting this and create a PR as a solution.
was:
JBIDE-22318 was reported that the OpenShift Server adapter does not respect the "openshift" maven profile of a project.
While implementing it was discovered that *J2EEDeployableFactory* is not clearing it's module cache when the *deploy-name* in *.settings/org.eclipse.wst.common.component* is changed.
The following steps assume a change in maven profile which leads to a change in the deploy-name. The same can be achieved by simply editing *.settings/org.eclipse.wst.common.component* in an Eclipse editor, leaving maven aside.
I have recorded the following screencast: https://www.youtube.com/watch?v=V_SdtXYkJHA&feature=youtu.be
h2. Steps:
# ASSERT: I have a maven project "hello" where switching the profile switches the deployment name from *hello.war* (no profile selected) to *ROOT.war* (profile "openshift" selected).
# ASSERT: Initially I have
{code:title=<workspace>hello/.settings/org.eclipse.wst.common.component}
deploy-name="hello"
{code}.
# ASSERT: Looking at the configured modules for my server adapter I see the module being called *hello*.
# EXEC: I go project preferences > Maven and choose the "openshift" profile
# ASSERT: I see component settings being updated on disk.
{code:title=<workspace>hello/.settings/org.eclipse.wst.common.component}
deploy-name="ROOT"
{code}.
# RESULT: the configured module for my OpenShift server adapter is still called *hello*.
# ASSERT: the configured module for my OpenShift server adapter should be called *hello(ROOT)*.
# EXEC: If I now go to some project property which updates the maven config (ex. Web Content Settings) and hit "Apply and Close"
# RESULT: The available modules for my OpenShift Server adapter are updated, the configured module is now updated and called *hello(ROOT)*
h2. Fix:
To fix this bad behaviour one has to change *J2EEDeployableFactory* in the following way:
{code:title=org.eclipse.jst.j2ee.internal.deployables.J2EEDeployableFactory}
protected void cleanAllDelegates() {
Iterator<FlatComponentDeployable> i = moduleDelegates.values().iterator();
while(i.hasNext()) {
i.next().clearCache();
}
+ clearModuleCache();
modulesChanged();
}
+ @Override
+ public void clearModuleCache() {
+ clearCache(null);
+ }
{code}
ps. notice the oddness in terms of API:
{code}protected void clearCache(IProject project){code} has a parameter *IProject* but it's not being used in this class, nor in the super classes.
h3. Task
We need to file a bugzilla reporting this and create a PR as a solution.
> File Eclipse bugzilla reporting J2EEDeployableFactory module cache bug
> ----------------------------------------------------------------------
>
> Key: JBIDE-26304
> URL: https://issues.jboss.org/browse/JBIDE-26304
> Project: Tools (JBoss Tools)
> Issue Type: Task
> Components: openshift
> Affects Versions: 4.9.0.AM3
> Reporter: Andre Dietisheim
> Fix For: 4.9.0.AM3
>
>
> JBIDE-22318 was reported that the OpenShift Server adapter does not respect the "openshift" maven profile of a project.
> While implementing it was discovered that *J2EEDeployableFactory* is not clearing it's module cache when the *deploy-name* in *.settings/org.eclipse.wst.common.component* is changed.
> The following steps assume a change in maven profile which leads to a change in the deploy-name. The same can be achieved by simply editing *.settings/org.eclipse.wst.common.component* in an Eclipse editor, leaving maven aside.
> I have recorded the following screencast: https://www.youtube.com/watch?v=V_SdtXYkJHA&feature=youtu.be
> h2. Steps:
> # ASSERT: I have a maven project "hello" where switching the profile switches the deployment name from *hello.war* (no profile selected) to *ROOT.war* (profile "openshift" selected).
> # ASSERT: Initially I have
> {code:title=<workspace>hello/.settings/org.eclipse.wst.common.component}
> deploy-name="hello"
> {code}.
> # ASSERT: Looking at the configured modules for my server adapter I see the module being called *hello*.
> # EXEC: I go project preferences > Maven and choose the "openshift" profile
> # ASSERT: I see component settings being updated on disk.
> {code:title=<workspace>hello/.settings/org.eclipse.wst.common.component}
> deploy-name="ROOT"
> {code}.
> # RESULT: the configured module for my OpenShift server adapter is still called *hello*.
> # ASSERT: the configured module for my OpenShift server adapter should be called *hello(ROOT)*.
> # EXEC: If I now go to some project property which updates the maven config (ex. Web Content Settings) and hit "Apply and Close"
> # RESULT: The available modules for my OpenShift Server adapter are updated, the configured module is now updated and called *hello(ROOT)*
> h2. Fix:
> To fix this bad behaviour one has to change *J2EEDeployableFactory* in the following way:
> {code:title=org.eclipse.jst.j2ee.internal.deployables.J2EEDeployableFactory}
> protected void cleanAllDelegates() {
> Iterator<FlatComponentDeployable> i = moduleDelegates.values().iterator();
> while(i.hasNext()) {
> i.next().clearCache();
> }
> + clearModuleCache();
> modulesChanged();
> }
> + @Override
> + public void clearModuleCache() {
> + clearCache(null);
> + }
> {code}
> ps. notice the oddness in terms of API:
> {code}protected void clearCache(IProject project){code} has a parameter *IProject* but it's not being used in this class, nor in the super classes.
> h2. Task
> We need to file a bugzilla reporting this and create a PR as a solution.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jbosstools-issues
mailing list