[ https://issues.apache.org/jira/browse/SSHD-1043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17165301#comment-17165301 ]
Lyor Goldstein commented on SSHD-1043: -------------------------------------- {quote} And the ISE is thrown now. It doesn't look right, or what am I missing? {quote} I think there is a misunderstanding - {{getOrCustomDefault}} simply states that if no specific default value was provided then the custom default is returned. Since by your own description {quote} there is no other place in the code that would override the value {quote} The code therefore returns 16K which is the default for this value. {code:java} public static final Property<Integer> MAX_IDENTIFICATION_SIZE = Property.integer("max-identification-size", 16 * 1024); {code} In other words, {{getOrCustomDefault}} will "kick in" only if no default value exists for a property - which is not the case for this property. > 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: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org