Hi Daniel I didn't state clear, actually, I want/wanted to take the absolutely same way as your allowAll except I am going to add a common function(called runWithAllPerm) to run it, no Permission arguments any longer.
I will send you a draft to you and Joe to make it clear before I finish all rework. Thanks Frank > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fu...@oracle.com] > Sent: Tuesday, July 26, 2016 3:46 PM > To: Frank Yuan; 'huizhe wang' > Cc: 'Amy Lu'; 'core-libs-dev' > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit > tests > > On 26/07/16 04:24, Frank Yuan wrote: > > Thank you very much for your suggestions! Now I fully understand the > > rule(at least I think so :P) > > I will use a runWithAllPerm block surrounding the user setup code as > > Daniel's way. Btw, Daniel, ThreadLocal should not need Atomic > > any more, correct? > > > > Hi Frank, > > runWithAllPerm is another way to do it. > It uses a ThreadLocal<Permissions>, right? > > I agree it's adequate. Just be careful of what might > happen if you run runWithAllPerm inside runWithPermissions, > or runWithPermissions(runnable, a,b,c) with a runnable that > later calls runWithPermission(runnable2, a, d, e) further down > the road. > > At the moment I'm not sure whether your code will work correctly > in the presence of such nested invocation (maybe it does), > but because it seems to be index based it's not immediately > obvious (I'm not asking you to change it - just to verify and > confirm that it's something you have taken into account, and > that you're confident that it works). > > > Best regards, > > -- daniel