You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2011/03/13 13:57:00 UTC
[jira] Closed: (FELIX-2835) SCR plugin: Parsing of "options" for
property tag broken for javadoc annotations
[ https://issues.apache.org/jira/browse/FELIX-2835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carsten Ziegeler closed FELIX-2835.
-----------------------------------
> SCR plugin: Parsing of "options" for property tag broken for javadoc annotations
> --------------------------------------------------------------------------------
>
> Key: FELIX-2835
> URL: https://issues.apache.org/jira/browse/FELIX-2835
> Project: Felix
> Issue Type: Bug
> Components: Maven SCR Plugin
> Affects Versions: maven-scr-plugin-1.6.0, scr generator 1.0.0
> Reporter: Alexander Klimetschek
> Assignee: Carsten Ziegeler
> Fix For: maven-scr-plugin-1.7.0, scr ant task 1.1.0, scr generator 1.1.0
>
>
> 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
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira