Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-336

GeneratedTypeBuilderImpl allows add property with null name

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 2176

    Description

      GeneratedTypeBuilderImpl allows add property with null name. The Preconditions.checkArgument(name != null,"...") test is missing in the method addProperty(String name) in the class AbstractGeneratedTypeBuilder.

      Example:

      GeneratedTypeBuilderImpl generatedTypeBuilder = new GeneratedTypeBuilderImpl(
      "my.package", "MyName");

      GeneratedPropertyBuilder propertyBuilderNull = generatedTypeBuilder.addProperty(null);

      propertyBuilderNull != null //true

      GeneratedType instance = generatedTypeBuilder.toInstance();
      List<GeneratedProperty> properties = instance.getProperties();

      properties.size() //1
      properties.contains(propertyBuilderNull.toInstance(instance)) //true

      Notice: The containsProperty method have this check:
      public boolean containsProperty(final String name) {
      Preconditions.checkArgument(name != null, "Parameter name can't be null");

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pkajsa Peter Kajsa
            pkajsa Peter Kajsa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: