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 4731a53 Use a switch instead of a cascading if-else. 4731a53 is described below commit 4731a53b710dadfa95656df9d1adc8beb01aee8f Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri Nov 20 15:25:40 2020 -0500 Use a switch instead of a cascading if-else. --- .../configuration2/PropertiesConfiguration.java | 63 +++++++++++----------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java b/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java index a85b1fc..1ef5e5d 100644 --- a/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java +++ b/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java @@ -1403,44 +1403,43 @@ public class PropertiesConfiguration extends BaseConfiguration // handle an escaped value hadSlash = false; - if (ch == 'r') - { + switch (ch) { + case 'r': out.append('\r'); - } - else if (ch == 'f') - { + break; + case 'f': out.append('\f'); - } - else if (ch == 't') - { + break; + case 't': out.append('\t'); - } - else if (ch == 'n') - { + break; + case 'n': out.append('\n'); - } - // JUP does not recognize \b - else if (!jupCompatible && ch == 'b') - { - out.append('\b'); - } - else if (ch == 'u') - { - // uh-oh, we're in unicode country.... - inUnicode = true; - } - else if (needsUnescape(ch)) - { - out.append(ch); - } - else - { - // JUP simply throws away the \ of unknown escape sequences - if (!jupCompatible) + break; + default: + if (!jupCompatible && ch == 'b') + { + out.append('\b'); + } + else if (ch == 'u') { - out.append('\\'); + // uh-oh, we're in unicode country.... + inUnicode = true; } - out.append(ch); + else if (needsUnescape(ch)) + { + out.append(ch); + } + else + { + // JUP simply throws away the \ of unknown escape sequences + if (!jupCompatible) + { + out.append('\\'); + } + out.append(ch); + } + break; } continue;