/** * Get an iterator from the given object. Since the superclass method * this secure version checks for execute permission. * * @param obj object to iterate over * @param i line, column, template info * @return Iterator for object */ public Iterator getIterator(Object obj, Info i) { if (obj != null) { SecureIntrospectorControl sic = (SecureIntrospectorControl)introspector; if (sic.checkObjectExecutePermission(obj.getClass(), null)) { return super.getIterator(obj, i); } else { log.warn("Cannot retrieve iterator from {} due to security restrictions.", obj.getClass().getName()); } } return null; } }
/** * Get an iterator responsible for preserving annotations while iterating over a collection that has collection * inheritable return value annotations.' * * @param obj object to get an iterator for * @param info current template info * @return Inheritable annotation preserving iterator */ @Override public final Iterator<?> getIterator(Object obj, Info info) throws Exception { if (!(obj instanceof AnnotatedValue)) { return super.getIterator(obj, info); } AnnotatedValue<?> annotatedValue = (AnnotatedValue<?>) obj; Iterator<?> iterator = super.getIterator(annotatedValue.unbox(), info); if (iterator == null) { return null; } Collection<Annotation> inheritedAnnotations = annotatedValue.getCollectionInheritableAnnotations(); if (inheritedAnnotations.isEmpty()) { return iterator; } return new AnnotatedValueIterator<>(iterator, inheritedAnnotations); }
/** * Get an iterator from the given object. Since the superclass method * this secure version checks for execute permission. * * @param obj object to iterate over * @param i line, column, template info * @return Iterator for object */ public Iterator getIterator(Object obj, Info i) throws Exception { if (obj != null) { SecureIntrospectorControl sic = (SecureIntrospectorControl)introspector; if (sic.checkObjectExecutePermission(obj.getClass(), null)) { return super.getIterator(obj, i); } else { log.warn("Cannot retrieve iterator from " + obj.getClass() + " due to security restrictions."); } } return null; }
/** * Get an iterator from the given object. Since the superclass method this secure version checks for execute * permission. * * @param obj object to iterate over * @param i line, column, template info * @return Iterator for object * @throws Exception when failing to get iterator */ @Override public Iterator getIterator(Object obj, Info i) throws Exception { if (obj != null) { SecureIntrospectorControl sic = (SecureIntrospectorControl) this.introspector; if (sic.checkObjectExecutePermission(obj.getClass(), null)) { return super.getIterator(obj, i); } else { this.log.warn("Cannot retrieve iterator from " + obj.getClass() + " due to security restrictions."); } } return null; }
/** * Get an iterator from the given object. Since the superclass method * this secure version checks for execute permission. * * @param obj object to iterate over * @param i line, column, template info * @return Iterator for object * @throws Exception */ public Iterator getIterator(Object obj, Info i) throws Exception { if (obj != null) { SecureIntrospectorControl sic = (SecureIntrospectorControl)introspector; if (sic.checkObjectExecutePermission(obj.getClass(), null)) { return super.getIterator(obj, i); } else { log.warn("Cannot retrieve iterator from " + obj.getClass() + " due to security restrictions."); } } return null; }