Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337777

Summary: ServerClasspathContainerPage not initialized properly, leads to error when changing page
Product: [WebTools] WTP ServerTools Reporter: Rob Stryker <stryker>
Component: jst.serverAssignee: Angel Vera <arvera>
Status: RESOLVED FIXED QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2.4   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/109037
Whiteboard:
Attachments:
Description Flags
Fixes the initialization
arvera: iplog+
EARtest with no server classpath container none

Description Rob Stryker CLA 2011-02-21 17:22:22 EST
In an ear project, first right-click on the classpath container which maps to a server's classpath container. For example, a classpath container that looks something like:

  org.eclipse.jst.server.core.container/some.plugin.runtimeTarget/ServerName

The ServerClasspathContainerPage does not initialize itself, meaning the viewer has no selection. Further more, clicking on the page name on the left "Classpath Container" brings up an error stating the page has errors.
Comment 1 Rob Stryker CLA 2011-02-21 17:27:23 EST
Created attachment 189451 [details]
Fixes the initialization

The attached patch iterates through the runtime map and compares the classpath containers' getPath() with the getPath() of the initial selection. If it finds a match, it selects the item in the viewer, sets page as complete, and breaks.
Comment 2 Rob Stryker CLA 2011-03-14 19:02:17 EDT
Angel can you squeeze this in please? 

It'd also be a good fix for trunk obviously.
Comment 3 Angel Vera CLA 2011-03-30 17:10:03 EDT
Created attachment 192226 [details]
EARtest with no server classpath container

Not sure how you got to it, but the EARs that I created during my test didn't have a classpath container. Is there a special set of steps to how to recreate the problem?
Comment 4 Rob Stryker CLA 2011-03-31 01:30:23 EDT
Let's do it with a plain old java project:
  1)  Create java project
  2)  Right click java project, go to properties
      a) build path
      b) click "Add Library"
      c) select "Server Runtime"
      d) Pick any server
      e) Click finish
      f) click ok
  3) Note your project has a new classpath container
      a) Check the .classpath file to verify its type:
           <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.your.runtime.type/runtime name"/>
  4) right-click the container, click properties
  5) Note the page comes up
  6) Note that  the viewer has no selection
  7) Select (again) the "Classpath Container" element in the left half of the dialog
  8) Note the exception


I don't mean to complain, but in my opinion the patch is quite small and obvious.  Any project (be it java, dynamic web, or ear) that has this classpath container will suffer from this bug. 

Perhaps it needs to be applied to see exactly where it is in the UI file, but even without applying the patch, you can see quite clearly that it is simply initializing the selection in the viewer to what container was right-clicked and selected.
Comment 5 Angel Vera CLA 2011-04-06 16:50:33 EDT
changes committed to 32M
Comment 6 Angel Vera CLA 2011-04-06 16:54:26 EDT
changes released to 32M
Comment 7 Angel Vera CLA 2011-04-19 11:13:58 EDT
changes committed to HEAD(3.3)
Comment 8 Angel Vera CLA 2011-04-19 15:35:43 EDT
Changes released to HEAD(3.3)
Comment 9 Eclipse Genie CLA 2017-10-11 16:36:13 EDT
New Gerrit change created: https://git.eclipse.org/r/109037