当前位置: 首页>>代码示例>>Java>>正文


Java Debug.isOn方法代码示例

本文整理汇总了Java中sun.security.util.Debug.isOn方法的典型用法代码示例。如果您正苦于以下问题:Java Debug.isOn方法的具体用法?Java Debug.isOn怎么用?Java Debug.isOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.security.util.Debug的用法示例。


在下文中一共展示了Debug.isOn方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import sun.security.util.Debug; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {

        if (!Debug.isOn("access") ||
                !Debug.isOn("stack") ||
                !Debug.isOn("logincontext") ||
                !Debug.isOn("domain") ||
                !Debug.isOn("combiner") ||
                !Debug.isOn("failure") ||
                !Debug.isOn("jar") ||
                !Debug.isOn("permission=sun.dummy.DummyPermission") ||
                Debug.isOn("permission=sun.dummy.dummypermission") ||
                !Debug.isOn("permission=sun.Dummy.DummyPermission2") ||
                !Debug.isOn("permission=sun.dummy.DummyPermission3") ||
                !Debug.isOn("codebase=/dir1/DIR2/Dir3/File.java") ||
                Debug.isOn("codebase=/dir1/dir2/dir3/file.java") ||
                !Debug.isOn("codebase=www.sun.com") ||
                !Debug.isOn("codebase=file:///C:/temp/foo%20more/a.txt") ||
                !Debug.isOn("codebase=http://www.sun.com/search?q=SunMicro") ) {
            throw new Exception("sun.security.Debug failed to parse options");
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:MultiOptions.java

示例2: checkPermission

import sun.security.util.Debug; //导入方法依赖的package包/类
/**
 * Determines whether the access request indicated by the
 * specified permission should be allowed or denied, based on
 * the current AccessControlContext and security policy.
 * This method quietly returns if the access request
 * is permitted, or throws an AccessControlException otherwise. The
 * getPermission method of the AccessControlException returns the
 * {@code perm} Permission object instance.
 *
 * @param perm the requested permission.
 *
 * @exception AccessControlException if the specified permission
 *            is not permitted, based on the current security policy.
 * @exception NullPointerException if the specified permission
 *            is {@code null} and is checked based on the
 *            security policy currently in effect.
 */

public static void checkPermission(Permission perm)
    throws AccessControlException
{
    //System.err.println("checkPermission "+perm);
    //Thread.currentThread().dumpStack();

    if (perm == null) {
        throw new NullPointerException("permission can't be null");
    }

    AccessControlContext stack = getStackAccessControlContext();
    // if context is null, we had privileged system code on the stack.
    if (stack == null) {
        Debug debug = AccessControlContext.getDebug();
        boolean dumpDebug = false;
        if (debug != null) {
            dumpDebug = !Debug.isOn("codebase=");
            dumpDebug &= !Debug.isOn("permission=") ||
                Debug.isOn("permission=" + perm.getClass().getCanonicalName());
        }

        if (dumpDebug && Debug.isOn("stack")) {
            Thread.dumpStack();
        }

        if (dumpDebug && Debug.isOn("domain")) {
            debug.println("domain (context is null)");
        }

        if (dumpDebug) {
            debug.println("access allowed "+perm);
        }
        return;
    }

    AccessControlContext acc = stack.optimize();
    acc.checkPermission(perm);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:57,代码来源:AccessController.java

示例3: isUntrusted

import sun.security.util.Debug; //导入方法依赖的package包/类
private boolean isUntrusted()
    throws UnknownHostException
{
    if (trusted) return false;
    if (invalid || untrusted) return true;
    try {
        if (!trustNameService && (defaultDeny ||
            sun.net.www.URLConnection.isProxiedHost(hostname))) {
            if (this.cname == null) {
                this.getCanonName();
            }
            if (!match(cname, hostname)) {
                // Last chance
                if (!authorized(hostname, addresses[0].getAddress())) {
                    untrusted = true;
                    Debug debug = getDebug();
                    if (debug != null && Debug.isOn("failure")) {
                        debug.println("socket access restriction: proxied host " + "(" + addresses[0] + ")" + " does not match " + cname + " from reverse lookup");
                    }
                    return true;
                }
            }
            trusted = true;
        }
    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:SocketPermission.java

示例4: checkPermission

import sun.security.util.Debug; //导入方法依赖的package包/类
/** 
    * Determines whether the access request indicated by the
    * specified permission should be allowed or denied, based on
    * the current AccessControlContext and security policy.
    * This method quietly returns if the access request
    * is permitted, or throws a suitable AccessControlException otherwise. 
    *
    * @param perm the requested permission.
    * 
    * @exception AccessControlException if the specified permission
    *            is not permitted, based on the current security policy.
    * @exception NullPointerException if the specified permission
    *            is <code>null</code> and is checked based on the
    *            security policy currently in effect.
    */

   public static void checkPermission(Permission perm)
	 throws AccessControlException 
   {
//System.err.println("checkPermission "+perm);
//Thread.currentThread().dumpStack();

if (perm == null) {
    throw new NullPointerException("permission can't be null");
}

AccessControlContext stack = getStackAccessControlContext();
// if context is null, we had privileged system code on the stack.
if (stack == null) {
    Debug debug = AccessControlContext.getDebug();
    boolean dumpDebug = false;
    if (debug != null) {
	dumpDebug = !Debug.isOn("codebase=");
	dumpDebug &= !Debug.isOn("permission=") ||
	    Debug.isOn("permission=" + perm.getClass().getCanonicalName());
    }

    if (dumpDebug && Debug.isOn("stack")) {
	Thread.currentThread().dumpStack();
    }

    if (dumpDebug && Debug.isOn("domain")) {
	debug.println("domain (context is null)");
    }

    if (dumpDebug) {
	debug.println("access allowed "+perm);
    }
    return;
}

AccessControlContext acc = stack.optimize();
acc.checkPermission(perm);
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:55,代码来源:AccessController.java

示例5: checkPermission

import sun.security.util.Debug; //导入方法依赖的package包/类
/**
 * Determines whether the access request indicated by the
 * specified permission should be allowed or denied, based on
 * the current AccessControlContext and security policy.
 * This method quietly returns if the access request
 * is permitted, or throws an AccessControlException otherwise. The
 * getPermission method of the AccessControlException returns the
 * <code>perm</code> Permission object instance.
 *
 * @param perm the requested permission.
 *
 * @exception AccessControlException if the specified permission
 *            is not permitted, based on the current security policy.
 * @exception NullPointerException if the specified permission
 *            is <code>null</code> and is checked based on the
 *            security policy currently in effect.
 */

public static void checkPermission(Permission perm)
             throws AccessControlException
{
    //System.err.println("checkPermission "+perm);
    //Thread.currentThread().dumpStack();

    if (perm == null) {
        throw new NullPointerException("permission can't be null");
    }

    AccessControlContext stack = getStackAccessControlContext();
    // if context is null, we had privileged system code on the stack.
    if (stack == null) {
        Debug debug = AccessControlContext.getDebug();
        boolean dumpDebug = false;
        if (debug != null) {
            dumpDebug = !Debug.isOn("codebase=");
            dumpDebug &= !Debug.isOn("permission=") ||
                Debug.isOn("permission=" + perm.getClass().getCanonicalName());
        }

        if (dumpDebug && Debug.isOn("stack")) {
            Thread.currentThread().dumpStack();
        }

        if (dumpDebug && Debug.isOn("domain")) {
            debug.println("domain (context is null)");
        }

        if (dumpDebug) {
            debug.println("access allowed "+perm);
        }
        return;
    }

    AccessControlContext acc = stack.optimize();
    acc.checkPermission(perm);
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:57,代码来源:AccessController.java

示例6: matchPathToNames

import sun.security.util.Debug; //导入方法依赖的package包/类
private boolean matchPathToNames(X509Certificate xcert) {
    if (pathToGeneralNames == null) {
        return true;
    }
    try {
        NameConstraintsExtension ext = (NameConstraintsExtension)
            getExtensionObject(xcert, NAME_CONSTRAINTS_ID);
        if (ext == null) {
            return true;
        }
        if ((debug != null) && Debug.isOn("certpath")) {
            debug.println("X509CertSelector.match pathToNames:\n");
            Iterator<GeneralNameInterface> i =
                                    pathToGeneralNames.iterator();
            while (i.hasNext()) {
                debug.println("    " + i.next() + "\n");
            }
        }

        GeneralSubtrees permitted =
                ext.get(NameConstraintsExtension.PERMITTED_SUBTREES);
        GeneralSubtrees excluded =
                ext.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
        if (excluded != null) {
            if (matchExcluded(excluded) == false) {
                return false;
            }
        }
        if (permitted != null) {
            if (matchPermitted(permitted) == false) {
                return false;
            }
        }
    } catch (IOException ex) {
        if (debug != null) {
            debug.println("X509CertSelector.match: "
                + "IOException in name constraints check");
        }
        return false;
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:X509CertSelector.java

示例7: getCanonName

import sun.security.util.Debug; //导入方法依赖的package包/类
/**
    * attempt to get the fully qualified domain name
    *
    */
   void getCanonName()
throws UnknownHostException
   {
if (cname != null || invalid || untrusted) return;

// attempt to get the canonical name

try { 
    // first get the IP addresses if we don't have them yet
    // this is because we need the IP address to then get 
    // FQDN.
    if (addresses == null) {
	getIP();
    }

    // we have to do this check, otherwise we might not
    // get the fully qualified domain name
    if (init_with_ip) {
	cname = addresses[0].getHostName(false).toLowerCase();
    } else {
        cname = InetAddress.getByName(addresses[0].getHostAddress()).
                                             getHostName(false).toLowerCase();
        if (!trustNameService && sun.net.www.URLConnection.isProxiedHost(hostname)) {
	    if (!match(cname, hostname) && 
		(defaultDeny || !cname.equals(addresses[0].getHostAddress()))) {
		// Last chance
		if (!authorized(hostname, addresses[0].getAddress())) {
		    untrusted = true;
		    Debug debug = getDebug();
		    if (debug != null && Debug.isOn("failure")) {
			debug.println("socket access restriction: proxied host " + "(" + addresses[0] + ")" + " does not match " + cname + " from reverse lookup");
		    }
		}
	    }
	}
    }
} catch (UnknownHostException uhe) {
    invalid = true;
    throw uhe;
}
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:46,代码来源:SocketPermission.java


注:本文中的sun.security.util.Debug.isOn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。