[ 
https://issues.apache.org/jira/browse/FELIX-2284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Valentin Valchev resolved FELIX-2284.
-------------------------------------

         Assignee: Valentin Valchev
    Fix Version/s: webconsole-3.0.2
       Resolution: Fixed

I have added that method and updated the places where it should be used. This 
fixes a severe problem in the Configuration Printer: 
Before,the configurations were printed until it finds a byte[] property and 
then fails with exception.

> Add common utility method for converting object (array) to string
> -----------------------------------------------------------------
>
>                 Key: FELIX-2284
>                 URL: https://issues.apache.org/jira/browse/FELIX-2284
>             Project: Felix
>          Issue Type: Improvement
>          Components: Web Console
>    Affects Versions: webconsole-3.0.0
>            Reporter: Valentin Valchev
>            Assignee: Valentin Valchev
>             Fix For: webconsole-3.0.2
>
>
> Currently few plugins are making their own methods to convert an object 
> (array) to string. And usually uses different approaches for converting the 
> arrays:
> #1 The following methods will convert array to string like "1, 2, 3". They 
> use StringBuffer and append elements one by one.
> ServicesServlet.propertyAsString()
> ConfigurationRendere.asString()
> #2 Another approach that is used, converts the array to List, and then 
> toString() which returns "[1, 2, 3]"
> ComponentConfigurationPrinter.listProperties()
> ComponentServlet.listProperties()
> #3 in event plugin the code from the method below prints "[1, 2, 3]" but uses 
> approach similar to #1
> PluginServlet.eventJson
> The smaller problem is that we have duplicate code. The bigger problem is 
> that the code ... will not work correctly, if the array is from primitive 
> types (see https://issues.apache.org/jira/browse/FELIX-2142).
> ----
> So my proposal is to add a new utility method, 
> WebConsoleUtil.toString(Object val, boolean addBracesIfArray);
> The other option is to remove addBracesIfArray and always assume, that if it 
> is array, the value is wrapped with [] braces.
> --
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to