Raise embedded if into parent.
MODIFY
src/main/java/org/apache/commons/io/FileUtils.java
src/main/java/org/apache/commons/io/FileUtils.java
@@ -2195,11 +2195,9 @@ private static AccumulatorPathVisitor listAccumulate(final File directory, final
* @see File#mkdirs()
*/
private static File mkdirs(final File directory) throws IOException {
- if (directory != null) {
- if (!directory.mkdirs() && !directory.isDirectory()) {
+ if ((directory != null) && (!directory.mkdirs() && !directory.isDirectory())) {
throw new IOException("Cannot create directory '" + directory + "'.");
}
- }
return directory;
}

MODIFY
src/main/java/org/apache/commons/io/input/BOMInputStream.java
src/main/java/org/apache/commons/io/input/BOMInputStream.java
@@ -218,8 +218,7 @@ public ByteOrderMark getBOM() throws IOException {
}
// match BOM in firstBytes
byteOrderMark = find();
- if (byteOrderMark != null) {
- if (!include) {
+ if ((byteOrderMark != null) && !include) {
if (byteOrderMark.length() < firstBytes.length) {
fbIndex = byteOrderMark.length();
} else {
@@ -227,7 +226,6 @@ public ByteOrderMark getBOM() throws IOException {
}
}
}
- }
return byteOrderMark;
}

MODIFY
src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java
src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java
@@ -85,12 +85,10 @@ public int read() throws IOException {
if (eofSeen) {
return eofGame();
}
- if (target == LF) {
- if (!prevWasSlashR) {
+ if ((target == LF) && !prevWasSlashR) {
injectSlashN = true;
return CR;
}
- }
return target;
}
}

MODIFY
src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java
src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java
@@ -368,8 +368,7 @@ public XmlStreamReader(final InputStream inputStream, final String httpContentTy
private void doLenientDetection(String httpContentType,
XmlStreamReaderException ex) throws IOException {
- if (httpContentType != null) {
- if (httpContentType.startsWith("text/html")) {
+ if ((httpContentType != null) && httpContentType.startsWith("text/html")) {
httpContentType = httpContentType.substring("text/html"
.length());
httpContentType = "text/xml" + httpContentType;
@@ -380,7 +379,6 @@ private void doLenientDetection(String httpContentType,
ex = ex2;
}
}
- }
if (ex != null) {
String encoding = ex.getXmlEncoding();
if (encoding == null) {

Raise embedded if into parent.