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


Java ResourcesMgr.getString方法代码示例

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


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

示例1: skipEntry

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
/**
 * skip all tokens for this entry leaving the delimiter ";"
 * in the stream.
 */
private void skipEntry() throws ParsingException, IOException {
    while(lookahead != ';') {
        switch (lookahead) {
        case StreamTokenizer.TT_NUMBER:
            throw new ParsingException(st.lineno(), ";",
                                      ResourcesMgr.getString("number.") +
                                      String.valueOf(st.nval));
        case StreamTokenizer.TT_EOF:
            throw new ParsingException(ResourcesMgr.getString
                    ("expected.read.end.of.file."));
        default:
            lookahead = st.nextToken();
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:PolicyParser.java

示例2: init

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
private void init(URL config,
                  Map<String, List<AppConfigurationEntry>> newConfig)
                  throws IOException {

    try (InputStreamReader isr
            = new InputStreamReader(getInputStream(config), "UTF-8")) {
        readConfig(isr, newConfig);
    } catch (FileNotFoundException fnfe) {
        if (debugConfig != null) {
            debugConfig.println(fnfe.toString());
        }
        throw new IOException(ResourcesMgr.getString
            ("Configuration.Error.No.such.file.or.directory",
            "sun.security.util.AuthResources"));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:ConfigFile.java

示例3: expand

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
private String expand(String value)
		throws PropertyExpander.ExpandException, IOException {

	if ("".equals(value)) {
		return value;
	}

	if (expandProp) {

		String s = PropertyExpander.expand(value);

		if (s == null || s.length() == 0) {
			MessageFormat form = new MessageFormat(
					ResourcesMgr
							.getString(
									"Configuration Error:\n\tLine line: "
											+ "system property [value] expanded to empty value",
									"sun.security.util.AuthResources"));
			Object[] source = { new Integer(linenum), value };
			throw new IOException(form.format(source));
		}
		return s;
	} else {
		return value;
	}
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:27,代码来源:ConfigurationLogin.java

示例4: ParsingException

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
public ParsingException(int line, String expect, String actual) {
    super("line " + line + ": expected [" + expect +
        "], found [" + actual + "]");
    MessageFormat form = new MessageFormat(ResourcesMgr.getString
        ("line.number.expected.expect.found.actual."));
    Object[] source = {new Integer(line), expect, actual};
    i18nMessage = form.format(source);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:PolicyParser.java

示例5: readObject

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
/**
 * Reads this object from a stream (i.e., deserializes it)
 */
@SuppressWarnings("unchecked")
private void readObject(java.io.ObjectInputStream s)
            throws java.io.IOException, ClassNotFoundException {

    ObjectInputStream.GetField gf = s.readFields();

    readOnly = gf.get("readOnly", false);

    Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null);

    // Rewrap the principals into a SecureSet
    if (inputPrincs == null) {
        throw new NullPointerException
            (ResourcesMgr.getString("invalid.null.input.s."));
    }
    try {
        principals = Collections.synchronizedSet(new SecureSet<Principal>
                            (this, PRINCIPAL_SET, inputPrincs));
    } catch (NullPointerException npe) {
        // Sometimes people deserialize the principals set only.
        // Subject is not accessible, so just don't fail.
        principals = Collections.synchronizedSet
                    (new SecureSet<Principal>(this, PRINCIPAL_SET));
    }

    // The Credential {@code Set} is not serialized, but we do not
    // want the default deserialization routine to set it to null.
    this.pubCredentials = Collections.synchronizedSet
                    (new SecureSet<Object>(this, PUB_CREDENTIAL_SET));
    this.privCredentials = Collections.synchronizedSet
                    (new SecureSet<Object>(this, PRIV_CREDENTIAL_SET));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:Subject.java

示例6: ParsingException

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
public ParsingException(int line, String msg) {
    super("line " + line + ": " + msg);
    MessageFormat form = new MessageFormat
        (ResourcesMgr.getString("line.number.msg"));
    Object[] source = {new Integer(line), msg};
    i18nMessage = form.format(source);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:PolicyParser.java

示例7: add

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
@Override
public boolean add(T o) {

    if (!c.isAssignableFrom(o.getClass())) {
        MessageFormat form = new MessageFormat(ResourcesMgr.getString
                ("attempting.to.add.an.object.which.is.not.an.instance.of.class"));
        Object[] source = {c.toString()};
        throw new SecurityException(form.format(source));
    }

    return set.add(o);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:Subject.java

示例8: add

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
void add(KeyStoreEntry entry) throws ParsingException {
    String keystoreName = entry.getName();
    if (!entries.containsKey(keystoreName)) {
        entries.put(keystoreName, entry);
    } else {
        MessageFormat form = new MessageFormat(ResourcesMgr.getString(
            "duplicate.keystore.name"));
        Object[] source = {keystoreName};
        throw new ParsingException(form.format(source));
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:PolicyParser.java

示例9: ParsingException

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
public ParsingException(int line, String msg) {
    super("line " + line + ": " + msg);
    // don't call form.format unless getLocalizedMessage is called
    // to avoid unnecessary permission checks
    form = new MessageFormat(ResourcesMgr.getString("line.number.msg"));
    source = new Object[] {line, msg};
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:8,代码来源:PolicyParser.java

示例10: parseKeyStoreEntry

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
/**
 * parses a keystore entry
 */
private void parseKeyStoreEntry() throws ParsingException, IOException {
    match("keystore");
    keyStoreUrlString = match("quoted string");

    // parse keystore type
    if (!peek(",")) {
        return; // default type
    }
    match(",");

    if (peek("\"")) {
        keyStoreType = match("quoted string");
    } else {
        throw new ParsingException(st.lineno(),
                    ResourcesMgr.getString("expected.keystore.type"));
    }

    // parse keystore provider
    if (!peek(",")) {
        return; // provider optional
    }
    match(",");

    if (peek("\"")) {
        keyStoreProvider = match("quoted string");
    } else {
        throw new ParsingException(st.lineno(),
                    ResourcesMgr.getString("expected.keystore.provider"));
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:34,代码来源:PolicyParser.java

示例11: ioException

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
private IOException ioException(String resourceKey, Object... args) {
    MessageFormat form = new MessageFormat(ResourcesMgr.getString
        (resourceKey, "sun.security.util.AuthResources"));
    return new IOException(form.format(args));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:ConfigFile.java

示例12: doAsPrivileged

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
/**
 * Perform privileged work as a particular {@code Subject}.
 *
 * <p> This method behaves exactly as {@code Subject.doAs},
 * except that instead of retrieving the current Thread's
 * {@code AccessControlContext}, it uses the provided
 * {@code AccessControlContext}.  If the provided
 * {@code AccessControlContext} is {@code null},
 * this method instantiates a new {@code AccessControlContext}
 * with an empty collection of ProtectionDomains.
 *
 * <p>
 *
 * @param subject the {@code Subject} that the specified
 *                  {@code action} will run as.  This parameter
 *                  may be {@code null}. <p>
 *
 * @param <T> the type of the value returned by the
 *                  PrivilegedExceptionAction's {@code run} method.
 *
 * @param action the code to be run as the specified
 *                  {@code Subject}. <p>
 *
 * @param acc the {@code AccessControlContext} to be tied to the
 *                  specified <i>subject</i> and <i>action</i>. <p>
 *
 * @return the value returned by the
 *                  PrivilegedExceptionAction's {@code run} method.
 *
 * @exception PrivilegedActionException if the
 *                  {@code PrivilegedExceptionAction.run}
 *                  method throws a checked exception. <p>
 *
 * @exception NullPointerException if the specified
 *                  {@code PrivilegedExceptionAction} is
 *                  {@code null}. <p>
 *
 * @exception SecurityException if the caller does not have permission
 *                  to invoke this method.
 */
public static <T> T doAsPrivileged(final Subject subject,
                    final java.security.PrivilegedExceptionAction<T> action,
                    final java.security.AccessControlContext acc)
                    throws java.security.PrivilegedActionException {

    java.lang.SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
    }

    if (action == null)
        throw new NullPointerException
            (ResourcesMgr.getString("invalid.null.action.provided"));

    // set up the new Subject-based AccessControlContext for doPrivileged
    final AccessControlContext callerAcc =
            (acc == null ?
            new AccessControlContext(NULL_PD_ARRAY) :
            acc);

    // call doPrivileged and push this new context on the stack
    return java.security.AccessController.doPrivileged
                                    (action,
                                    createContext(subject, callerAcc));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:66,代码来源:Subject.java

示例13: toString

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
public String toString() {
    MessageFormat form = new MessageFormat(ResourcesMgr.getString
        ("CredOwner.Principal.Class.class.Principal.Name.name"));
    Object[] source = {principalClass, principalName};
    return (form.format(source));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:PrivateCredentialPermission.java

示例14: getSubject

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
/**
 * Get the {@code Subject} associated with the provided
 * {@code AccessControlContext}.
 *
 * <p> The {@code AccessControlContext} may contain many
 * Subjects (from nested {@code doAs} calls).
 * In this situation, the most recent {@code Subject} associated
 * with the {@code AccessControlContext} is returned.
 *
 * <p>
 *
 * @param  acc the {@code AccessControlContext} from which to retrieve
 *          the {@code Subject}.
 *
 * @return  the {@code Subject} associated with the provided
 *          {@code AccessControlContext}, or {@code null}
 *          if no {@code Subject} is associated
 *          with the provided {@code AccessControlContext}.
 *
 * @exception SecurityException if the caller does not have permission
 *          to get the {@code Subject}. <p>
 *
 * @exception NullPointerException if the provided
 *          {@code AccessControlContext} is {@code null}.
 */
public static Subject getSubject(final AccessControlContext acc) {

    java.lang.SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(AuthPermissionHolder.GET_SUBJECT_PERMISSION);
    }

    if (acc == null) {
        throw new NullPointerException(ResourcesMgr.getString
            ("invalid.null.AccessControlContext.provided"));
    }

    // return the Subject from the DomainCombiner of the provided context
    return AccessController.doPrivileged
        (new java.security.PrivilegedAction<Subject>() {
        public Subject run() {
            DomainCombiner dc = acc.getDomainCombiner();
            if (!(dc instanceof SubjectDomainCombiner))
                return null;
            SubjectDomainCombiner sdc = (SubjectDomainCombiner)dc;
            return sdc.getSubject();
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:Subject.java

示例15: init

import sun.security.util.ResourcesMgr; //导入方法依赖的package包/类
private void init(String name) throws LoginException {

        SecurityManager sm = System.getSecurityManager();
        if (sm != null && creatorAcc == null) {
            sm.checkPermission(new AuthPermission
                                ("createLoginContext." + name));
        }

        if (name == null)
            throw new LoginException
                (ResourcesMgr.getString("Invalid.null.input.name"));

        // get the Configuration
        if (config == null) {
            config = java.security.AccessController.doPrivileged
                (new java.security.PrivilegedAction<Configuration>() {
                public Configuration run() {
                    return Configuration.getConfiguration();
                }
            });
        }

        // get the LoginModules configured for this application
        AppConfigurationEntry[] entries = config.getAppConfigurationEntry(name);
        if (entries == null) {

            if (sm != null && creatorAcc == null) {
                sm.checkPermission(new AuthPermission
                                ("createLoginContext." + OTHER));
            }

            entries = config.getAppConfigurationEntry(OTHER);
            if (entries == null) {
                MessageFormat form = new MessageFormat(ResourcesMgr.getString
                        ("No.LoginModules.configured.for.name"));
                Object[] source = {name};
                throw new LoginException(form.format(source));
            }
        }
        moduleStack = new ModuleInfo[entries.length];
        for (int i = 0; i < entries.length; i++) {
            // clone returned array
            moduleStack[i] = new ModuleInfo
                                (new AppConfigurationEntry
                                        (entries[i].getLoginModuleName(),
                                        entries[i].getControlFlag(),
                                        entries[i].getOptions()),
                                null);
        }

        contextClassLoader = java.security.AccessController.doPrivileged
                (new java.security.PrivilegedAction<ClassLoader>() {
                public ClassLoader run() {
                    ClassLoader loader =
                            Thread.currentThread().getContextClassLoader();
                    if (loader == null) {
                        // Don't use bootstrap class loader directly to ensure
                        // proper package access control!
                        loader = ClassLoader.getSystemClassLoader();
                    }

                    return loader;
                }
        });
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:66,代码来源:LoginContext.java


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