Bug 32381 - Couldn't expand/collapse tree branches using Tomcat Administration Tool
Summary: Couldn't expand/collapse tree branches using Tomcat Administration Tool
Status: CLOSED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Webapps:Administration (show other bugs)
Version: 5.5.4
Hardware: PC Linux
: P3 normal with 3 votes (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-24 15:43 UTC by alterhead
Modified: 2004-12-03 09:02 UTC (History)
0 users



Attachments
Source code of the faulty frame (7.07 KB, text/html)
2004-12-01 17:13 UTC, Michel de Bellefon
Details
changes the placeholder lookup key for node to collapse to match new jsp version (1.38 KB, patch)
2004-12-01 23:36 UTC, Allistair Crossley
Details | Diff
changes the tree placeholder key in JSP to non-EL value (694 bytes, patch)
2004-12-01 23:38 UTC, Allistair Crossley
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description alterhead 2004-11-24 15:43:01 UTC
PROBLEM:
When I log on to Tomcat Administration page there is a tree on the left frame. 
However when you click on the any branch that is expandable/collapsable, there 
is no action. All the icons have the same URL:

   http://localhost:8080/admin/treeControlTest.do?tree=

with no node name.

It could be because the some Java servlet (possibly, SetUpTreeAction.class) 
that prepares the tree.

TEMPORARY SOLUTION:
My workaround was to steal the node names from the links that were next to the 
expanding/collapsing icon and craft the correct URL.  For example, for 
a "Service (Catalina)" branch there is a link:

http://localhost:8080/admin/EditService.do?
select=Catalina:type=Service,serviceName=Catalina&nodeLabel=Service+(Catalina).

It seemed like the first parameter is a tree node name, so I crafted the link 
in the address bar: 
http://localhost:8080/admin/treeControlTest.do?
tree=Catalina:type=Service,serviceName=Catalina
and that branch has expanded. Using that link once again collapses the branch.
Comment 1 alterhead 2004-11-29 14:18:30 UTC
Almost forgot - JDK 1.4.2
Comment 2 Michel de Bellefon 2004-12-01 15:59:33 UTC
Same problem with JDK 1.5.0-b64
Comment 3 Remy Maucherat 2004-12-01 16:09:29 UTC
This works for me. Can you actually be more convincing ?
Comment 4 Michel de Bellefon 2004-12-01 17:12:33 UTC
Well, how can I be more convincing? I can see the same symptom as Michael who
originated the bug report, but how to prove that? The only one thing I can think
to is to attach the source code of the faulty left frame of the admin module
(see bug report attachements) which shows the incomplete tree expand/collapse
url as described by Michael.

The config here is :
- Sun Sparc machine
- Solaris 8
- Java is 1.5.0-b64

The problem occurs when using the admin package downloaded at the same time as
Tomcat 5.5.4

Everything is working as a charm using Tomcat 5.0.28.
Comment 5 Michel de Bellefon 2004-12-01 17:13:54 UTC
Created attachment 13612 [details]
Source code of the faulty frame
Comment 6 Remy Maucherat 2004-12-01 17:21:13 UTC
The issue here is that it works for me. What I meant is: you're not doing
anything which convinces me the issue is not that you didn't install things
correctly. Besides, your attached code doesn't look so bad.
So please do not waste time reopening the report.
Comment 7 Allistair Crossley 2004-12-01 17:33:44 UTC
i can also reproduce this issue in a fresh 5.5.4 download and 5.5.4 admin 
download running Java 5.0. 

entering admin app is fine having added credentials to tomcat-users and you 
_can_ click the nodes with the o- icons to load the right hand side but you 
_cannot_ collapse or uncollapse the branch on the left.

Logging when clicking a collapsable icon is

Dec 1, 2004 4:30:53 PM org.apache.catalina.core.ApplicationContext log
INFO: action: Entered TreeControlTestAction:perform()
Dec 1, 2004 4:30:53 PM org.apache.catalina.core.ApplicationContext log
INFO: action: Tree expand/contract on 
Comment 8 alterhead 2004-12-01 18:10:19 UTC
The problem I described appeared while using:
Solaris 2.6
Tomcat 5.5.4 + Admin 5.5.4
JDK 1.4.2

We experience the same problem with the following configuration:
Windows XP
Tomcat 5.5.4 + Admin 5.5.4
JDK 1.5

Remy, please let me know what proofs do you need to convict you that this is a 
problem.

The file that Michel have attached shows that all expandable/collapsable nodes 
point to:
http://nova:8080/admin/treeControlTest.do?tree=
which is the source of the problem.
Comment 9 Allistair Crossley 2004-12-01 18:12:02 UTC
it does appear to be that the tree attribute is not being output for treeControl

    <attribute>
      <name>tree</name>
      <required>false</required>
      <rtexprvalue>true</rtexprvalue>
      <description>
        Name of the attribute (in the scope specified by the "scope"
        attribute, if any) under which an object of type
        org.apache.webapp.admin.TreeControl is stored.  This object
        represents the entire current state of the tree, including
        a representation of the hierarchical representation of the
        nodes, plus the current expanded/ or contracted state of
        non-leaf nodes.
      </description>
    </attribute>

i've rooted around in the code, but don't have further time _right_ now.

There is a parameter in the JSP ${name} that should indicate the node's name 
but it is empty

In the tag code this value is replaced with an encoded version of the node's 
name. node is passed in from looking for a TreeControlNode in a scope, but 
that's as far as I got currently. Maybe Amy would have a better idea (I see she 
fixed a Struts problem yesterday on admin webapp)

        // HACK to take into account special characters like = and &
        // in the node name, could remove this code if encode URL
        // and later request.getParameter() could deal with = and &
        // character in parameter values. 
        String encodedNodeName = URLEncoder.encode(node.getName
(),TomcatTreeBuilder.URL_ENCODING);
Comment 10 Allistair Crossley 2004-12-01 18:15:55 UTC
to view in isolation just request

http://server:8080/admin/treeControlTest.do

from Tomcat 5.5.4 installation

and click on any of the collapse icons (note these have different URLs to the 
text labels which may be why remy thought this worked??)
Comment 11 Remy Maucherat 2004-12-01 20:19:40 UTC
Ok, I retested this, and this doesn't work anymore. Sorry for the trouble.
Comment 12 william.barker 2004-12-01 21:43:15 UTC
I knew that changing admin to be a 2.4 webapp was a bad idea :(.
Comment 13 Allistair Crossley 2004-12-01 23:36:53 UTC
Created attachment 13619 [details]
changes the placeholder lookup key for node to collapse to match new jsp version

fix for 

org.apache.webapp.admin.TreeControlTag
Comment 14 Allistair Crossley 2004-12-01 23:38:22 UTC
Created attachment 13620 [details]
changes the tree placeholder key in JSP to non-EL value

fix for 

admin/tree-control-test.jsp
Comment 15 Allistair Crossley 2004-12-01 23:42:16 UTC
this bug was a result of moving to the 2.4 spec. the placeholder used in the 
tree control tag was ${name} which tomcat will have tried to evaluate as a 
page scoped expression language variable (which does not exist of course as 
this is not the intention).

i have provided patches for the affected JSP and Java files that removes the 
dollar but leaves the braces so it still looks like a placeholder.

i have also grepped all files across the admin webapp to ensure there are no 
more similar bugs involving EL type syntax placeholders and there are not 
(only ${node} but this is in comments only and is not present in code anywhere.

i have compiled and tested with the latest HEAD and the node collapse works 
ok. hope this makes it for 5.5.5 tomorrow.

cheers :)
Comment 16 Yoav Shapira 2004-12-03 18:02:45 UTC
Fixed also on the TOMCAT_5_0 branch, for 5.0.31.