dan.xu at oracle.com
Sun Dec 2 00:04:08 PST 2012
I just uploaded the new fix at
http://cr.openjdk.java.net/~dxu/7142921/webrev.04/. Please help take a
look. I forgot to add the testcase in my last webrev. And now I updated
CheckPermissions.java with a section to test Files.probeContentType()
at the end of main() method. Another minor change I did is to add
"mimeTypesFile != null" in the if condition in loadMimeTypes() method.
Otherwise, it may throw a NullPointException.
In addition, I am still not very clear about the usage of doPrivileged
block. In my understanding, all code shipped inside JDK is considered
system code and run inside the system domain, which automatically has
full permissions. Why do we still use doPrivileged block to bypass the
On Sat 01 Dec 2012 08:17:49 AM PST, Alan Bateman wrote:
> On 30/11/2012 16:28, Dan Xu wrote:
>> Thanks for your comments. Here is the updated patch,
>> <http://cr.openjdk.java.net/%7Edxu/7142921/webrev.03/>. Please review it.
> Thanks for the fixing the lazy loading to loadMimeTypes. Minor comment
> is that you don't really need "done".
> I don't think L108-111 is needed as Files.readAllLines will fail the
> file can't be found. You will need to do this in a doPrivileged block
> as otherwise it will fail if there is a security manager. This also
> means you don't need to catch SecurityException.
> The test update is missing in this webrev, I don't know if that is
> intentional or not. I did a quick check and it looks like we aren't
> testing Files.probeContentType with a security manager and I think it
> would be good to add such a test.
More information about the nio-dev