Skip to content

#752: Add getKeys to JSch which makes access to all the config values…#753

Merged
mwiede merged 4 commits into
mwiede:masterfrom
davsclaus:getkeys
Jan 24, 2025
Merged

#752: Add getKeys to JSch which makes access to all the config values…#753
mwiede merged 4 commits into
mwiede:masterfrom
davsclaus:getkeys

Conversation

@davsclaus
Copy link
Copy Markdown
Contributor

… possible for troubleshooting.

Copy link
Copy Markdown
Contributor

@norrisjeremy norrisjeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a new method like this would be more valuable, since it would provide users the entire config and not just the config keys:

public static Map<String, String> getConfig() {
  Map<String, String> ret = new HashMap<>();
  synchronized (config) {
    for (Map.Entry<String, String> entry : config.entrySet()) {
      String key = entry.getKey();
      if (key.equals("PubkeyAcceptedKeyTypes")) {
        key = "PubkeyAcceptedAlgorithms";
      }
      ret.put(key, entry.getValue());
    }
  }
  return Collections.unmodifiableMap(ret);
}

@davsclaus
Copy link
Copy Markdown
Contributor Author

Thanks I have updated the PR

}

@Test
void getConfigKeys() throws Exception {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this test method, since it is now testing a method named getConfig() and not getConfigKeys()?

Comment thread src/main/java/com/jcraft/jsch/JSch.java Outdated
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this unused java.util.Set import that SonarQube is pointing out?

}

@Test
void getConfig() throws Exception {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SonarQube points out that no method in this test case throws a checked Exception, so can we drop the throws Exception clause?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the other tests does the same

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll put on my TODO list to clean that up.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@norrisjeremy norrisjeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Copy Markdown
Contributor

@norrisjeremy norrisjeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you squash all the changesets together on this branch into one atomic changeset?

@mwiede
Copy link
Copy Markdown
Owner

mwiede commented Jan 24, 2025

@norrisjeremy I will squash it when merging

@davsclaus
Copy link
Copy Markdown
Contributor Author

I think you can make GH have a button "squash and merge" that is what we do at Apache Camel

@davsclaus
Copy link
Copy Markdown
Contributor Author

created a new PR this can be closed

Copy link
Copy Markdown
Contributor

@norrisjeremy norrisjeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@norrisjeremy
Copy link
Copy Markdown
Contributor

@norrisjeremy I will squash it when merging

Ok, that works too. Your choice whether to squash and merge this one or use the new #754.

@davsclaus
Copy link
Copy Markdown
Contributor Author

i suggest you try the "squash and merge" button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants