Author: fschumacher Date: Mon Oct 15 19:27:03 2018 New Revision: 1843940 URL: http://svn.apache.org/viewvc?rev=1843940&view=rev Log: Refactor nested try block to named function
part of #409 on github Modified: jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java Modified: jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java?rev=1843940&r1=1843939&r2=1843940&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java Mon Oct 15 19:27:03 2018 @@ -243,20 +243,7 @@ public class SaveService { log.info("Using SaveService properties file encoding {}", fileEncoding); } else { key = key.substring(1);// Remove the leading "_" - try { - final String trimmedValue = val.trim(); - if (trimmedValue.equals("collection") // $NON-NLS-1$ - || trimmedValue.equals("mapping")) { // $NON-NLS-1$ - registerConverter(key, JMXSAVER, true); - registerConverter(key, JTLSAVER, true); - } else { - registerConverter(key, JMXSAVER, false); - registerConverter(key, JTLSAVER, false); - } - } catch (IllegalAccessException | InstantiationException | ClassNotFoundException | IllegalArgumentException| - SecurityException | InvocationTargetException | NoSuchMethodException e1) { - log.warn("Can't register a converter: {}", key, e1); - } + registerConverter(key, val); } } } @@ -266,6 +253,23 @@ public class SaveService { } } + private static void registerConverter(String key, String val) { + try { + final String trimmedValue = val.trim(); + if (trimmedValue.equals("collection") // $NON-NLS-1$ + || trimmedValue.equals("mapping")) { // $NON-NLS-1$ + registerConverter(key, JMXSAVER, true); + registerConverter(key, JTLSAVER, true); + } else { + registerConverter(key, JMXSAVER, false); + registerConverter(key, JTLSAVER, false); + } + } catch (IllegalAccessException | InstantiationException | ClassNotFoundException | IllegalArgumentException| + SecurityException | InvocationTargetException | NoSuchMethodException e1) { + log.warn("Can't register a converter: {}", key, e1); + } + } + /** * Register converter. * @param key