Class J2DoPrivHelper


  • public abstract class J2DoPrivHelper
    extends java.lang.Object
    Helper class to obtain the Privilege(Exception)Action object to perform Java 2 doPrivilege security sensitive function call in the following methods:
    • AccessibleObject.setAccessible
    • Class.forName
    • Class.getClassLoader
    • Class.getDeclaredField
    • Class.getDeclaredFields
    • Class.getDeclaredMethod
    • Class.getDeclaredMethods
    • Class.getProtectionDomain
    • Class.getResource
    • Class.newInstance
    • ClassLoader.getParent
    • ClassLoader.getResource
    • ClassLoader.getResources
    • ClassLoader.getSystemClassLoader
    • File.deleteOnExit
    • File.delete
    • File.exists
    • File.getAbsoluteFile
    • File.getAbsolutePath
    • File.getCanonicalPath
    • File.listFiles
    • File.length
    • File.isDirectory
    • File.mkdirs
    • File.renameTo
    • File.toURL
    • FileInputStream new
    • FileOutputStream new
    • System.getProperties
    • InetAddress.getByName
    • MultiClassLoader new
    • ServerSocket new
    • Socket new
    • Socket.accept
    • System.getProperty
    • Thread.getContextClassLoader
    • Thread.setContextClassLoader
    • Thread new
    • TemporaryClassLoader new
    • URL.openStream
    • URLConnection.getContent
    • ZipFile new
    • AnnotatedElement.getAnnotations
    • AnnotatedElement.getDeclaredAnnotations
    • AnnotatedElement.isAnnotationPresent
    • jakarta.validation.Validator.validate
    • jakarta.validation.Validation.buildDefaultValidatorFactory
    If these methods are used, the following sample usage patterns should be followed to ensure proper privilege is granted:
     1) No security risk method call. E.g.
    
        private static final String SEP = J2DoPrivHelper.getLineSeparator();
    
     2) Methods with no exception thrown. PrivilegedAction is returned from
        J2DoPrivHelper.*Action(). E.g.
    
        ClassLoader loader = AccessController.doPrivileged(
                                 J2DoPrivHelper.getClassLoaderAction(clazz));
    
        ClassLoader loader = (ClassLoader) (System.getSecurityManager() == null)
                             ? clazz.getClassLoader()
                             : AccessController.doPrivileged(
                                 J2DoPrivHelper.getClassLoaderAction(clazz));
     3) Methods with exception thrown. PrivilegedExceptionAction is returned
        from J2DoPrivHelper.*Action(). E.g.
    
        try {
          method = AccessController.doPrivileged(
            J2DoPrivHelper.getDeclaredMethodAction(clazz, name, parameterType));
        } catch (PrivilegedActionException pae) {
          throw (NoSuchMethodException) pae.getException();
        }
    
        try {
          method = (System.getSecurityManager() == null)
            ? clazz.getDeclaredMethod(name,parameterType)
            : AccessController.doPrivileged(
                J2DoPrivHelper.getDeclaredMethodAction(
                  clazz, name, parameterType));
        } catch (PrivilegedActionException pae) {
            throw (NoSuchMethodException) pae.getException()
        }
     
    Author:
    Albert Lee
    • Constructor Summary

      Constructors 
      Constructor Description
      J2DoPrivHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.security.PrivilegedExceptionAction<java.net.Socket> acceptAction​(java.net.ServerSocket ss)
      Return a PrivilegedExceptionAction object for ServerSocket.accept().
      static <T> java.security.PrivilegedAction<jakarta.validation.ValidatorFactory> buildDefaultValidatorFactoryAction()
      Return a PrivilegeAction object for jakarta.validation.Validation.buildDefaultValidatorFactory().
      static java.security.PrivilegedExceptionAction<java.net.URL> createURL​(java.lang.String url)  
      static java.security.PrivilegedAction<java.lang.Boolean> deleteAction​(java.io.File f)
      Return a PrivilegeAction object for f.delete().
      static java.security.PrivilegedAction<java.lang.Boolean> deleteOnExitAction​(java.io.File f)
      Return a PrivilegeAction object for f.deleteOnExit().
      static java.security.PrivilegedAction<java.lang.Boolean> existsAction​(java.io.File f)
      Return a PrivilegeAction object for f.exists().
      static java.security.PrivilegedAction<java.io.File> getAbsoluteFileAction​(java.io.File f)
      Return a PrivilegeAction object for f.getAbsoluteFile().
      static java.security.PrivilegedAction<java.lang.String> getAbsolutePathAction​(java.io.File f)
      Return a PrivilegeAction object for f.getAbsolutePath().
      static <T extends java.lang.annotation.Annotation>
      java.security.PrivilegedAction<T>
      getAnnotationAction​(java.lang.reflect.AnnotatedElement element, java.lang.Class<T> annotationClazz)
      Return a PrivilegedAction object for AnnotatedElement.getAnnotation().
      static java.security.PrivilegedAction<java.lang.annotation.Annotation[]> getAnnotationsAction​(java.lang.reflect.AnnotatedElement element)
      Return a PrivilegeAction object for AnnotatedElement.getAnnotations().
      static java.security.PrivilegedExceptionAction<java.net.InetAddress> getByNameAction​(java.lang.String hostname)
      Return a PrivilegedExceptionAction object for InetAdress.getByName().
      static java.security.PrivilegedExceptionAction<java.lang.String> getCanonicalPathAction​(java.io.File f)
      Return a PrivilegedExceptionAction object for f.getCanonicalPath().
      static java.security.PrivilegedAction<java.lang.ClassLoader> getClassLoaderAction​(java.lang.Class<?> clazz)
      Return a PrivilegeAction object for clazz.getClassloader().
      static java.security.PrivilegedExceptionAction<java.lang.Object> getContentAction​(java.net.URLConnection con)
      Return a PrivilegedExceptionAction object con.getContent().
      static java.security.PrivilegedAction<java.lang.ClassLoader> getContextClassLoaderAction()
      Return a PrivilegeAction object for Thread.currentThread .getContextClassLoader().
      static java.security.PrivilegedAction<java.lang.annotation.Annotation[]> getDeclaredAnnotationsAction​(java.lang.reflect.AnnotatedElement element)
      Return a PrivilegeAction object for AnnotatedElement.getDeclaredAnnotations().
      static java.security.PrivilegedExceptionAction<java.lang.reflect.Field> getDeclaredFieldAction​(java.lang.Class<?> clazz, java.lang.String name)
      Return a PrivilegedExceptionAction object for clazz.getDeclaredField().
      static java.security.PrivilegedAction<java.lang.reflect.Field[]> getDeclaredFieldsAction​(java.lang.Class<?> clazz)
      Return a PrivilegeAction object for class.getDeclaredFields().
      static java.security.PrivilegedExceptionAction<java.lang.reflect.Method> getDeclaredMethodAction​(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] parameterTypes)
      Return a PrivilegedExceptionAction object for clazz.getDeclaredMethod().
      static java.security.PrivilegedAction<java.lang.reflect.Method[]> getDeclaredMethodsAction​(java.lang.Class<?> clazz)
      Return a PrivilegeAction object for clazz.getDeclaredMethods().
      static java.security.PrivilegedExceptionAction<java.lang.Class<?>> getForNameAction​(java.lang.String className, boolean initializeBoolean, java.lang.ClassLoader classLoader)
      Return a PrivilegeAction object for Class.forName().
      static java.security.PrivilegedExceptionAction<java.util.jar.JarEntry> getJarEntryAction​(java.net.JarURLConnection con)
      Return a PrivilegedExceptionAction object for con.getJarEntry().
      static java.security.PrivilegedExceptionAction<java.util.jar.JarFile> getJarFileAction​(java.net.JarURLConnection con)
      Return a PrivilegedExceptionAction object for con.getJarFile().
      static java.lang.String getLineSeparator()
      Return the value of the "line.separator" system property.
      static java.security.PrivilegedAction<java.lang.ClassLoader> getParentAction​(java.lang.ClassLoader loader)
      Return a PrivilegeAction object for loader.getParent().
      static java.lang.String getPathSeparator()
      Return the value of the "path.separator" system property.
      static java.security.PrivilegedAction<java.util.Properties> getPropertiesAction()
      Return a PrivilegeAction object for System.getProperties().
      static java.security.PrivilegedAction<java.lang.String> getPropertyAction​(java.lang.String name)
      Return a PrivilegeAction object for System.getProperty().
      static java.security.PrivilegedAction<java.lang.String> getPropertyAction​(java.lang.String name, java.lang.String def)
      Return a PrivilegeAction object for System.getProperty().
      static java.security.PrivilegedAction<java.security.ProtectionDomain> getProtectionDomainAction​(java.lang.Class<?> clazz)
      Return a PrivilegeAction object for class.getProtectionDomain().
      static java.security.PrivilegedAction<java.net.URL> getResourceAction​(java.lang.Class<?> clazz, java.lang.String resource)
      Return a PrivilegeAction object for clazz.getResource().
      static java.security.PrivilegedAction<java.net.URL> getResourceAction​(java.lang.ClassLoader loader, java.lang.String resource)
      Return a PrivilegeAction object for loader.getResource().
      static java.security.PrivilegedExceptionAction<java.util.Enumeration<java.net.URL>> getResourcesAction​(java.lang.ClassLoader loader, java.lang.String resource)
      Return a PrivilegedExceptionAction object for loader.getResources().
      static java.security.PrivilegedAction<java.lang.ClassLoader> getSystemClassLoaderAction()
      Return a PrivilegeAction object for ClassLoader.getSystemClassLoader().
      static java.security.PrivilegedAction<java.lang.Boolean> isAnnotationPresentAction​(java.lang.reflect.AnnotatedElement element, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClazz)
      Return a PrivilegeAction object for AnnotatedElement.isAnnotationPresent().
      static java.security.PrivilegedAction<java.lang.Boolean> isDirectoryAction​(java.io.File f)
      Return a PrivilegeAction object for f.isDirectory().
      static java.security.PrivilegedAction<java.lang.Boolean> isFileAction​(java.io.File f)
      Return a PrivilegeAction object for f.isFile().
      static java.security.PrivilegedAction<java.lang.Long> lengthAction​(java.io.File f)
      Return a PrivilegeAction object for f.length().
      static java.security.PrivilegedAction<java.io.File[]> listFilesAction​(java.io.File f)
      Return a PrivilegeAction object for f.listFiles().
      static java.security.PrivilegedAction<java.lang.Boolean> mkdirsAction​(java.io.File f)
      Return a PrivilegeAction object for f.mkdirs().
      static java.security.PrivilegedAction<java.lang.Thread> newDaemonThreadAction​(java.lang.Runnable target, java.lang.String name)
      Return a PrivilegedAction object for new Thread().
      static java.security.PrivilegedExceptionAction<java.io.FileInputStream> newFileInputStreamAction​(java.io.File f)
      Return a PrivilegedExceptionAction object for new FileInputStream().
      static java.security.PrivilegedExceptionAction<java.io.FileOutputStream> newFileOutputStreamAction​(java.io.File f)
      Return a PrivilegedExceptionAction object for new FileOutputStream().
      static java.security.PrivilegedExceptionAction<java.io.FileOutputStream> newFileOutputStreamAction​(java.lang.String f, boolean append)
      Return a PrivilegedExceptionAction object for new FileOutputStream().
      static <T> java.security.PrivilegedExceptionAction<T> newInstanceAction​(java.lang.Class<T> clazz)
      Return a PrivilegedExceptionAction object for clazz.newInstance().
      static java.security.PrivilegedAction<MultiClassLoader> newMultiClassLoaderAction()
      Return a PrivilegeAction object for new MultiClassLoader().
      static java.security.PrivilegedExceptionAction<java.net.ServerSocket> newServerSocketAction​(int port)
      Return a PrivilegedExceptionAction object for new ServerSocket().
      static java.security.PrivilegedExceptionAction<java.net.Socket> newSocketAction​(java.net.InetAddress host, int port)
      Return a PrivilegedExceptionAction object for new Socket().
      static java.security.PrivilegedAction<TemporaryClassLoader> newTemporaryClassLoaderAction​(java.lang.ClassLoader parent)
      Return a PrivilegeAction object for new TemporaryClassLoader().
      static java.security.PrivilegedExceptionAction<java.util.zip.ZipFile> newZipFileAction​(java.io.File f)
      Return a PrivilegedExceptionAction object for new ZipFile().
      static java.security.PrivilegedExceptionAction<java.io.InputStream> openStreamAction​(java.net.URL url)
      Return a PrivilegedExceptionAction object for url.openStream().
      static java.security.PrivilegedAction<java.lang.Boolean> renameToAction​(java.io.File from, java.io.File to)
      Return a PrivilegeAction object for f.renameTo().
      static java.security.PrivilegedAction<java.lang.Object> setAccessibleAction​(java.lang.reflect.AccessibleObject aObj, boolean flag)
      Return a PrivilegeAction object for aObj.setAccessible().
      static java.security.PrivilegedAction<java.lang.Boolean> setContextClassLoaderAction​(java.lang.ClassLoader loader)
      Return a PrivilegeAction object for Thread.currentThread .setContextClassLoader().
      static java.security.PrivilegedExceptionAction<java.net.URL> toURLAction​(java.io.File file)
      Return a PrivilegedExceptionAction object for f.toURL().
      static <T> java.security.PrivilegedAction<java.util.Set<jakarta.validation.ConstraintViolation<T>>> validateAction​(jakarta.validation.Validator validator, T arg0, java.lang.Class<?>[] groups)
      Return a PrivilegeAction object for jakarta.validation.Validator.validate().
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • J2DoPrivHelper

        public J2DoPrivHelper()
    • Method Detail

      • getLineSeparator

        public static java.lang.String getLineSeparator()
        Return the value of the "line.separator" system property. Requires security policy: 'permission java.util.PropertyPermission "read";'
      • getPathSeparator

        public static java.lang.String getPathSeparator()
        Return the value of the "path.separator" system property. Requires security policy: 'permission java.util.PropertyPermission "read";'
      • setAccessibleAction

        public static java.security.PrivilegedAction<java.lang.Object> setAccessibleAction​(java.lang.reflect.AccessibleObject aObj,
                                                                                           boolean flag)
        Return a PrivilegeAction object for aObj.setAccessible(). Requires security policy: 'permission java.lang.reflect.ReflectPermission "suppressAccessChecks";'
      • getForNameAction

        public static java.security.PrivilegedExceptionAction<java.lang.Class<?>> getForNameAction​(java.lang.String className,
                                                                                                   boolean initializeBoolean,
                                                                                                   java.lang.ClassLoader classLoader)
        Return a PrivilegeAction object for Class.forName(). Notes: doPriv of Class.forName call is required only if the input classloader argument is null. E.g. Class.forName("x", false, Collection.class.getClassLoader()); Requires security policy: 'permission java.lang.RuntimePermission "getClassLoader";'
        Returns:
        Class
      • getClassLoaderAction

        public static java.security.PrivilegedAction<java.lang.ClassLoader> getClassLoaderAction​(java.lang.Class<?> clazz)
        Return a PrivilegeAction object for clazz.getClassloader(). Notes: No doPrivilege wrapping is required in the caller if: "the caller's class loader is not null and the caller's class loader is not the same as or an ancestor of the class loader for the class whose class loader is requested". E.g. this.getClass().getClassLoader(); Requires security policy: 'permission java.lang.RuntimePermission "getClassLoader";'
        Returns:
        Classloader
      • getDeclaredFieldAction

        public static java.security.PrivilegedExceptionAction<java.lang.reflect.Field> getDeclaredFieldAction​(java.lang.Class<?> clazz,
                                                                                                              java.lang.String name)
        Return a PrivilegedExceptionAction object for clazz.getDeclaredField(). Requires security policy: 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
        Returns:
        Field
        Throws:
        java.lang.NoSuchFieldException
      • getDeclaredFieldsAction

        public static java.security.PrivilegedAction<java.lang.reflect.Field[]> getDeclaredFieldsAction​(java.lang.Class<?> clazz)
        Return a PrivilegeAction object for class.getDeclaredFields(). Requires security policy: 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
        Returns:
        Field[]
      • getDeclaredMethodAction

        public static java.security.PrivilegedExceptionAction<java.lang.reflect.Method> getDeclaredMethodAction​(java.lang.Class<?> clazz,
                                                                                                                java.lang.String name,
                                                                                                                java.lang.Class<?>[] parameterTypes)
        Return a PrivilegedExceptionAction object for clazz.getDeclaredMethod(). Requires security policy 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
        Returns:
        Method
        Throws:
        java.lang.NoSuchMethodException
      • getDeclaredMethodsAction

        public static java.security.PrivilegedAction<java.lang.reflect.Method[]> getDeclaredMethodsAction​(java.lang.Class<?> clazz)
        Return a PrivilegeAction object for clazz.getDeclaredMethods(). Requires security policy: 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
        Returns:
        Method[]
      • getResourceAction

        public static java.security.PrivilegedAction<java.net.URL> getResourceAction​(java.lang.Class<?> clazz,
                                                                                     java.lang.String resource)
        Return a PrivilegeAction object for clazz.getResource(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        URL
      • newInstanceAction

        public static <T> java.security.PrivilegedExceptionAction<T> newInstanceAction​(java.lang.Class<T> clazz)
                                                                                throws java.lang.IllegalAccessException,
                                                                                       java.lang.InstantiationException
        Return a PrivilegedExceptionAction object for clazz.newInstance(). Requires security policy: 'permission java.lang.RuntimePermission "getClassLoader";'
        Returns:
        A new instance of the provided class.
        Throws:
        java.lang.IllegalAccessException
        java.lang.InstantiationException
      • getProtectionDomainAction

        public static java.security.PrivilegedAction<java.security.ProtectionDomain> getProtectionDomainAction​(java.lang.Class<?> clazz)
        Return a PrivilegeAction object for class.getProtectionDomain(). Requires security policy: 'permission java.lang.RuntimePermission "getProtectionDomain";'
        Returns:
        ProtectionDomain
      • getParentAction

        public static java.security.PrivilegedAction<java.lang.ClassLoader> getParentAction​(java.lang.ClassLoader loader)
        Return a PrivilegeAction object for loader.getParent(). Requires security policy: 'permission java.lang.RuntimePermission "getClassLoader";'
        Returns:
        ClassLoader
      • getResourceAction

        public static java.security.PrivilegedAction<java.net.URL> getResourceAction​(java.lang.ClassLoader loader,
                                                                                     java.lang.String resource)
        Return a PrivilegeAction object for loader.getResource(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        URL
      • getResourcesAction

        public static java.security.PrivilegedExceptionAction<java.util.Enumeration<java.net.URL>> getResourcesAction​(java.lang.ClassLoader loader,
                                                                                                                      java.lang.String resource)
                                                                                                               throws java.io.IOException
        Return a PrivilegedExceptionAction object for loader.getResources(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        Enumeration
        Throws:
        java.io.IOException
      • getSystemClassLoaderAction

        public static java.security.PrivilegedAction<java.lang.ClassLoader> getSystemClassLoaderAction()
        Return a PrivilegeAction object for ClassLoader.getSystemClassLoader(). Requires security policy: 'permission java.lang.RuntimePermission "getClassLoader";'
        Returns:
        ClassLoader
      • deleteAction

        public static java.security.PrivilegedAction<java.lang.Boolean> deleteAction​(java.io.File f)
        Return a PrivilegeAction object for f.delete(). Requires security policy: 'permission java.io.FilePermission "delete";'
        Returns:
        Boolean
      • existsAction

        public static java.security.PrivilegedAction<java.lang.Boolean> existsAction​(java.io.File f)
        Return a PrivilegeAction object for f.exists(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        Boolean
      • deleteOnExitAction

        public static java.security.PrivilegedAction<java.lang.Boolean> deleteOnExitAction​(java.io.File f)
        Return a PrivilegeAction object for f.deleteOnExit(). Requires security policy: 'permission java.io.FilePermission "delete";'
      • getAbsoluteFileAction

        public static java.security.PrivilegedAction<java.io.File> getAbsoluteFileAction​(java.io.File f)
        Return a PrivilegeAction object for f.getAbsoluteFile(). Requires security policy: 'permission java.util.PropertyPermission "read";'
        Returns:
        File
      • getAbsolutePathAction

        public static java.security.PrivilegedAction<java.lang.String> getAbsolutePathAction​(java.io.File f)
        Return a PrivilegeAction object for f.getAbsolutePath(). Requires security policy: 'permission java.util.PropertyPermission "read";'
        Returns:
        String
      • getCanonicalPathAction

        public static java.security.PrivilegedExceptionAction<java.lang.String> getCanonicalPathAction​(java.io.File f)
                                                                                                throws java.io.IOException
        Return a PrivilegedExceptionAction object for f.getCanonicalPath(). Requires security policy: 'permission java.util.PropertyPermission "read";'
        Returns:
        String
        Throws:
        java.io.IOException
      • isDirectoryAction

        public static java.security.PrivilegedAction<java.lang.Boolean> isDirectoryAction​(java.io.File f)
        Return a PrivilegeAction object for f.isDirectory(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        Boolean
      • isFileAction

        public static java.security.PrivilegedAction<java.lang.Boolean> isFileAction​(java.io.File f)
        Return a PrivilegeAction object for f.isFile(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        Boolean
      • lengthAction

        public static java.security.PrivilegedAction<java.lang.Long> lengthAction​(java.io.File f)
        Return a PrivilegeAction object for f.length(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        Long
      • listFilesAction

        public static java.security.PrivilegedAction<java.io.File[]> listFilesAction​(java.io.File f)
        Return a PrivilegeAction object for f.listFiles(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        File[]
      • mkdirsAction

        public static java.security.PrivilegedAction<java.lang.Boolean> mkdirsAction​(java.io.File f)
        Return a PrivilegeAction object for f.mkdirs(). Requires security policy: 'permission java.io.FilePermission "write";'
        Returns:
        Boolean
      • renameToAction

        public static java.security.PrivilegedAction<java.lang.Boolean> renameToAction​(java.io.File from,
                                                                                       java.io.File to)
        Return a PrivilegeAction object for f.renameTo(). Requires security policy: 'permission java.io.FilePermission "write";'
        Returns:
        Boolean
      • toURLAction

        public static java.security.PrivilegedExceptionAction<java.net.URL> toURLAction​(java.io.File file)
                                                                                 throws java.net.MalformedURLException
        Return a PrivilegedExceptionAction object for f.toURL(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        URL
        Throws:
        java.net.MalformedURLException
      • newFileInputStreamAction

        public static java.security.PrivilegedExceptionAction<java.io.FileInputStream> newFileInputStreamAction​(java.io.File f)
                                                                                                         throws java.io.FileNotFoundException
        Return a PrivilegedExceptionAction object for new FileInputStream(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        FileInputStream
        Throws:
        java.io.FileNotFoundException
      • newFileOutputStreamAction

        public static java.security.PrivilegedExceptionAction<java.io.FileOutputStream> newFileOutputStreamAction​(java.io.File f)
                                                                                                           throws java.io.FileNotFoundException
        Return a PrivilegedExceptionAction object for new FileOutputStream(). Requires security policy: 'permission java.io.FilePermission "write";'
        Returns:
        FileOutputStream
        Throws:
        java.io.FileNotFoundException
      • newFileOutputStreamAction

        public static java.security.PrivilegedExceptionAction<java.io.FileOutputStream> newFileOutputStreamAction​(java.lang.String f,
                                                                                                                  boolean append)
                                                                                                           throws java.io.FileNotFoundException
        Return a PrivilegedExceptionAction object for new FileOutputStream(). Requires security policy: 'permission java.io.FilePermission "write";'
        Returns:
        FileOutputStream
        Throws:
        java.io.FileNotFoundException
      • getByNameAction

        public static java.security.PrivilegedExceptionAction<java.net.InetAddress> getByNameAction​(java.lang.String hostname)
                                                                                             throws java.net.UnknownHostException
        Return a PrivilegedExceptionAction object for InetAdress.getByName(). Requires security policy: 'permission java.net.SocketPermission "connect";'
        Returns:
        InetAddress
        Throws:
        java.net.UnknownHostException
      • newSocketAction

        public static java.security.PrivilegedExceptionAction<java.net.Socket> newSocketAction​(java.net.InetAddress host,
                                                                                               int port)
                                                                                        throws java.io.IOException
        Return a PrivilegedExceptionAction object for new Socket(). Requires security policy: 'permission java.net.SocketPermission "connect";'
        Returns:
        Socket
        Throws:
        java.io.IOException
      • newServerSocketAction

        public static java.security.PrivilegedExceptionAction<java.net.ServerSocket> newServerSocketAction​(int port)
                                                                                                    throws java.io.IOException
        Return a PrivilegedExceptionAction object for new ServerSocket(). Requires security policy: 'permission java.net.SocketPermission "listen";'
        Returns:
        ServerSocket
        Throws:
        java.io.IOException
      • acceptAction

        public static java.security.PrivilegedExceptionAction<java.net.Socket> acceptAction​(java.net.ServerSocket ss)
                                                                                     throws java.io.IOException
        Return a PrivilegedExceptionAction object for ServerSocket.accept(). Requires security policy: 'permission java.net.SocketPermission "listen";'
        Returns:
        Socket
        Throws:
        java.io.IOException
      • getPropertiesAction

        public static java.security.PrivilegedAction<java.util.Properties> getPropertiesAction()
        Return a PrivilegeAction object for System.getProperties(). Requires security policy: 'permission java.util.PropertyPermission "read";'
        Returns:
        Properties
      • getPropertyAction

        public static java.security.PrivilegedAction<java.lang.String> getPropertyAction​(java.lang.String name)
        Return a PrivilegeAction object for System.getProperty(). Requires security policy: 'permission java.util.PropertyPermission "read";'
        Returns:
        String
      • getPropertyAction

        public static java.security.PrivilegedAction<java.lang.String> getPropertyAction​(java.lang.String name,
                                                                                         java.lang.String def)
        Return a PrivilegeAction object for System.getProperty(). Requires security policy: 'permission java.util.PropertyPermission "read";'
        Returns:
        String
      • getContextClassLoaderAction

        public static java.security.PrivilegedAction<java.lang.ClassLoader> getContextClassLoaderAction()
        Return a PrivilegeAction object for Thread.currentThread .getContextClassLoader(). Requires security policy: 'permission java.lang.RuntimePermission "getClassLoader";'
        Returns:
        ClassLoader
      • setContextClassLoaderAction

        public static java.security.PrivilegedAction<java.lang.Boolean> setContextClassLoaderAction​(java.lang.ClassLoader loader)
        Return a PrivilegeAction object for Thread.currentThread .setContextClassLoader(). Requires security policy: 'permission java.lang.RuntimePermission "setContextClassLoader";'
        Returns:
        ClassLoader
      • newDaemonThreadAction

        public static java.security.PrivilegedAction<java.lang.Thread> newDaemonThreadAction​(java.lang.Runnable target,
                                                                                             java.lang.String name)
        Return a PrivilegedAction object for new Thread(). Requires security policy: 'permission java.lang.RuntimePermission "modifyThreadGroup";' 'permission java.lang.RuntimePermission "modifyThread";'
        Returns:
        Thread
      • openStreamAction

        public static java.security.PrivilegedExceptionAction<java.io.InputStream> openStreamAction​(java.net.URL url)
                                                                                             throws java.io.IOException
        Return a PrivilegedExceptionAction object for url.openStream(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        InputStream
        Throws:
        java.io.IOException
      • getContentAction

        public static java.security.PrivilegedExceptionAction<java.lang.Object> getContentAction​(java.net.URLConnection con)
                                                                                          throws java.io.IOException
        Return a PrivilegedExceptionAction object con.getContent(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        Object
        Throws:
        java.io.IOException
      • newZipFileAction

        public static java.security.PrivilegedExceptionAction<java.util.zip.ZipFile> newZipFileAction​(java.io.File f)
                                                                                               throws java.io.IOException
        Return a PrivilegedExceptionAction object for new ZipFile(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        ZipFile
        Throws:
        java.io.IOException
      • getJarFileAction

        public static java.security.PrivilegedExceptionAction<java.util.jar.JarFile> getJarFileAction​(java.net.JarURLConnection con)
                                                                                               throws java.io.IOException
        Return a PrivilegedExceptionAction object for con.getJarFile(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        JarFile
        Throws:
        java.io.IOException
      • getJarEntryAction

        public static java.security.PrivilegedExceptionAction<java.util.jar.JarEntry> getJarEntryAction​(java.net.JarURLConnection con)
                                                                                                 throws java.io.IOException
        Return a PrivilegedExceptionAction object for con.getJarEntry(). Requires security policy: 'permission java.io.FilePermission "read";'
        Returns:
        JarEntry
        Throws:
        java.io.IOException
      • newTemporaryClassLoaderAction

        public static java.security.PrivilegedAction<TemporaryClassLoader> newTemporaryClassLoaderAction​(java.lang.ClassLoader parent)
        Return a PrivilegeAction object for new TemporaryClassLoader(). Requires security policy: 'permission java.lang.RuntimePermission "createClassLoader";'
        Returns:
        TemporaryClassLoader
      • newMultiClassLoaderAction

        public static java.security.PrivilegedAction<MultiClassLoader> newMultiClassLoaderAction()
        Return a PrivilegeAction object for new MultiClassLoader(). Requires security policy: 'permission java.lang.RuntimePermission "createClassLoader";'
        Returns:
        MultiClassLoader
      • getAnnotationsAction

        public static java.security.PrivilegedAction<java.lang.annotation.Annotation[]> getAnnotationsAction​(java.lang.reflect.AnnotatedElement element)
        Return a PrivilegeAction object for AnnotatedElement.getAnnotations(). Requires security policy: 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
        Returns:
        Annotation[]
      • getDeclaredAnnotationsAction

        public static java.security.PrivilegedAction<java.lang.annotation.Annotation[]> getDeclaredAnnotationsAction​(java.lang.reflect.AnnotatedElement element)
        Return a PrivilegeAction object for AnnotatedElement.getDeclaredAnnotations(). Requires security policy: 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
        Returns:
        Annotation[]
      • isAnnotationPresentAction

        public static java.security.PrivilegedAction<java.lang.Boolean> isAnnotationPresentAction​(java.lang.reflect.AnnotatedElement element,
                                                                                                  java.lang.Class<? extends java.lang.annotation.Annotation> annotationClazz)
        Return a PrivilegeAction object for AnnotatedElement.isAnnotationPresent(). Requires security policy: 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
        Returns:
        Boolean
      • getAnnotationAction

        public static <T extends java.lang.annotation.Annotation> java.security.PrivilegedAction<T> getAnnotationAction​(java.lang.reflect.AnnotatedElement element,
                                                                                                                        java.lang.Class<T> annotationClazz)
        Return a PrivilegedAction object for AnnotatedElement.getAnnotation(). Requires security policy: 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
        Returns:
        Annotation
      • validateAction

        public static <T> java.security.PrivilegedAction<java.util.Set<jakarta.validation.ConstraintViolation<T>>> validateAction​(jakarta.validation.Validator validator,
                                                                                                                                  T arg0,
                                                                                                                                  java.lang.Class<?>[] groups)
        Return a PrivilegeAction object for jakarta.validation.Validator.validate(). Requires security policy: 'permission java.lang.RuntimePermission "accessDeclaredMemeber";'
      • buildDefaultValidatorFactoryAction

        public static <T> java.security.PrivilegedAction<jakarta.validation.ValidatorFactory> buildDefaultValidatorFactoryAction()
        Return a PrivilegeAction object for jakarta.validation.Validation.buildDefaultValidatorFactory(). Requires security policy: 'permission java.lang.RuntimePermission "createClassLoader";'
      • createURL

        public static java.security.PrivilegedExceptionAction<java.net.URL> createURL​(java.lang.String url)
                                                                               throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException