Skip to content

Commit bc73e5b

Browse files
author
Gary Gregory
committed
Remove obsolete comments and code
1 parent 4947b57 commit bc73e5b

1 file changed

Lines changed: 1 addition & 37 deletions

File tree

src/main/java/org/apache/commons/io/file/PathUtils.java

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,10 +1093,7 @@ public static OutputStream newOutputStream(final Path path, final boolean append
10931093
}
10941094

10951095
static OutputStream newOutputStream(final Path path, final LinkOption[] linkOptions, final OpenOption... openOptions) throws IOException {
1096-
if (exists(path, linkOptions)) {
1097-
// requireFile(path, "path");
1098-
// requireCanWrite(path, "path");
1099-
} else {
1096+
if (!exists(path, linkOptions)) {
11001097
createParentDirectories(path, linkOptions != null && linkOptions.length > 0 ? linkOptions[0] : NULL_LINK_OPTION);
11011098
}
11021099
final List<OpenOption> list = new ArrayList<>(Arrays.asList(openOptions != null ? openOptions : EMPTY_OPEN_OPTION_ARRAY));
@@ -1266,22 +1263,6 @@ static List<Path> relativize(final Collection<Path> collection, final Path paren
12661263
return stream.collect(Collectors.toList());
12671264
}
12681265

1269-
/**
1270-
* Throws an {@link IllegalArgumentException} if the file is not writable. This provides a more precise exception
1271-
* message than a plain access denied.
1272-
*
1273-
* @param file The file to test.
1274-
* @param name The parameter name to use in the exception message.
1275-
* @throws NullPointerException if the given {@code Path} is {@code null}.
1276-
* @throws IllegalArgumentException if the file is not writable.
1277-
*/
1278-
private static void requireCanWrite(final Path file, final String name) {
1279-
Objects.requireNonNull(file, "file");
1280-
if (!Files.isWritable(file)) {
1281-
throw new IllegalArgumentException("File parameter '" + name + " is not writable: '" + file + "'");
1282-
}
1283-
}
1284-
12851266
/**
12861267
* Requires that the given {@code File} exists and throws an {@link IllegalArgumentException} if it doesn't.
12871268
*
@@ -1300,23 +1281,6 @@ private static Path requireExists(final Path file, final String fileParamName, f
13001281
return file;
13011282
}
13021283

1303-
/**
1304-
* Requires that the given {@code Path} is a regular file.
1305-
*
1306-
* @param file The {@code Path} to check.
1307-
* @param name The parameter name to use in the exception message.
1308-
* @return the given file.
1309-
* @throws NullPointerException if the given {@code Path} is {@code null}.
1310-
* @throws IllegalArgumentException if the given {@code Path} does not exist or is not a regular file.
1311-
*/
1312-
private static Path requireFile(final Path file, final String name) {
1313-
Objects.requireNonNull(file, name);
1314-
if (!Files.isRegularFile(file)) {
1315-
throw new IllegalArgumentException("Parameter '" + name + "' is not a regular file: " + file);
1316-
}
1317-
return file;
1318-
}
1319-
13201284
private static boolean setDosReadOnly(final Path path, final boolean readOnly, final LinkOption... linkOptions) throws IOException {
13211285
final DosFileAttributeView dosFileAttributeView = getDosFileAttributeView(path, linkOptions);
13221286
if (dosFileAttributeView != null) {

0 commit comments

Comments
 (0)