This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-configuration.git


The following commit(s) were added to refs/heads/master by this push:
     new 5151c6a  No need to nest in else.
5151c6a is described below

commit 5151c6a6df48e86151ddffd3638eed45a4cedd65
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Mar 5 13:42:27 2021 -0500

    No need to nest in else.
---
 .../AbstractYAMLBasedConfiguration.java            |   9 +-
 .../BaseHierarchicalConfiguration.java             |   8 +-
 .../commons/configuration2/DataConfiguration.java  |  14 +-
 .../configuration2/PropertiesConfiguration.java    |  22 +-
 .../StrictConfigurationComparator.java             |   2 +-
 .../configuration2/convert/PropertyConverter.java  | 302 +++++++++------------
 .../commons/configuration2/io/FileHandler.java     |   9 +-
 .../commons/configuration2/io/VFSFileSystem.java   |  11 +-
 .../xpath/ConfigurationNodeIteratorChildren.java   |   3 +-
 .../tree/xpath/ConfigurationNodePointer.java       |   2 +-
 .../tree/xpath/XPathExpressionEngine.java          |  24 +-
 .../web/ServletRequestConfiguration.java           |  27 +-
 .../configuration2/beanutils/TestBeanHelper.java   |   9 +-
 13 files changed, 177 insertions(+), 265 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/configuration2/AbstractYAMLBasedConfiguration.java
 
b/src/main/java/org/apache/commons/configuration2/AbstractYAMLBasedConfiguration.java
index e20f274..4b5ac58 100644
--- 
a/src/main/java/org/apache/commons/configuration2/AbstractYAMLBasedConfiguration.java
+++ 
b/src/main/java/org/apache/commons/configuration2/AbstractYAMLBasedConfiguration.java
@@ -147,15 +147,12 @@ public class AbstractYAMLBasedConfiguration extends 
BaseHierarchicalConfiguratio
         {
             return parseMap((Map<String, Object>) elem, key);
         }
-        else if (elem instanceof Collection)
+        if (elem instanceof Collection)
         {
             return parseCollection((Collection<Object>) elem, key);
         }
-        else
-        {
-            return Collections.singletonList(
-                    new 
ImmutableNode.Builder().name(key).value(elem).create());
-        }
+        return Collections.singletonList(
+                new ImmutableNode.Builder().name(key).value(elem).create());
     }
 
     /**
diff --git 
a/src/main/java/org/apache/commons/configuration2/BaseHierarchicalConfiguration.java
 
b/src/main/java/org/apache/commons/configuration2/BaseHierarchicalConfiguration.java
index 0a91c5b..34f1f4b 100644
--- 
a/src/main/java/org/apache/commons/configuration2/BaseHierarchicalConfiguration.java
+++ 
b/src/main/java/org/apache/commons/configuration2/BaseHierarchicalConfiguration.java
@@ -817,14 +817,10 @@ public class BaseHierarchicalConfiguration extends 
AbstractHierarchicalConfigura
                     while (children.hasNext())
                     {
                         nd = children.next();
-                        if (refHandler.getReference(nd) == null)
-                        {
-                            newNodes.add(nd);
-                        }
-                        else
-                        {
+                        if (refHandler.getReference(nd) != null) {
                             break;
                         }
+                        newNodes.add(nd);
                     }
 
                     // Insert all new nodes
diff --git 
a/src/main/java/org/apache/commons/configuration2/DataConfiguration.java 
b/src/main/java/org/apache/commons/configuration2/DataConfiguration.java
index ab66c17..27585de 100644
--- a/src/main/java/org/apache/commons/configuration2/DataConfiguration.java
+++ b/src/main/java/org/apache/commons/configuration2/DataConfiguration.java
@@ -1036,14 +1036,11 @@ public class DataConfiguration extends 
AbstractConfiguration
         {
             return value;
         }
-        else if (isThrowExceptionOnMissing())
+        if (isThrowExceptionOnMissing())
         {
             throw new NoSuchElementException('\'' + key + "' doesn't map to an 
existing object");
         }
-        else
-        {
-            return null;
-        }
+        return null;
     }
 
     /**
@@ -1280,14 +1277,11 @@ public class DataConfiguration extends 
AbstractConfiguration
         {
             return value;
         }
-        else if (isThrowExceptionOnMissing())
+        if (isThrowExceptionOnMissing())
         {
             throw new NoSuchElementException('\'' + key + "' doesn't map to an 
existing object");
         }
-        else
-        {
-            return null;
-        }
+        return null;
     }
 
     /**
diff --git 
a/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java 
b/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java
index 42c08e1..adbec5a 100644
--- 
a/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java
+++ 
b/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java
@@ -434,16 +434,12 @@ public class PropertiesConfiguration extends 
BaseConfiguration
                     line = line.substring(i);
                 }
 
-                if (checkCombineLines(line))
-                {
-                    line = line.substring(0, line.length() - 1);
-                    buffer.append(line);
-                }
-                else
-                {
+                if (!checkCombineLines(line)) {
                     buffer.append(line);
                     break;
                 }
+                line = line.substring(0, line.length() - 1);
+                buffer.append(line);
             }
             return buffer.toString();
         }
@@ -793,16 +789,12 @@ public class PropertiesConfiguration extends 
BaseConfiguration
 
                 line = line.trim();
 
-                if (checkCombineLines(line))
-                {
-                    line = line.substring(0, line.length() - 1);
-                    buffer.append(line);
-                }
-                else
-                {
+                if (!checkCombineLines(line)) {
                     buffer.append(line);
                     break;
                 }
+                line = line.substring(0, line.length() - 1);
+                buffer.append(line);
             }
             return buffer.toString();
         }
@@ -1443,7 +1435,7 @@ public class PropertiesConfiguration extends 
BaseConfiguration
 
                 continue;
             }
-            else if (ch == '\\')
+            if (ch == '\\')
             {
                 hadSlash = true;
                 continue;
diff --git 
a/src/main/java/org/apache/commons/configuration2/StrictConfigurationComparator.java
 
b/src/main/java/org/apache/commons/configuration2/StrictConfigurationComparator.java
index fd1a855..bf46ad9 100644
--- 
a/src/main/java/org/apache/commons/configuration2/StrictConfigurationComparator.java
+++ 
b/src/main/java/org/apache/commons/configuration2/StrictConfigurationComparator.java
@@ -50,7 +50,7 @@ public class StrictConfigurationComparator implements 
ConfigurationComparator
         {
             return true;
         }
-        else if (a == null || b == null)
+        if (a == null || b == null)
         {
             return false;
         }
diff --git 
a/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java
 
b/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java
index d878db6..ddf98f4 100644
--- 
a/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java
+++ 
b/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java
@@ -108,41 +108,41 @@ final class PropertyConverter
         {
             return toBoolean(value);
         }
-        else if (Character.class.equals(cls) || Character.TYPE.equals(cls))
+        if (Character.class.equals(cls) || Character.TYPE.equals(cls))
         {
             return toCharacter(value);
         }
-        else if (Number.class.isAssignableFrom(cls) || cls.isPrimitive())
+        if (Number.class.isAssignableFrom(cls) || cls.isPrimitive())
         {
             if (Integer.class.equals(cls) || Integer.TYPE.equals(cls))
             {
                 return toInteger(value);
             }
-            else if (Long.class.equals(cls) || Long.TYPE.equals(cls))
+            if (Long.class.equals(cls) || Long.TYPE.equals(cls))
             {
                 return toLong(value);
             }
-            else if (Byte.class.equals(cls) || Byte.TYPE.equals(cls))
+            if (Byte.class.equals(cls) || Byte.TYPE.equals(cls))
             {
                 return toByte(value);
             }
-            else if (Short.class.equals(cls) || Short.TYPE.equals(cls))
+            if (Short.class.equals(cls) || Short.TYPE.equals(cls))
             {
                 return toShort(value);
             }
-            else if (Float.class.equals(cls) || Float.TYPE.equals(cls))
+            if (Float.class.equals(cls) || Float.TYPE.equals(cls))
             {
                 return toFloat(value);
             }
-            else if (Double.class.equals(cls) || Double.TYPE.equals(cls))
+            if (Double.class.equals(cls) || Double.TYPE.equals(cls))
             {
                 return toDouble(value);
             }
-            else if (BigInteger.class.equals(cls))
+            if (BigInteger.class.equals(cls))
             {
                 return toBigInteger(value);
             }
-            else if (BigDecimal.class.equals(cls))
+            if (BigDecimal.class.equals(cls))
             {
                 return toBigDecimal(value);
             }
@@ -219,19 +219,15 @@ final class PropertyConverter
         {
             return (Boolean) value;
         }
-        else if (value instanceof String)
-        {
-            final Boolean b = BooleanUtils.toBooleanObject((String) value);
-            if (b == null)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to a Boolean object");
-            }
-            return b;
+        if (!(value instanceof String)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to a Boolean object");
         }
-        else
+        final Boolean b = BooleanUtils.toBooleanObject((String) value);
+        if (b == null)
         {
             throw new ConversionException("The value " + value + " can't be 
converted to a Boolean object");
         }
+        return b;
     }
 
     /**
@@ -474,18 +470,15 @@ final class PropertyConverter
         {
             return (File) value;
         }
-        else if (value instanceof Path)
+        if (value instanceof Path)
         {
             return ((Path) value).toFile();
         }
-        else if (value instanceof String)
+        if (value instanceof String)
         {
             return new File((String) value);
         }
-        else
-        {
-            throw new ConversionException("The value " + value + " can't be 
converted to a File");
-        }
+        throw new ConversionException("The value " + value + " can't be 
converted to a File");
     }
 
     /**
@@ -502,18 +495,15 @@ final class PropertyConverter
         {
             return ((File) value).toPath();
         }
-        else if (value instanceof Path)
+        if (value instanceof Path)
         {
             return (Path) value;
         }
-        else if (value instanceof String)
+        if (value instanceof String)
         {
             return Paths.get((String) value);
         }
-        else
-        {
-            throw new ConversionException("The value " + value + " can't be 
converted to a Path");
-        }
+        throw new ConversionException("The value " + value + " can't be 
converted to a Path");
     }
 
     /**
@@ -529,20 +519,16 @@ final class PropertyConverter
         {
             return (URI) value;
         }
-        else if (value instanceof String)
+        if (!(value instanceof String)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to an URI");
+        }
+        try
         {
-            try
-            {
-                return new URI((String) value);
-            }
-            catch (final URISyntaxException e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to an URI", e);
-            }
+            return new URI((String) value);
         }
-        else
+        catch (final URISyntaxException e)
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to an URI");
+            throw new ConversionException("The value " + value + " can't be 
converted to an URI", e);
         }
     }
 
@@ -559,20 +545,16 @@ final class PropertyConverter
         {
             return (URL) value;
         }
-        else if (value instanceof String)
+        if (!(value instanceof String)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to an URL");
+        }
+        try
         {
-            try
-            {
-                return new URL((String) value);
-            }
-            catch (final MalformedURLException e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to an URL", e);
-            }
+            return new URL((String) value);
         }
-        else
+        catch (final MalformedURLException e)
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to an URL");
+            throw new ConversionException("The value " + value + " can't be 
converted to an URL", e);
         }
     }
 
@@ -589,20 +571,16 @@ final class PropertyConverter
         {
             return (Pattern) value;
         }
-        else if (value instanceof String)
+        if (!(value instanceof String)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to a Pattern");
+        }
+        try
         {
-            try
-            {
-                return Pattern.compile((String) value);
-            }
-            catch (final PatternSyntaxException e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to a Pattern", e);
-            }
+            return Pattern.compile((String) value);
         }
-        else
+        catch (final PatternSyntaxException e)
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to a Pattern");
+            throw new ConversionException("The value " + value + " can't be 
converted to a Pattern", e);
         }
     }
 
@@ -619,25 +597,21 @@ final class PropertyConverter
         {
             return (Locale) value;
         }
-        else if (value instanceof String)
-        {
-            final String[] elements = ((String) value).split("_");
-            final int size = elements.length;
-
-            if (size >= 1 && (elements[0].length() == 2 || 
elements[0].isEmpty()))
-            {
-                final String language = elements[0];
-                final String country = size >= 2 ? elements[1] : "";
-                final String variant = size >= 3 ? elements[2] : "";
-
-                return new Locale(language, country, variant);
-            }
+        if (!(value instanceof String)) {
             throw new ConversionException("The value " + value + " can't be 
converted to a Locale");
         }
-        else
+        final String[] elements = ((String) value).split("_");
+        final int size = elements.length;
+
+        if (size >= 1 && (elements[0].length() == 2 || elements[0].isEmpty()))
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to a Locale");
+            final String language = elements[0];
+            final String country = size >= 2 ? elements[1] : "";
+            final String variant = size >= 3 ? elements[2] : "";
+
+            return new Locale(language, country, variant);
         }
+        throw new ConversionException("The value " + value + " can't be 
converted to a Locale");
     }
 
     /**
@@ -660,54 +634,50 @@ final class PropertyConverter
         {
             return (Color) value;
         }
-        else if (value instanceof String && !StringUtils.isBlank((String) 
value))
+        if (!(value instanceof String) || StringUtils.isBlank((String) value)) 
{
+            throw new ConversionException("The value " + value + " can't be 
converted to a Color");
+        }
+        String color = ((String) value).trim();
+
+        final int[] components = new int[3];
+
+        // check the size of the string
+        final int minlength = components.length * 2;
+        if (color.length() < minlength)
         {
-            String color = ((String) value).trim();
+            throw new ConversionException("The value " + value + " can't be 
converted to a Color");
+        }
 
-            final int[] components = new int[3];
+        // remove the leading #
+        if (color.startsWith("#"))
+        {
+            color = color.substring(1);
+        }
 
-            // check the size of the string
-            final int minlength = components.length * 2;
-            if (color.length() < minlength)
+        try
+        {
+            // parse the components
+            for (int i = 0; i < components.length; i++)
             {
-                throw new ConversionException("The value " + value + " can't 
be converted to a Color");
+                components[i] = Integer.parseInt(color.substring(2 * i, 2 * i 
+ 2), HEX_RADIX);
             }
 
-            // remove the leading #
-            if (color.startsWith("#"))
+            // parse the transparency
+            int alpha;
+            if (color.length() >= minlength + 2)
             {
-                color = color.substring(1);
+                alpha = Integer.parseInt(color.substring(minlength, minlength 
+ 2), HEX_RADIX);
             }
-
-            try
+            else
             {
-                // parse the components
-                for (int i = 0; i < components.length; i++)
-                {
-                    components[i] = Integer.parseInt(color.substring(2 * i, 2 
* i + 2), HEX_RADIX);
-                }
-
-                // parse the transparency
-                int alpha;
-                if (color.length() >= minlength + 2)
-                {
-                    alpha = Integer.parseInt(color.substring(minlength, 
minlength + 2), HEX_RADIX);
-                }
-                else
-                {
-                    alpha = Color.black.getAlpha();
-                }
-
-                return new Color(components[0], components[1], components[2], 
alpha);
-            }
-            catch (final Exception e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to a Color", e);
+                alpha = Color.black.getAlpha();
             }
+
+            return new Color(components[0], components[1], components[2], 
alpha);
         }
-        else
+        catch (final Exception e)
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to a Color");
+            throw new ConversionException("The value " + value + " can't be 
converted to a Color", e);
         }
     }
 
@@ -726,20 +696,16 @@ final class PropertyConverter
         {
             return (InetAddress) value;
         }
-        else if (value instanceof String)
+        if (!(value instanceof String)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to a InetAddress");
+        }
+        try
         {
-            try
-            {
-                return InetAddress.getByName((String) value);
-            }
-            catch (final UnknownHostException e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to a InetAddress", e);
-            }
+            return InetAddress.getByName((String) value);
         }
-        else
+        catch (final UnknownHostException e)
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to a InetAddress");
+            throw new ConversionException("The value " + value + " can't be 
converted to a InetAddress", e);
         }
     }
 
@@ -758,22 +724,18 @@ final class PropertyConverter
         {
             return value;
         }
-        else if (value instanceof String)
+        if (!(value instanceof String)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to a InternetAddress");
+        }
+        try
         {
-            try
-            {
-                final Constructor<?> ctor = 
Class.forName(INTERNET_ADDRESS_CLASSNAME)
-                        .getConstructor(String.class);
-                return ctor.newInstance(value);
-            }
-            catch (final Exception e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to a InternetAddress", e);
-            }
+            final Constructor<?> ctor = 
Class.forName(INTERNET_ADDRESS_CLASSNAME)
+                    .getConstructor(String.class);
+            return ctor.newInstance(value);
         }
-        else
+        catch (final Exception e)
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to a InternetAddress");
+            throw new ConversionException("The value " + value + " can't be 
converted to a InternetAddress", e);
         }
     }
 
@@ -801,7 +763,7 @@ final class PropertyConverter
         {
             return cls.cast(value);
         }
-        else if (value instanceof String)
+        if (value instanceof String)
         {
             try
             {
@@ -812,19 +774,15 @@ final class PropertyConverter
                 throw new ConversionException("The value " + value + " can't 
be converted to a " + cls.getName());
             }
         }
-        else if (value instanceof Number)
+        if (!(value instanceof Number)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to a " + cls.getName());
+        }
+        try
         {
-            try
-            {
-                final E[] enumConstants = cls.getEnumConstants();
-                return enumConstants[((Number) value).intValue()];
-            }
-            catch (final Exception e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to a " + cls.getName());
-            }
+            final E[] enumConstants = cls.getEnumConstants();
+            return enumConstants[((Number) value).intValue()];
         }
-        else
+        catch (final Exception e)
         {
             throw new ConversionException("The value " + value + " can't be 
converted to a " + cls.getName());
         }
@@ -844,24 +802,20 @@ final class PropertyConverter
         {
             return (Date) value;
         }
-        else if (value instanceof Calendar)
+        if (value instanceof Calendar)
         {
             return ((Calendar) value).getTime();
         }
-        else if (value instanceof String)
+        if (!(value instanceof String)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to a Date");
+        }
+        try
         {
-            try
-            {
-                return new SimpleDateFormat(format).parse((String) value);
-            }
-            catch (final ParseException e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to a Date", e);
-            }
+            return new SimpleDateFormat(format).parse((String) value);
         }
-        else
+        catch (final ParseException e)
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to a Date");
+            throw new ConversionException("The value " + value + " can't be 
converted to a Date", e);
         }
     }
 
@@ -879,28 +833,24 @@ final class PropertyConverter
         {
             return (Calendar) value;
         }
-        else if (value instanceof Date)
+        if (value instanceof Date)
         {
             final Calendar calendar = Calendar.getInstance();
             calendar.setTime((Date) value);
             return calendar;
         }
-        else if (value instanceof String)
+        if (!(value instanceof String)) {
+            throw new ConversionException("The value " + value + " can't be 
converted to a Calendar");
+        }
+        try
         {
-            try
-            {
-                final Calendar calendar = Calendar.getInstance();
-                calendar.setTime(new SimpleDateFormat(format).parse((String) 
value));
-                return calendar;
-            }
-            catch (final ParseException e)
-            {
-                throw new ConversionException("The value " + value + " can't 
be converted to a Calendar", e);
-            }
+            final Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new SimpleDateFormat(format).parse((String) 
value));
+            return calendar;
         }
-        else
+        catch (final ParseException e)
         {
-            throw new ConversionException("The value " + value + " can't be 
converted to a Calendar");
+            throw new ConversionException("The value " + value + " can't be 
converted to a Calendar", e);
         }
     }
 
diff --git 
a/src/main/java/org/apache/commons/configuration2/io/FileHandler.java 
b/src/main/java/org/apache/commons/configuration2/io/FileHandler.java
index 4ffc787..36cc74a 100644
--- a/src/main/java/org/apache/commons/configuration2/io/FileHandler.java
+++ b/src/main/java/org/apache/commons/configuration2/io/FileHandler.java
@@ -246,15 +246,12 @@ public class FileHandler
         {
             return null;
         }
-        else if (loc.getSourceURL() != null)
+        if (loc.getSourceURL() != null)
         {
             return FileLocatorUtils.fileFromURL(loc.getSourceURL());
         }
-        else
-        {
-            return FileLocatorUtils.getFile(loc.getBasePath(),
-                    loc.getFileName());
-        }
+        return FileLocatorUtils.getFile(loc.getBasePath(),
+                loc.getFileName());
     }
 
     /**
diff --git 
a/src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java 
b/src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java
index 792ca75..af126e1 100644
--- a/src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java
+++ b/src/main/java/org/apache/commons/configuration2/io/VFSFileSystem.java
@@ -247,17 +247,14 @@ public class VFSFileSystem extends DefaultFileSystem
             {
                 return fileName;
             }
-            else if (basePath != null)
+            if (basePath != null)
             {
                 final FileName base = resolveURI(basePath);
                 return getManager().resolveName(base, fileName).getURI();
             }
-            else
-            {
-                final FileName name = resolveURI(fileName);
-                final FileName base = name.getParent();
-                return getManager().resolveName(base, 
name.getBaseName()).getURI();
-            }
+            final FileName name = resolveURI(fileName);
+            final FileName base = name.getParent();
+            return getManager().resolveName(base, name.getBaseName()).getURI();
         }
         catch (final FileSystemException fse)
         {
diff --git 
a/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java
 
b/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java
index c9cc17e..1110273 100644
--- 
a/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java
+++ 
b/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java
@@ -120,8 +120,7 @@ class ConfigurationNodeIteratorChildren<T> extends
             return nameTest.isWildcard() ? createSubNodeListForWildcardName(
                     node, name) : createSubNodeListForName(node, name);
         }
-
-        else if (test instanceof NodeTypeTest)
+        if (test instanceof NodeTypeTest)
         {
             final NodeTypeTest typeTest = (NodeTypeTest) test;
             if (typeTest.getNodeType() == Compiler.NODE_TYPE_NODE
diff --git 
a/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java
 
b/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java
index bc6416f..59e932d 100644
--- 
a/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java
+++ 
b/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java
@@ -206,7 +206,7 @@ class ConfigurationNodePointer<T> extends NodePointer
             {
                 return -1;
             }
-            else if (child == node2)
+            if (child == node2)
             {
                 return 1;
             }
diff --git 
a/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
 
b/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
index 7d7fdbf..0bb3a2d 100644
--- 
a/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
+++ 
b/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
@@ -225,26 +225,22 @@ public class XPathExpressionEngine implements 
ExpressionEngine
             // name of the root node
             return StringUtils.EMPTY;
         }
-        else if (handler.nodeName(node) == null)
+        if (handler.nodeName(node) == null)
         {
             // paranoia check for undefined node names
             return parentKey;
         }
-
-        else
+        final StringBuilder buf =
+                new StringBuilder(parentKey.length()
+                        + handler.nodeName(node).length()
+                        + PATH_DELIMITER.length());
+        if (!parentKey.isEmpty())
         {
-            final StringBuilder buf =
-                    new StringBuilder(parentKey.length()
-                            + handler.nodeName(node).length()
-                            + PATH_DELIMITER.length());
-            if (!parentKey.isEmpty())
-            {
-                buf.append(parentKey);
-                buf.append(PATH_DELIMITER);
-            }
-            buf.append(handler.nodeName(node));
-            return buf.toString();
+            buf.append(parentKey);
+            buf.append(PATH_DELIMITER);
         }
+        buf.append(handler.nodeName(node));
+        return buf.toString();
     }
 
     @Override
diff --git 
a/src/main/java/org/apache/commons/configuration2/web/ServletRequestConfiguration.java
 
b/src/main/java/org/apache/commons/configuration2/web/ServletRequestConfiguration.java
index b315cef..a252860 100644
--- 
a/src/main/java/org/apache/commons/configuration2/web/ServletRequestConfiguration.java
+++ 
b/src/main/java/org/apache/commons/configuration2/web/ServletRequestConfiguration.java
@@ -55,28 +55,25 @@ public class ServletRequestConfiguration extends 
BaseWebConfiguration
         {
             return null;
         }
-        else if (values.length == 1)
+        if (values.length == 1)
         {
             return handleDelimiters(values[0]);
         }
-        else
+        // ensure that escape characters in all list elements are removed
+        final List<Object> result = new ArrayList<>(values.length);
+        for (final String value : values)
         {
-            // ensure that escape characters in all list elements are removed
-            final List<Object> result = new ArrayList<>(values.length);
-            for (final String value : values)
+            final Object val = handleDelimiters(value);
+            if (val instanceof Collection)
             {
-                final Object val = handleDelimiters(value);
-                if (val instanceof Collection)
-                {
-                    result.addAll((Collection<?>) val);
-                }
-                else
-                {
-                    result.add(val);
-                }
+                result.addAll((Collection<?>) val);
+            }
+            else
+            {
+                result.add(val);
             }
-            return result;
         }
+        return result;
     }
 
     @Override
diff --git 
a/src/test/java/org/apache/commons/configuration2/beanutils/TestBeanHelper.java 
b/src/test/java/org/apache/commons/configuration2/beanutils/TestBeanHelper.java
index f1cea62..44bd9a2 100644
--- 
a/src/test/java/org/apache/commons/configuration2/beanutils/TestBeanHelper.java
+++ 
b/src/test/java/org/apache/commons/configuration2/beanutils/TestBeanHelper.java
@@ -530,7 +530,7 @@ public class TestBeanHelper
                 helper.initBean(bean, bcc.getBeanDeclaration());
                 return bean;
             }
-            else if (BeanCreationTestBeanWithListChild.class.equals(bcc
+            if (BeanCreationTestBeanWithListChild.class.equals(bcc
                     .getBeanClass()))
             {
                 final BeanCreationTestBeanWithListChild bean =
@@ -538,11 +538,8 @@ public class TestBeanHelper
                 helper.initBean(bean, bcc.getBeanDeclaration());
                 return bean;
             }
-            else
-            {
-                throw new IllegalArgumentException("Unsupported class: "
-                        + bcc.getBeanClass());
-            }
+            throw new IllegalArgumentException("Unsupported class: "
+                    + bcc.getBeanClass());
         }
 
         /**

Reply via email to