elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1305598002
##########
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##########
@@ -465,6 +469,28 @@ public void getRemoteFile(
}
}
+ private void copyFile(File source, File destination) throws IOException {
+ String message;
+ if (!source.exists()) {
+ message = "File " + source + " does not exist";
+ throw new IOException(message);
+ } else if
(!source.getCanonicalPath().equals(destination.getCanonicalPath())) {
+ File parentFile = destination.getParentFile();
+ if (parentFile != null && !parentFile.exists()) {
+ parentFile.mkdirs();
+ }
+ Files.copy(
+ source.toPath(),
+ destination.toPath(),
+ StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.COPY_ATTRIBUTES);
+ if (source.length() != destination.length()) {
Review Comment:
Even with this check it's not safe against concurrent modifications outside
this thread or process. I'm willing to assume the JDK method behaves as
documented until proven otherwise. And inlining questionable code is no better
than writing it from scratch. This block should go.
##########
maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java:
##########
@@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) {
test = test.substring(1);
}
- boolean result = Os.isFamily(test);
+ boolean result = isFamily(test);
if (reverse) {
return !result;
} else {
return result;
}
}
+
+ private boolean isFamily(String family) {
Review Comment:
This can likely be made static, though I wonder if there's more work to be
done here. Netware? Windows 98? It amazes me that in one thread I'm trying to
convince folks not to drop support for the widely used Java 8 while over here
in this PR I'm seeing support for OSs that were defunct circa Java 1.4.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]