anmolanmol1234 commented on code in PR #8212:
URL: https://github.com/apache/hadoop/pull/8212#discussion_r2741033082
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsInputStream.java:
##########
@@ -599,9 +672,45 @@ int readRemote(long position, byte[] b, int offset, int
length, TracingContext t
} catch (AzureBlobFileSystemException ex) {
if (ex instanceof AbfsRestOperationException) {
AbfsRestOperationException ere = (AbfsRestOperationException) ex;
- if (ere.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) {
- throw new FileNotFoundException(ere.getMessage());
+ int status = ere.getStatusCode();
+ if(ere.getErrorMessage().contains(readOnDirectoryErrorMsg)){
+ throw ere;
+ }
+ boolean isHnsEnabled = client.getIsNamespaceEnabled();
+
+ // Case-1: 404 NOT FOUND
+ if (status == HttpURLConnection.HTTP_NOT_FOUND) {
+ /*
+ * If HNS account or restrictGpsOnOpenFile disabled,
+ * we dont need any further checks
+ */
+ if (isHnsEnabled || !shouldRestrictGpsOnOpenFile()) {
+ throw new FileNotFoundException(ere.getMessage());
+ }
+
+ // FNS account with restrictGpsOnOpenFile enabled
+ try {
+ // Need to rule out if the path is an implicit directory
+ checkIfDirPathInFNS();
+
+ } catch (AzureBlobFileSystemException gpsEx) {
+ AbfsRestOperationException gpsEre = (AbfsRestOperationException)
gpsEx;
+ if(gpsEre.getErrorMessage().contains(readOnDirectoryErrorMsg)){
Review Comment:
nit: space after if
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]