Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-2835

SCR plugin: Parsing of "options" for property tag broken for javadoc annotations

    XMLWordPrintableJSON

Details

    Description

      A property with options should use the key=value parameters after the "options" parameter as name=label for the metatype options:

      @scr.property type="String" value="one" options one="One" two="Two" three="Three"

      However, it produces this single option:

      <Option value="one=One" label="three=Three"/>

      The problem is that this loop in org.apache.felix.scrplugin.helper.PropertyHandler.processProperty() [0] is inherently broken due to both a "j++" in the for loop and a "j += 2" at the end, and a parameters[j+2]:

      for (int j=0; j < parameters.length; j++) {
      if (Constants.PROPERTY_OPTIONS.equals(parameters[j]))

      { options = new LinkedHashMap<String, String>(); }

      else if (options != null) {
      String optionLabel = parameters[j];
      String optionValue = (j < parameters.length-2) ? parameters[j+2] : null;
      if (optionValue != null)

      { options.put(optionLabel, optionValue); }

      j += 2;
      }
      }

      Without having debugged it, I guess it should be parameters[j+1] and j+=1, as you only skip one parameter for reading the label, not two (given that one="One" is represented as two parameters "one" and "One").

      [0] http://svn.apache.org/repos/asf/felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/PropertyHandler.java

      Attachments

        Issue Links

          Activity

            People

              cziegeler Carsten Ziegeler
              alexander.klimetschek Alexander Klimetschek
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: