Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-797

Union's stringValue() does not handle BitsTypeObject

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Highest
    • Resolution: Done
    • 11.0.0, 11.0.1, 11.0.2
    • 11.0.3
    • Binding codegen

    Description

      Detected in downstream integration. For the following snippet:

        typedef access-operations-type {
          type bits {
            bit create {
            }
            bit read {
            }
            bit update {
            }
            bit delete {
            }
            bit exec {
            }
          }
        }
      
        leaf access-operations {
          type union {
            type matchall-string-type;
            type access-operations-type;
          }
          default *;
        } 

      we end up generating this code:

              public String stringValue() {
                  if (_matchallStringType != null) {
                      return _matchallStringType.getValue().toString();
                  }
                  if (_accessOperationsType != null) {
                      return Arrays.toString(_accessOperationsType.getValue());
                  }
                  throw new IllegalStateException("No value assigned");
              }
      

      The reference in Arrays.toString() is wrong – it needs to call values(), as there is no getValue() method ever since we have BitsTypeObject.

      Attachments

        Issue Links

          # Subject Branch Project Status CR V

          Activity

            People

              rovarga Robert Varga
              rovarga Robert Varga
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: