David Ostrovsky created SSHD-1043:
-------------------------------------

             Summary: 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


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