/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package org.apache.jmeter.report.config;

import org.apache.jmeter.report.core.ArgumentNullException;

/**
 * The class ConfigurationUtils provides helper method for configuration
 * handling.
 * 
 * @since 2.14
 */
public class ConfigurationUtils {

    private static final String NOT_SUPPORTED_CONVERTION_FMT = "Convert \"%s\" to \"%s\" is not supported";

    /**
     * Instantiates a new configuration utils.
     */
    private ConfigurationUtils() {
    }

    /**
     * Convert the specified string value to the property type.
     *
     * @param <TProperty>
     *            the type of the property
     * @param value
     *            the string value
     * @param clazz
     *            the class of the property
     * @return the converted string
     * @throws ConfigurationException
     *             when unable to convert the string
     */
    public static <TProperty> TProperty convert(String value,
        Class<TProperty> clazz) throws ConfigurationException {
    if (clazz == null) {
        throw new ArgumentNullException("clazz");
    }

    TProperty result;
    if (clazz.isAssignableFrom(String.class)) {
        result = (TProperty) value;
    } else {
        StringConverter<TProperty> converter = Converters
            .getConverter(clazz);
        if (converter == null) {
        throw new ConfigurationException(String.format(
                NOT_SUPPORTED_CONVERTION_FMT, value, clazz.getName()));
        }

        try {
        result = converter.convert(value);
        } catch (ConvertException ex) {
        throw new ConfigurationException(String.format(
                NOT_SUPPORTED_CONVERTION_FMT, value, clazz.getName()),
                ex);
        }
    }
    return result;
    }
}

@@ -1789,16 +1789,20 @@
 ption %7B%0A
+    
     if (
@@ -1810,32 +1810,36 @@
 lazz == null) %7B%0A
+    
         throw ne
@@ -1876,23 +1876,31 @@
 %22);%0A    
-%7D%0A%0A
+    %7D%0A%0A   
     
+ 
 TPropert
@@ -1905,24 +1905,28 @@
 rty result;%0A
+    
     if (claz
@@ -1961,32 +1961,36 @@
 ass)) %7B%0A        
+   
+ 
 result = (TPrope
@@ -2001,16 +2001,20 @@
  value;%0A
+    
     %7D el
@@ -2026,16 +2026,20 @@
         
+  
+  
 StringCo
@@ -2092,16 +2092,24 @@
         
+      
+  
 .getConv
@@ -2122,16 +2122,20 @@
 clazz);%0A
+    
         
@@ -2159,32 +2159,40 @@
 null) %7B%0A        
+ 
+       
 throw new Config
@@ -2231,32 +2231,40 @@
                 
+       
+ 
 NOT_SUPPORTED_CO
@@ -2311,27 +2311,34 @@
         
-%7D%0A%0A
+    %7D%0A%0A   
         
 try %7B%0A  
@@ -2329,16 +2329,17 @@
         
+ 
 try %7B%0A  
@@ -2336,32 +2336,40 @@
   try %7B%0A        
+      
+  
 result = convert
@@ -2395,16 +2395,20 @@
         
+    
 %7D catch 
@@ -2431,32 +2431,40 @@
 n ex) %7B%0A        
+  
+      
 throw new Config
@@ -2503,32 +2503,40 @@
                 
+ 
+       
 NOT_SUPPORTED_CO
@@ -2594,12 +2594,34 @@
     
-ex);
+        ex);%0A            %7D
 %0A   
@@ -2627,26 +2627,24 @@
       %7D%0A    
-%7D%0A
     return r

Correct indentation.