當前位置: 首頁>>代碼示例>>Java>>正文


Java PrivilegedActionException.printStackTrace方法代碼示例

本文整理匯總了Java中java.security.PrivilegedActionException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java PrivilegedActionException.printStackTrace方法的具體用法?Java PrivilegedActionException.printStackTrace怎麽用?Java PrivilegedActionException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.security.PrivilegedActionException的用法示例。


在下文中一共展示了PrivilegedActionException.printStackTrace方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: include

import java.security.PrivilegedActionException; //導入方法依賴的package包/類
/**
 * Include the response from another resource in the current response.
 * Any runtime exception, IOException, or ServletException thrown by the
 * called servlet will be propogated to the caller.
 *
 * @param request The servlet request that is including this one
 * @param response The servlet response to be appended to
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet exception occurs
 */
public void include(ServletRequest request, ServletResponse response)
    throws ServletException, IOException
{
    if (System.getSecurityManager() != null) {
        try {
            PrivilegedInclude dp = new PrivilegedInclude(request,response);
            AccessController.doPrivileged(dp);
        } catch (PrivilegedActionException pe) {
            Exception e = pe.getException();
            pe.printStackTrace();
            if (e instanceof ServletException)
                throw (ServletException) e;
            throw (IOException) e;
        }
    } else {
        doInclude(request,response);
    }
}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:30,代碼來源:ApplicationDispatcher.java

示例2: initializeInputMethodLocatorList

import java.security.PrivilegedActionException; //導入方法依賴的package包/類
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:31,代碼來源:ExecutableInputMethodManager.java

示例3: getDeclaredFields

import java.security.PrivilegedActionException; //導入方法依賴的package包/類
static protected Field[] getDeclaredFields(final Class<?> clz) {
    try {
        return (System.getSecurityManager() == null) ? clz .getDeclaredFields() :
            AccessController.doPrivileged(new PrivilegedExceptionAction<Field[]>() {
                    @Override
                    public Field[] run() throws IllegalAccessException {
                        return clz.getDeclaredFields();
                    }
                });
    } catch (PrivilegedActionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:16,代碼來源:JAXBWrapperAccessor.java

示例4: initializeInputMethodLocatorList

import java.security.PrivilegedActionException; //導入方法依賴的package包/類
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.load(InputMethodDescriptor.class,
                                           ClassLoader.getSystemClassLoader())) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:ExecutableInputMethodManager.java

示例5: searchSubject

import java.security.PrivilegedActionException; //導入方法依賴的package包/類
/**
 * Searches the private credentials of current Subject with the
 * specified criteria and returns the matching GSSCredentialSpi
 * object out of Sun's impl of GSSCredential. Returns null if
 * no Subject present or a Vector which contains 0 or more
 * matching GSSCredentialSpi objects.
 */
public static <T extends GSSCredentialSpi> Vector<T>
        searchSubject(final GSSNameSpi name,
                      final Oid mech,
                      final boolean initiate,
                      final Class<? extends T> credCls) {
    debug("Search Subject for " + getMechStr(mech) +
          (initiate? " INIT" : " ACCEPT") + " cred (" +
          (name == null? "<<DEF>>" : name.toString()) + ", " +
          credCls.getName() + ")");
    final AccessControlContext acc = AccessController.getContext();
    try {
        Vector<T> creds =
            AccessController.doPrivileged
            (new PrivilegedExceptionAction<Vector<T>>() {
                public Vector<T> run() throws Exception {
                    Subject accSubj = Subject.getSubject(acc);
                    Vector<T> result = null;
                    if (accSubj != null) {
                        result = new Vector<T>();
                        Iterator<GSSCredentialImpl> iterator =
                            accSubj.getPrivateCredentials
                            (GSSCredentialImpl.class).iterator();
                        while (iterator.hasNext()) {
                            GSSCredentialImpl cred = iterator.next();
                            debug("...Found cred" + cred);
                            try {
                                GSSCredentialSpi ce =
                                    cred.getElement(mech, initiate);
                                debug("......Found element: " + ce);
                                if (ce.getClass().equals(credCls) &&
                                    (name == null ||
                                     name.equals((Object) ce.getName()))) {
                                    result.add(credCls.cast(ce));
                                } else {
                                    debug("......Discard element");
                                }
                            } catch (GSSException ge) {
                                debug("...Discard cred (" + ge + ")");
                            }
                        }
                    } else debug("No Subject");
                    return result;
                }
            });
        return creds;
    } catch (PrivilegedActionException pae) {
        debug("Unexpected exception when searching Subject:");
        if (DEBUG) pae.printStackTrace();
        return null;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:59,代碼來源:GSSUtil.java


注:本文中的java.security.PrivilegedActionException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。