You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Lyor Goldstein (Jira)" <ji...@apache.org> on 2020/07/26 14:42:00 UTC
[jira] [Work started] (SSHD-1043) Property: Simplify overwriting of
default value
[ https://issues.apache.org/jira/browse/SSHD-1043?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on SSHD-1043 started by Lyor Goldstein.
--------------------------------------------
> 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
>
> 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: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org