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-io.git
commit 6db5a0750a4e7f82ce32e61d9f9c94c75080f3c0 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Mon Feb 22 16:10:01 2021 -0500 Raise embedded if into parent. --- src/main/java/org/apache/commons/io/FileUtils.java | 6 ++---- .../org/apache/commons/io/input/BOMInputStream.java | 12 +++++------- .../io/input/WindowsLineEndingInputStream.java | 8 +++----- .../io/input/compatibility/XmlStreamReader.java | 20 +++++++++----------- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java index 76d17f2..f464e9a 100644 --- a/src/main/java/org/apache/commons/io/FileUtils.java +++ b/src/main/java/org/apache/commons/io/FileUtils.java @@ -2195,10 +2195,8 @@ public class FileUtils { * @see File#mkdirs() */ private static File mkdirs(final File directory) throws IOException { - if (directory != null) { - if (!directory.mkdirs() && !directory.isDirectory()) { - throw new IOException("Cannot create directory '" + directory + "'."); - } + if ((directory != null) && (!directory.mkdirs() && !directory.isDirectory())) { + throw new IOException("Cannot create directory '" + directory + "'."); } return directory; } diff --git a/src/main/java/org/apache/commons/io/input/BOMInputStream.java b/src/main/java/org/apache/commons/io/input/BOMInputStream.java index 4e030aa..5b2d037 100644 --- a/src/main/java/org/apache/commons/io/input/BOMInputStream.java +++ b/src/main/java/org/apache/commons/io/input/BOMInputStream.java @@ -218,13 +218,11 @@ public class BOMInputStream extends ProxyInputStream { } // match BOM in firstBytes byteOrderMark = find(); - if (byteOrderMark != null) { - if (!include) { - if (byteOrderMark.length() < firstBytes.length) { - fbIndex = byteOrderMark.length(); - } else { - fbLength = 0; - } + if ((byteOrderMark != null) && !include) { + if (byteOrderMark.length() < firstBytes.length) { + fbIndex = byteOrderMark.length(); + } else { + fbLength = 0; } } } diff --git a/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java b/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java index 653ceab..9a42e74 100644 --- a/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java +++ b/src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java @@ -85,11 +85,9 @@ public class WindowsLineEndingInputStream extends InputStream { if (eofSeen) { return eofGame(); } - if (target == LF) { - if (!prevWasSlashR) { - injectSlashN = true; - return CR; - } + if ((target == LF) && !prevWasSlashR) { + injectSlashN = true; + return CR; } return target; } diff --git a/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java b/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java index e8d98d3..36920ed 100644 --- a/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java +++ b/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java @@ -368,17 +368,15 @@ public class XmlStreamReader extends Reader { private void doLenientDetection(String httpContentType, XmlStreamReaderException ex) throws IOException { - if (httpContentType != null) { - if (httpContentType.startsWith("text/html")) { - httpContentType = httpContentType.substring("text/html" - .length()); - httpContentType = "text/xml" + httpContentType; - try { - doHttpStream(ex.getInputStream(), httpContentType, true); - ex = null; - } catch (final XmlStreamReaderException ex2) { - ex = ex2; - } + if ((httpContentType != null) && httpContentType.startsWith("text/html")) { + httpContentType = httpContentType.substring("text/html" + .length()); + httpContentType = "text/xml" + httpContentType; + try { + doHttpStream(ex.getInputStream(), httpContentType, true); + ex = null; + } catch (final XmlStreamReaderException ex2) { + ex = ex2; } } if (ex != null) {