Skip to content

Commit 6db5a07

Browse files
author
Gary Gregory
committed
Raise embedded if into parent.
1 parent 57aba98 commit 6db5a07

4 files changed

Lines changed: 19 additions & 27 deletions

File tree

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,10 +2195,8 @@ public static Collection<File> listFilesAndDirs(
21952195
* @see File#mkdirs()
21962196
*/
21972197
private static File mkdirs(final File directory) throws IOException {
2198-
if (directory != null) {
2199-
if (!directory.mkdirs() && !directory.isDirectory()) {
2200-
throw new IOException("Cannot create directory '" + directory + "'.");
2201-
}
2198+
if ((directory != null) && (!directory.mkdirs() && !directory.isDirectory())) {
2199+
throw new IOException("Cannot create directory '" + directory + "'.");
22022200
}
22032201
return directory;
22042202
}

src/main/java/org/apache/commons/io/input/BOMInputStream.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,11 @@ public ByteOrderMark getBOM() throws IOException {
218218
}
219219
// match BOM in firstBytes
220220
byteOrderMark = find();
221-
if (byteOrderMark != null) {
222-
if (!include) {
223-
if (byteOrderMark.length() < firstBytes.length) {
224-
fbIndex = byteOrderMark.length();
225-
} else {
226-
fbLength = 0;
227-
}
221+
if ((byteOrderMark != null) && !include) {
222+
if (byteOrderMark.length() < firstBytes.length) {
223+
fbIndex = byteOrderMark.length();
224+
} else {
225+
fbLength = 0;
228226
}
229227
}
230228
}

src/main/java/org/apache/commons/io/input/WindowsLineEndingInputStream.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,9 @@ public int read() throws IOException {
8585
if (eofSeen) {
8686
return eofGame();
8787
}
88-
if (target == LF) {
89-
if (!prevWasSlashR) {
90-
injectSlashN = true;
91-
return CR;
92-
}
88+
if ((target == LF) && !prevWasSlashR) {
89+
injectSlashN = true;
90+
return CR;
9391
}
9492
return target;
9593
}

src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,17 +368,15 @@ public XmlStreamReader(final InputStream inputStream, final String httpContentTy
368368

369369
private void doLenientDetection(String httpContentType,
370370
XmlStreamReaderException ex) throws IOException {
371-
if (httpContentType != null) {
372-
if (httpContentType.startsWith("text/html")) {
373-
httpContentType = httpContentType.substring("text/html"
374-
.length());
375-
httpContentType = "text/xml" + httpContentType;
376-
try {
377-
doHttpStream(ex.getInputStream(), httpContentType, true);
378-
ex = null;
379-
} catch (final XmlStreamReaderException ex2) {
380-
ex = ex2;
381-
}
371+
if ((httpContentType != null) && httpContentType.startsWith("text/html")) {
372+
httpContentType = httpContentType.substring("text/html"
373+
.length());
374+
httpContentType = "text/xml" + httpContentType;
375+
try {
376+
doHttpStream(ex.getInputStream(), httpContentType, true);
377+
ex = null;
378+
} catch (final XmlStreamReaderException ex2) {
379+
ex = ex2;
382380
}
383381
}
384382
if (ex != null) {

0 commit comments

Comments
 (0)