1
1
/*
2
- * Copyright (c) 2008, 2023 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2008, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
45
45
import java .nio .file .NotLinkException ;
46
46
import java .nio .file .OpenOption ;
47
47
import java .nio .file .Path ;
48
- import java .nio .file .ProviderMismatchException ;
49
48
import java .nio .file .attribute .BasicFileAttributes ;
50
49
import java .nio .file .attribute .BasicFileAttributeView ;
51
50
import java .nio .file .attribute .FileAttribute ;
@@ -126,14 +125,6 @@ public Path getPath(URI uri) {
126
125
return UnixUriUtils .fromUri (theFileSystem , uri );
127
126
}
128
127
129
- UnixPath checkPath (Path obj ) {
130
- if (obj == null )
131
- throw new NullPointerException ();
132
- if (!(obj instanceof UnixPath ))
133
- throw new ProviderMismatchException ();
134
- return (UnixPath )obj ;
135
- }
136
-
137
128
@ Override
138
129
@ SuppressWarnings ("unchecked" )
139
130
public <V extends FileAttributeView > V getFileAttributeView (Path obj ,
@@ -216,7 +207,7 @@ public FileChannel newFileChannel(Path obj,
216
207
FileAttribute <?>... attrs )
217
208
throws IOException
218
209
{
219
- UnixPath file = checkPath (obj );
210
+ UnixPath file = UnixPath . toUnixPath (obj );
220
211
int mode = UnixFileModeAttribute
221
212
.toUnixMode (UnixFileModeAttribute .ALL_READWRITE , attrs );
222
213
try {
@@ -233,7 +224,7 @@ public AsynchronousFileChannel newAsynchronousFileChannel(Path obj,
233
224
ExecutorService executor ,
234
225
FileAttribute <?>... attrs ) throws IOException
235
226
{
236
- UnixPath file = checkPath (obj );
227
+ UnixPath file = UnixPath . toUnixPath (obj );
237
228
int mode = UnixFileModeAttribute
238
229
.toUnixMode (UnixFileModeAttribute .ALL_READWRITE , attrs );
239
230
ThreadPool pool = (executor == null ) ? null : ThreadPool .wrap (executor , 0 );
@@ -253,15 +244,7 @@ public SeekableByteChannel newByteChannel(Path obj,
253
244
FileAttribute <?>... attrs )
254
245
throws IOException
255
246
{
256
- UnixPath file = UnixPath .toUnixPath (obj );
257
- int mode = UnixFileModeAttribute
258
- .toUnixMode (UnixFileModeAttribute .ALL_READWRITE , attrs );
259
- try {
260
- return UnixChannelFactory .newFileChannel (file , options , mode );
261
- } catch (UnixException x ) {
262
- x .rethrowAsIOException (file );
263
- return null ; // keep compiler happy
264
- }
247
+ return newFileChannel (obj , options , attrs );
265
248
}
266
249
267
250
@ Override
0 commit comments