Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
maven-scr-plugin-1.6.0, scr generator 1.0.0
-
None
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]))
else if (options != null) {
String optionLabel = parameters[j];
String optionValue = (j < parameters.length-2) ? parameters[j+2] : null;
if (optionValue != null)
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").
Attachments
Issue Links
- breaks
-
FELIX-2945 SCR plugin: Parsing of "options" for property tag broken for java annotations
- Closed