本文整理汇总了Java中sun.security.util.ResourcesMgr类的典型用法代码示例。如果您正苦于以下问题:Java ResourcesMgr类的具体用法?Java ResourcesMgr怎么用?Java ResourcesMgr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourcesMgr类属于sun.security.util包,在下文中一共展示了ResourcesMgr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import sun.security.util.ResourcesMgr; //导入依赖的package包/类
@Override public String toString(){
StringBuilder sb = new StringBuilder();
sb.append(ResourcesMgr.getString("LPARAM"));
sb.append(getCodeSource());
sb.append("\n");
for (int j = 0; j < permissions.size(); j++) {
Permission p = permissions.get(j);
sb.append(ResourcesMgr.getString("SPACE"));
sb.append(ResourcesMgr.getString("SPACE"));
sb.append(p);
sb.append(ResourcesMgr.getString("NEWLINE"));
}
sb.append(ResourcesMgr.getString("RPARAM"));
sb.append(ResourcesMgr.getString("NEWLINE"));
return sb.toString();
}
示例2: 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();
}
}
}
示例3: 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"));
}
}
示例4: collectionNullClean
import sun.security.util.ResourcesMgr; //导入依赖的package包/类
/**
* Tests for null-clean collections (both non-null reference and
* no null elements)
*
* @param coll A {@code Collection} to be tested for null references
*
* @throws NullPointerException if the specified collection is either
* {@code null} or contains a {@code null} element
*/
private static void collectionNullClean(Collection<?> coll) {
boolean hasNullElements = false;
Objects.requireNonNull(coll,
ResourcesMgr.getString("invalid.null.input.s."));
try {
hasNullElements = coll.contains(null);
} catch (NullPointerException npe) {
// A null-hostile collection may choose to throw
// NullPointerException if contains(null) is called on it
// rather than returning false.
// If this happens we know the collection is null-clean.
hasNullElements = false;
} finally {
if (hasNullElements) {
throw new NullPointerException
(ResourcesMgr.getString("invalid.null.input.s."));
}
}
}
示例5: remove
import sun.security.util.ResourcesMgr; //导入依赖的package包/类
public boolean remove(Object o) {
Objects.requireNonNull(o,
ResourcesMgr.getString("invalid.null.input.s."));
final Iterator<E> e = iterator();
while (e.hasNext()) {
E next;
if (which != Subject.PRIV_CREDENTIAL_SET) {
next = e.next();
} else {
next = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<E>() {
public E run() {
return e.next();
}
});
}
if (next.equals(o)) {
e.remove();
return true;
}
}
return false;
}
示例6: 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;
}
}
示例7: 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"));
}
}
示例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));
}
}
示例9: 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);
}
示例10: 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));
}
示例11: add
import sun.security.util.ResourcesMgr; //导入依赖的package包/类
public boolean add(E o) {
if (subject.isReadOnly()) {
throw new IllegalStateException
(ResourcesMgr.getString("Subject.is.read.only"));
}
java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) {
switch (which) {
case Subject.PRINCIPAL_SET:
sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION);
break;
case Subject.PUB_CREDENTIAL_SET:
sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION);
break;
default:
sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION);
break;
}
}
switch (which) {
case Subject.PRINCIPAL_SET:
if (!(o instanceof Principal)) {
throw new SecurityException(ResourcesMgr.getString
("attempting.to.add.an.object.which.is.not.an.instance.of.java.security.Principal.to.a.Subject.s.Principal.Set"));
}
break;
default:
// ok to add Objects of any kind to credential sets
break;
}
// check for duplicates
if (!elements.contains(o))
return elements.add(o);
else
return false;
}
示例12: 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.getAuthResourceString
("Configuration.Error.No.such.file.or.directory"));
}
}
示例13: toString
import sun.security.util.ResourcesMgr; //导入依赖的package包/类
/**
* Return a String representation of this <code>SubjectCodeSource</code>.
*
* <p>
*
* @return a String representation of this <code>SubjectCodeSource</code>.
*/
public String toString() {
String returnMe = super.toString();
if (getSubject() != null) {
if (debug != null) {
final Subject finalSubject = getSubject();
returnMe = returnMe + "\n" +
java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<String>() {
public String run() {
return finalSubject.toString();
}
});
} else {
returnMe = returnMe + "\n" + getSubject().toString();
}
}
if (principals != null) {
ListIterator<PrincipalEntry> li = principals.listIterator();
while (li.hasNext()) {
PrincipalEntry pppe = li.next();
returnMe = returnMe + ResourcesMgr.getAuthResourceString("NEWLINE") +
pppe.getPrincipalClass() + " " +
pppe.getPrincipalName();
}
}
return returnMe;
}
示例14: 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);
Objects.requireNonNull(inputPrincs,
ResourcesMgr.getString("invalid.null.input.s."));
// Rewrap the principals into a SecureSet
try {
principals = Collections.synchronizedSet(new SecureSet<>
(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<>(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<>(this, PUB_CREDENTIAL_SET));
this.privCredentials = Collections.synchronizedSet
(new SecureSet<>(this, PRIV_CREDENTIAL_SET));
}
示例15: contains
import sun.security.util.ResourcesMgr; //导入依赖的package包/类
public boolean contains(Object o) {
Objects.requireNonNull(o,
ResourcesMgr.getString("invalid.null.input.s."));
final Iterator<E> e = iterator();
while (e.hasNext()) {
E next;
if (which != Subject.PRIV_CREDENTIAL_SET) {
next = e.next();
} else {
// For private credentials:
// If the caller does not have read permission for
// for o.getClass(), we throw a SecurityException.
// Otherwise we check the private cred set to see whether
// it contains the Object
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new PrivateCredentialPermission
(o.getClass().getName(),
subject.getPrincipals()));
}
next = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<E>() {
public E run() {
return e.next();
}
});
}
if (next.equals(o)) {
return true;
}
}
return false;
}