[MDSAL-3] MacAddress flaws Created: 05/Dec/13  Updated: 09/Mar/18  Resolved: 17/Oct/16

Status: Resolved
Project: mdsal
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Michal Rehak Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All



 Description   

Greetings,
in ietf-yang-types project there is generated class MacAddress having following flaws:

  • Pattern is not thread safe - should not be compiled once in static block
  • field patterns is not accessible so it can't be really validated

Questions/Suggestions:

  • why is it not validated in contructor (string version)?
  • if it is not efficient to validate at creation time, can the regex pattern list be exposed to validate later?


 Comments   
Comment by Robert Varga [ 23/Jan/14 ]

The thread safety issues have been fixed. The proposed changes will be address after Hydrogen release by introducing a static factory method of the form:

public static MacAddress checkedCreate(String value);

which will perform validation.

Comment by Jozef Gloncak [ 05/Mar/14 ]

investigating

Comment by Jozef Gloncak [ 11/Mar/14 ]

following changes were made
method checkedCreate generation was added to ClassTemplate.xtend

  • situation when union type is generated isn't fixed (how many
    checkedCreate methods should be generated - one for every union type
    with pattern or one common checkedCreate method?)
  • building constant PATTERN_CONSTANT_NAME and pattern list was removed
    from TypeProviderImpl and was moved directly to ClassTemplate.xtend

https://git.opendaylight.org/gerrit/#/c/5589/

Comment by Robert Varga [ 18/Mar/15 ]

This has been partially fixed. The checkCreate has not been created and needs to be addressed in the next binding spec.

Comment by Robert Varga [ 17/Oct/16 ]

Patterns are enforced in the constructor and there is an IetfInetUtils class to help with known-good MAC address creation.

Generated at Wed Feb 07 20:08:23 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.