mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8205058: (fs) Files read/writeString should throw CharacterCodingException instead of IOException with an IllegalArgumentException as cause
Reviewed-by: sherman, alanb, lancea
This commit is contained in:
parent
884f9db3c6
commit
e5ac84c7b0
5 changed files with 80 additions and 49 deletions
|
@ -3281,11 +3281,7 @@ public final class Files {
|
|||
Objects.requireNonNull(cs);
|
||||
|
||||
byte[] ba = readAllBytes(path);
|
||||
try {
|
||||
return JLA.newStringNoRepl(ba, cs);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
return JLA.newStringNoRepl(ba, cs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3636,12 +3632,8 @@ public final class Files {
|
|||
Objects.requireNonNull(csq);
|
||||
Objects.requireNonNull(cs);
|
||||
|
||||
try {
|
||||
byte[] bytes = JLA.getBytesNoRepl(String.valueOf(csq), cs);
|
||||
write(path, bytes, options);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
byte[] bytes = JLA.getBytesNoRepl(String.valueOf(csq), cs);
|
||||
write(path, bytes, options);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue