Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-26304

File Eclipse bugzilla reporting J2EEDeployableFactory module cache bug

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Major
    • 4.9.0.AM3
    • 4.9.0.AM3
    • openshift
    • None
    • devex #154 September 2018
    • 4

    Description

      JBIDE-22138 reported that the OpenShift Server adapter does not respect the "openshift" maven profile of a project.
      While implementing it we discovered that J2EEDeployableFactory is not clearing it's module cache when the deploy-name in .settings/org.eclipse.wst.common.component is changed.
      We need to file an Eclipse bug that reports this an create a PR for it (see Fix further down)

      Steps:

      I have recorded the following screencast: https://www.youtube.com/watch?v=V_SdtXYkJHA&feature=youtu.be

      1. EXEC: create a server adapter Basic/J2EE Preview
      2. EXEC: import maven-moduletest as maven project into your workspace
      3. EXEC: in Servers view, ctx menu for J2EE Preview: choose "Add and Remove..." and check the name of the available module maven-moduletest -> it's called maven-moduletest
      4. EXEC: in Project Explorer, ctx-menu for maven-moduletest: pick Maven > Select Maven Profiles... & check the "openshift" profile
      5. EXEC: in Servers view, ctx menu for J2EE Preview: choose "Add and Remove..." and check the name of the available module maven-moduletest

      Result:
      the available module os called maven-moduletest but it should be called maven-moduletest(ROOT) - the "openshift" maven profile overrides the <warName> property to ROOT which should set the deploy name, which it doesn't

      with the fix applied (pasted above in Comment 1) the module is correctly called maven-moduletest(ROOT) (step 5).

      Fix:

      To fix this bad behaviour one has to change J2EEDeployableFactory in the following way:

      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);
      +	}
      

      ps. notice the oddness in terms of API:

      protected void clearCache(IProject project)

      has a parameter IProject but it's not being used in this class, nor in the super classes.

      Attachments

        Issue Links

          Activity

            People

              adietish@redhat.com André Dietisheim
              adietish@redhat.com André Dietisheim
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: