Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Jan 24, 2025

Conversation

davsclaus
Copy link
Contributor

… possible for troubleshooting.

Copy link
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
Contributor Author

Thanks I have updated the PR

@@ -64,6 +68,26 @@ void checkLoggerBehavior() throws Exception {
assertSame(JSch.DEVNULL, jsch.getInstanceLogger(), "instance logger should be DEVNULL");
}

@Test
void getConfigKeys() throws Exception {
Copy link
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()?

import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
Copy link
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?

@@ -64,6 +67,26 @@ void checkLoggerBehavior() throws Exception {
assertSame(JSch.DEVNULL, jsch.getInstanceLogger(), "instance logger should be DEVNULL");
}

@Test
void getConfig() throws Exception {
Copy link
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
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
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.

Copy link
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
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
Owner

mwiede commented Jan 24, 2025

@norrisjeremy I will squash it when merging

@davsclaus
Copy link
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
Contributor Author

created a new PR this can be closed

Copy link
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
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
Contributor Author

i suggest you try the "squash and merge" button

@mwiede mwiede merged commit 1fd3a2c into mwiede:master Jan 24, 2025
8 checks passed
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