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

Bug 350176

Summary: Incorrect SSH Settings Summary string. The 'port' value is modified, not appended.
Product: [Tools] Target Management Reporter: Dan Bourque <Dan.Bourque>
Component: TerminalAssignee: dsdp.tm.core-inbox <tm.core-inbox>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: eclipse, uwe.st
Version: unspecified   
Target Milestone: 4.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Dan Bourque CLA 2011-06-23 14:09:39 EDT
Build Identifier: 2.1.0.v201101042155

Please look at SshSettings.java:37.

Instead of appending the port to the settings summary string, the port value is being added to the ':' char's value, and that value is added to the string.  The result is that the Terminal window's title is incorrect, when connecting to an SSH port other than 22.

Therefore, Instead of...
   SSH: (username@172.28.40.220:28873
...I get...
   SSH: (username@172.28.40.22028931

The connection, however, is correct.  It's just the aesthetic System Summary, used in the view's title, that is incorrect.

I believe the solution is to use double-quotes in the building of the string, instead of the ':' char directly, in the method SshSettings.getSummary().

    public String getSummary() {
        String settings = getUser()+'@'+getHost();
        if(getPort()!=22) {
            settings += ":" + getPort();
        }
        return settings;
    }

Cheers,
Dan.

Reproducible: Always

Steps to Reproduce:
Simply connect a TM Terminal view to an SSH port that is anything other than the default port 22.
Comment 1 Qiangsheng Wang CLA 2011-06-23 23:32:42 EDT
Created attachment 198507 [details]
Patch

calls getPortString() instead of getPort() could fix the problem.
Comment 2 Uwe Stieber CLA 2015-05-07 07:22:47 EDT
Fixed with TM Terminal 4.0
Comment 3 Martin Oberhuber CLA 2015-05-22 11:56:11 EDT
Looking at the description of the issue in comment 0, and at line 39 here:

http://git.eclipse.org/c/tm/org.eclipse.tm.terminal.git/tree/plugins/org.eclipse.tm.terminal.connector.ssh/src/org/eclipse/tm/terminal/connector/ssh/connector/SshSettings.java

I think that the issue is _not_ fixed yet. It might be an implementation detail of the JVM being used how the expression is actually evaluated.
Comment 4 Uwe Stieber CLA 2015-05-23 03:37:24 EDT
Well, for the sake of consistency I've changed that single line. See the latest version of SshSettings.java.

Nonetheless, the issue WAS FIXED without that change. The connector getSettingSummary() method is NOT USED to make the terminal title anymore. Therefore, the terminal title is correct even without that change. The settings summary string is internal only now.

In fact, the getSettingsSummary()/getSummary() API is obsolete and it would be much better if the settings would implement proper equals() methods, because the getSettingsSummary()/getSummary() API is used only to compare two sets of settings.