8242680: Improved URI Support

Reviewed-by: alanb, rhalade
This commit is contained in:
Brian Burkhalter 2020-04-29 13:20:25 -07:00 committed by Henry Jen
parent ff3e558679
commit 9291e60892
2 changed files with 9 additions and 5 deletions

View file

@ -115,9 +115,12 @@ class UnixUriUtils {
// trailing slash if directory
if (sb.charAt(sb.length()-1) != '/') {
int mode = UnixNativeDispatcher.stat(up);
if ((mode & UnixConstants.S_IFMT) == UnixConstants.S_IFDIR)
sb.append('/');
try {
up.checkRead();
int mode = UnixNativeDispatcher.stat(up);
if ((mode & UnixConstants.S_IFMT) == UnixConstants.S_IFDIR)
sb.append('/');
} catch (SecurityException ignore) { }
}
try {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2020, 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
@ -104,8 +104,9 @@ class WindowsUriSupport {
boolean addSlash = false;
if (!s.endsWith("\\")) {
try {
path.checkRead();
addSlash = WindowsFileAttributes.get(path, true).isDirectory();
} catch (WindowsException x) {
} catch (SecurityException | WindowsException x) {
}
}