changeset 9996:245d5bd872ed

8242680: Improved URI Support Reviewed-by: alanb, rhalade
author bpb
date Wed, 29 Apr 2020 13:20:25 -0700
parents dd1fbe9cc20d
children 9023dd3e87df
files src/solaris/classes/sun/nio/fs/UnixUriUtils.java src/windows/classes/sun/nio/fs/WindowsUriSupport.java
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/sun/nio/fs/UnixUriUtils.java	Tue Apr 28 10:14:25 2020 -0700
+++ b/src/solaris/classes/sun/nio/fs/UnixUriUtils.java	Wed Apr 29 13:20:25 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, 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
@@ -116,9 +116,10 @@
         // trailing slash if directory
         if (sb.charAt(sb.length()-1) != '/') {
             try {
+                 up.checkRead();
                  if (UnixFileAttributes.get(up, true).isDirectory())
                      sb.append('/');
-            } catch (UnixException x) {
+            } catch (SecurityException | UnixException x) {
                 // ignore
             }
         }
--- a/src/windows/classes/sun/nio/fs/WindowsUriSupport.java	Tue Apr 28 10:14:25 2020 -0700
+++ b/src/windows/classes/sun/nio/fs/WindowsUriSupport.java	Wed Apr 29 13:20:25 2020 -0700
@@ -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 @@
         boolean addSlash = false;
         if (!s.endsWith("\\")) {
             try {
+                 path.checkRead();
                  addSlash = WindowsFileAttributes.get(path, true).isDirectory();
-            } catch (WindowsException x) {
+            } catch (SecurityException | WindowsException x) {
             }
         }