Package java.security

Examples of java.security.CodeSource


            ProtectionDomain pd = (ProtectionDomain)pdCache.get(bytecode.codebase);
            if (pd == null) {
                try {
                    URL url = urlFactory.getCodeBase(bytecode.codebase);
                   
                    CodeSource source = new CodeSource(url, (Certificate[])null);
                    pd = new ProtectionDomain(source, null, this, null);
                    pdCache.put(bytecode.codebase, pd);
                } catch (MalformedURLException mux) {
                    throw new ClassNotFoundException(name, mux);
                }
View Full Code Here


            }

        }

        // Create the code source object
        CodeSource codeSource =
            new CodeSource(entry.codeBase, entry.certificates);

        if (securityManager != null) {

            // Checking sealing
            if (pkg != null) {
View Full Code Here

            }

            try {
                clazz = defineClass(name, entry.binaryContent, 0,
                        entry.binaryContent.length,
                        new CodeSource(entry.codeBase, entry.certificates));
            } catch (UnsupportedClassVersionError ucve) {
                throw new UnsupportedClassVersionError(
                        ucve.getLocalizedMessage() + " " +
                        sm.getString("webappClassLoader.wrongVersion",
                                name));
View Full Code Here

            }

            try {
                clazz = defineClass(name, entry.binaryContent, 0,
                        entry.binaryContent.length,
                        new CodeSource(entry.codeBase, entry.certificates));
            } catch (UnsupportedClassVersionError ucve) {
                throw new UnsupportedClassVersionError(
                        ucve.getLocalizedMessage() + " " +
                        sm.getString("webappClassLoader.wrongVersion",
                                name));
View Full Code Here

        String location = "?";
        String version = "?";
        ClassLoader lastLoader = null;
        if (callerClass != null) {
            try {
                final CodeSource source = callerClass.getProtectionDomain().getCodeSource();
                if (source != null) {
                    final URL locationURL = source.getLocation();
                    if (locationURL != null) {
                        final String str = locationURL.toString().replace('\\', '/');
                        int index = str.lastIndexOf("/");
                        if (index >= 0 && index == str.length() - 1) {
                            index = str.lastIndexOf("/", index - 1);
View Full Code Here

    public RhinoClassLoader(URL documentURL){
        super(documentURL != null ? new URL[]{documentURL} : new URL[]{});
        // super(new URL[]{});
        this.documentURL = documentURL;
        if (documentURL != null){
            codeSource = new CodeSource(documentURL, null);
        }
        
        //
        // Create the Rhino ProtectionDomain
        // and AccessControlContext
View Full Code Here

    {
         return (String)AccessController.doPrivileged( new PrivilegedAction()
        {
            public Object run()
            {
                CodeSource cs = null;
                try {
                    cs = cls.getProtectionDomain().getCodeSource ();
                }
                catch (SecurityException se) {
                    return Main.getTextMessage("SIF01.V", cls, se.getMessage());
                }
                if ( cs == null )
                    return null;       
    
                URL result = cs.getLocation ();
    
                return formatURL(result);
            }
        });
    }
View Full Code Here

            }
        }
        // Now read the class bytes and define the class
        byte[] b = res.getBytes();
        Certificate[] certs = res.getCertificates();
        CodeSource cs = new CodeSource(url, certs);

        //@olsen: performance bug 4457471: circumvent enhancer for
        // non-enhancable classes
        final String classPath = name.replace('.', '/');
        if (!metaData.isKnownUnenhancableClass(classPath)) {
View Full Code Here

public class derbyrunjartest {

    public static void main(String[] args) throws Exception
    {
        // get location of run class.
        CodeSource cs = null;
        try {
            cs = org.apache.derby.iapi.tools.run.class.getProtectionDomain().getCodeSource();
        } catch (SecurityException se) {
            System.out.println("Security exception: " + se.getMessage());
        }
        URL result = cs.getLocation();
        jvm jvm = null;
        String derbyrunloc = null;

        if (result.toString().endsWith(".jar")) {
            derbyrunloc = result.toString().substring(5);
View Full Code Here

   * @tests java.security.SecureClassLoader#getPermissions(java.security.CodeSource)
   */
  public void test_getPermissionsLjava_security_CodeSource() throws IOException {
    class MyClassLoader extends SecureClassLoader {
      public PermissionCollection getPerms() {
        return super.getPermissions(new CodeSource(null,
            (Certificate[]) null));
      }

      public Class define(String name, byte[] bytes) {
        return defineClass(name, bytes, 0, bytes.length,
View Full Code Here

TOP

Related Classes of java.security.CodeSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.