[ 
https://issues.apache.org/jira/browse/SSHD-1043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17165298#comment-17165298
 ] 

David Ostrovsky edited comment on SSHD-1043 at 7/26/20, 5:40 PM:
-----------------------------------------------------------------

Thanks [~lgoldstein] for adding new method.

Can it be, that some usages of \{{getOrNull()}} in sshd code could be replaced 
with \{{getOrCustomDefault()}} as well?

E.g. in 
{code:java}
protected Collection<Integer> resolveAclSupportedCapabilities(ServerSession 
session) {
    String override = 
SftpModuleProperties.ACL_SUPPORTED_MASK.getOrNull(session);
    if (override == null) {
        return DEFAULT_ACL_SUPPORTED_MASK;
    }

{code}
 And other occurrences of {{getOrNull}} methods in 
src/main/java/org/apache/sshd/sftp/server/AbstractSftpSubsystemHelper.java and 
other files?

More over, while trying to migrate to JGit project to mina-sshd@HEAD, I still 
see one unit test failing:

[https://git.eclipse.org/r/c/jgit/jgit/+/166824/7/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java#342]
 
{code:java}
private static final int DEFAULT_MAX_IDENTIFICATION_SIZE = 64 * 1024;

[...]

int maxIdentSize = MAX_IDENTIFICATION_SIZE.getOrCustomDefault(this,

        DEFAULT_MAX_IDENTIFICATION_SIZE);

{code}
The test is still failing, as would the method \{{getOrCustomDefault}} return 
old default (16kb) but not the new custom default (64kb): 
[http://paste.openstack.org/show/796310.]

What am I missing?

 

 


was (Author: davido2):
Thanks [~lgoldstein] for adding new method.

Can it be, that some usages of `getOrNull()` in sshd code could be replaced 
with `getOrCustomDefault()` as well?

E.g. in 

 

{code:java}

protected Collection<Integer> resolveAclSupportedCapabilities(ServerSession 
session) {
    String override = 
SftpModuleProperties.ACL_SUPPORTED_MASK.getOrNull(session);
    if (override == null) {
        return DEFAULT_ACL_SUPPORTED_MASK;
    }

{code}

 

And other occurrences of `getOrNull` methods in 
src/main/java/org/apache/sshd/sftp/server/AbstractSftpSubsystemHelper.java and 
other files?

More over, while trying to migrate to mina-sshd@HEAD, I still see one unit test 
is failing:

[https://git.eclipse.org/r/c/jgit/jgit/+/166824/7/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java#342]

 

{code:java}

private static final int DEFAULT_MAX_IDENTIFICATION_SIZE = 64 * 1024;

[...]

int maxIdentSize = MAX_IDENTIFICATION_SIZE.getOrCustomDefault(this,

        DEFAULT_MAX_IDENTIFICATION_SIZE);

{code}

 

The test is still failing, as would the method `getOrCustomDefault` return old 
default (16kb) but not the new custom default (64kb): 
[http://paste.openstack.org/show/796310.]

What am I missing?

 

 

> Property: Simplify overwriting of default value
> -----------------------------------------------
>
>                 Key: SSHD-1043
>                 URL: https://issues.apache.org/jira/browse/SSHD-1043
>             Project: MINA SSHD
>          Issue Type: New Feature
>    Affects Versions: 2.6.0
>            Reporter: David Ostrovsky
>            Assignee: Lyor Goldstein
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> Currently, to overwrite default value is somewhat complicated, e.g.:
>  
> {code:java}
> /**
>  * Default setting for the maximum number of bytes to read in the initial
>  * protocol version exchange. 64kb is what OpenSSH < 8.0 read; OpenSSH 8.0
>  * changed it to 8Mb, but that seems excessive for the purpose stated in RFC
>  * 4253. The Apache MINA sshd default in
>  * \{@link FactoryManager#DEFAULT_MAX_IDENTIFICATION_SIZE} is 16kb.
>  */
>  private static final int DEFAULT_MAX_IDENTIFICATION_SIZE = 64 * 1024;
> // Overwrite default:
>  int maxIdentSize;
>  Integer maxIdentSizeCustom = MAX_IDENTIFICATION_SIZE.getOrNull(this);
>  if (maxIdentSizeCustom == null) maxIdentSize = 
> DEFAULT_MAX_IDENTIFICATION_SIZE;
>  else maxIdentSize = maxIdentSizeCustom.intValue();
> {code}
>  
> I think, it could be simplified if new method `getOrCustomDefault` would be 
> provided:
>  
> {code:java}
> int maxIdentSize = MAX_IDENTIFICATION_SIZE.getOrCustomDefault(
>         this, DEFAULT_MAX_IDENTIFICATION_SIZE);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to