Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.7.2
-
None
-
Reviewed
Description
HADOOP-12304 introduced logic to ensure that the DelegateToFileSystem constructor sets the default port to -1:
DelegateToFileSystem.java
protected DelegateToFileSystem(URI theUri, FileSystem theFsImpl, Configuration conf, String supportedScheme, boolean authorityRequired) throws IOException, URISyntaxException { super(theUri, supportedScheme, authorityRequired, getDefaultPortIfDefined(theFsImpl)); fsImpl = theFsImpl; fsImpl.initialize(theUri, conf); fsImpl.statistics = getStatistics(); } private static int getDefaultPortIfDefined(FileSystem theFsImpl) { int defaultPort = theFsImpl.getDefaultPort(); return defaultPort != 0 ? defaultPort : -1; }
However, DelegateToFileSystem#getUriDefaultPort returns 0:
DelegateToFileSystem.java
public int getUriDefaultPort() { return 0; }
This breaks AbstractFileSystem#checkPath:
AbstractFileSystem.java
int thisPort = this.getUri().getPort(); // If using DelegateToFileSystem, this is -1 int thatPort = uri.getPort(); // This is -1 by default in java.net.URI if (thatPort == -1) { thatPort = this.getUriDefaultPort(); // Sets thatPort to 0 } if (thisPort != thatPort) { throw new InvalidPathException("Wrong FS: " + path + ", expected: " + this.getUri()); }
Which breaks any subclasses of DelegateToFileSystem that don't specify a port.
Attachments
Attachments
Issue Links
- is broken by
-
HADOOP-12304 Applications using FileContext fail with the default file system configured to be wasb/s3/etc.
- Closed