mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-14 18:03:44 +00:00
8366254: (fs) UnixException.translateToIOException should translate ELOOP to FileSystemLoopException
Reviewed-by: vyazici, alanb
This commit is contained in:
parent
33d00a77f3
commit
aaac8c0636
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,9 +92,11 @@ class UnixException extends Exception {
|
||||
return new NoSuchFileException(file, other, null);
|
||||
if (errno() == UnixConstants.EEXIST)
|
||||
return new FileAlreadyExistsException(file, other, null);
|
||||
if (errno() == UnixConstants.ELOOP)
|
||||
return new FileSystemException(file, other, errorString()
|
||||
+ " or unable to access attributes of symbolic link");
|
||||
if (errno() == UnixConstants.ELOOP) {
|
||||
String msg = file + ": " + errorString()
|
||||
+ " or unable to access attributes of symbolic link";
|
||||
return new FileSystemLoopException(msg);
|
||||
}
|
||||
|
||||
// fallback to the more general exception
|
||||
return new FileSystemException(file, other, errorString());
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 8154364
|
||||
* @bug 8154364 8366254
|
||||
* @summary Test of Files.isSameFile
|
||||
* @requires (os.family != "windows")
|
||||
* @library .. /test/lib
|
||||
@ -33,6 +33,7 @@ import java.io.IOException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystemLoopException;
|
||||
import java.nio.file.FileSystemException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Path;
|
||||
@ -451,6 +452,6 @@ public class IsSameFile {
|
||||
@ParameterizedTest
|
||||
@MethodSource("linkLoopSource")
|
||||
public void linkLoop(boolean expect, Path x, Path y) throws IOException {
|
||||
assertThrows(FileSystemException.class, () -> Files.isSameFile(x, y));
|
||||
assertThrows(FileSystemLoopException.class, () -> Files.isSameFile(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user