Lines Matching refs:context

38  * based on the context it encapsulates.
40 * <p>More specifically, it encapsulates a context and
45 * context it encapsulates,
49 * a security check that should be made within a given context
51 * <i>different</i> context (for example, from within a worker thread).
56 * of the current calling context, and places
65 * Code within a different context can subsequently call the
81 private ProtectionDomain context[];
112 * context.
114 * @param context the ProtectionDomains associated with this context.
117 * @throws NullPointerException if <code>context</code> is <code>null</code>
119 public AccessControlContext(ProtectionDomain context[])
121 if (context.length == 0) {
122 this.context = null;
123 } else if (context.length == 1) {
124 if (context[0] != null) {
125 this.context = context.clone();
127 this.context = null;
130 List<ProtectionDomain> v = new ArrayList<>(context.length);
131 for (int i =0; i< context.length; i++) {
132 if ((context[i] != null) && (!v.contains(context[i])))
133 v.add(context[i]);
136 this.context = new ProtectionDomain[v.size()];
137 this.context = v.toArray(this.context);
158 * <code>context</code> is <code>null</code>.
174 this.context = acc.context;
178 // context was originally retrieved.
188 AccessControlContext(ProtectionDomain context[], DomainCombiner combiner) {
189 if (context != null) {
190 this.context = context.clone();
200 AccessControlContext(ProtectionDomain context[],
203 this.context = context;
211 AccessControlContext(ProtectionDomain[] context,
214 this.context = context;
220 * Returns this context's context.
223 return context;
227 * Returns true if this context is privileged.
235 * get the assigned combiner from the privileged or inherited context
277 * the security policy currently in effect, and the context in
279 * in the context implies the permission. Otherwise the request is
290 * context encapsulated by this object.
307 for (int i = 0; context != null && i < context.length; i++) {
308 if (context[i].getCodeSource() != null &&
309 context[i].getCodeSource().getLocation() != null &&
310 Debug.isOn("codebase=" + context[i].getCodeSource().getLocation().toString())) {
325 if (context == null) {
326 debug.println("domain (context is null)");
328 for (int i=0; i< context.length; i++) {
329 debug.println("domain "+i+" "+context[i]);
336 * iterate through the ProtectionDomains in the context.
346 if (context == null)
349 for (int i=0; i< context.length; i++) {
350 if (context[i] != null && !context[i].implies(perm)) {
363 final ProtectionDomain pd = context[i];
385 * Take the stack-based context (this) and combine it with the
386 * privileged or inherited context, if need be.
389 // the assigned (privileged or inherited) context
397 // this.context could be null if only system code is on the stack;
398 // in that case, ignore the stack context
399 boolean skipStack = (context == null);
401 // acc.context could be null if only system code was involved;
402 // in that case, ignore the assigned context
403 boolean skipAssigned = (acc == null || acc.context == null);
407 return goCombiner(context, acc);
416 // optimization: if there is no stack context; there is no reason
417 // to compress the assigned context, it already is compressed
422 int slen = context.length;
424 // optimization: if there is no assigned context and the stack length
426 // stack context, it already is
432 // is already in the assigned context; no need to combine
433 if ((slen == 1) && (context[0] == acc.context[0])) {
437 int n = (skipAssigned) ? 0 : acc.context.length;
439 // now we combine both of them, and create a new context
442 // first copy in the assigned context domains, no need to compress
444 System.arraycopy(acc.context, 0, pd, 0, n);
447 // now add the stack context domains, discarding nulls and duplicates
449 for (int i = 0; i < context.length; i++) {
450 ProtectionDomain sd = context[i];
464 if (!skipAssigned && n == acc.context.length) {
478 this.context = pd;
497 // No need to clone current and assigned.context
500 current, assigned.context);
505 this.context = combinedPds;
517 * as this context.
521 * same set of ProtectionDomains as this context, false otherwise.
533 if (context == null) {
534 return (that.context == null);
537 if (that.context == null)
564 for (int i = 0; i < context.length; i++) {
566 if ((thisPd = context[i]) == null) {
567 for (int j = 0; (j < that.context.length) && !match; j++) {
568 match = (that.context[j] == null);
573 for (int j = 0; (j < that.context.length) && !match; j++) {
574 thatPd = that.context[j];
586 * Returns the hash code value for this context. The hash code
588 * domains in the context together.
590 * @return a hash code value for this context.
596 if (context == null)
599 for (int i =0; i < context.length; i++) {
600 if (context[i] != null)
601 hashCode ^= context[i].hashCode();