提交 dea845a6 编写于 作者: W weijun

6987827: security/util/Resources.java needs improvement

Reviewed-by: valeriep
上级 f820c65f
/*
* Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -68,7 +68,7 @@ public class NTDomainPrincipal implements Principal, java.io.Serializable {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
......@@ -99,7 +99,7 @@ public class NTDomainPrincipal implements Principal, java.io.Serializable {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTDomainPrincipal: name",
("NTDomainPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);
......
/*
* Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -70,7 +70,7 @@ public class NTNumericCredential {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTNumericCredential: name",
("NTNumericCredential.name",
"sun.security.util.AuthResources"));
Object[] source = {Long.toString(impersonationToken)};
return form.format(source);
......
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -73,7 +73,7 @@ public class NTSid implements Principal, java.io.Serializable {
if (stringSid == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"stringSid"};
throw new NullPointerException(form.format(source));
......@@ -81,7 +81,7 @@ public class NTSid implements Principal, java.io.Serializable {
if (stringSid.length() == 0) {
throw new IllegalArgumentException
(sun.security.util.ResourcesMgr.getString
("Invalid NTSid value",
("Invalid.NTSid.value",
"sun.security.util.AuthResources"));
}
sid = new String(stringSid);
......@@ -108,7 +108,7 @@ public class NTSid implements Principal, java.io.Serializable {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSid: name",
("NTSid.name",
"sun.security.util.AuthResources"));
Object[] source = {sid};
return form.format(source);
......
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -73,7 +73,7 @@ public class NTSidDomainPrincipal extends NTSid {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSidDomainPrincipal: name",
("NTSidDomainPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {getName()};
return form.format(source);
......
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -68,7 +68,7 @@ public class NTSidGroupPrincipal extends NTSid {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSidGroupPrincipal: name",
("NTSidGroupPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {getName()};
return form.format(source);
......
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -70,7 +70,7 @@ public class NTSidPrimaryGroupPrincipal extends NTSid {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSidPrimaryGroupPrincipal: name",
("NTSidPrimaryGroupPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {getName()};
return form.format(source);
......
/*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -67,7 +67,7 @@ public class NTSidUserPrincipal extends NTSid {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTSidUserPrincipal: name",
("NTSidUserPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {getName()};
return form.format(source);
......
/*
* Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -64,7 +64,7 @@ public class NTUserPrincipal implements Principal, java.io.Serializable {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
......@@ -93,7 +93,7 @@ public class NTUserPrincipal implements Principal, java.io.Serializable {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("NTUserPrincipal: name",
("NTUserPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);
......
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -490,9 +490,9 @@ public class PolicyFile extends javax.security.auth.Policy {
}
} catch (PolicyParser.ParsingException pe) {
System.err.println(AUTH_POLICY +
rb.getString(": error parsing ") + policy);
rb.getString(".error.parsing.") + policy);
System.err.println(AUTH_POLICY +
rb.getString(": ") +
rb.getString("COLON") +
pe.getMessage());
if (debug != null)
pe.printStackTrace();
......@@ -635,16 +635,16 @@ public class PolicyFile extends javax.security.auth.Policy {
} catch (java.lang.reflect.InvocationTargetException ite) {
System.err.println
(AUTH_POLICY +
rb.getString(": error adding Permission ") +
rb.getString(".error.adding.Permission.") +
pe.permission +
rb.getString(" ") +
rb.getString("SPACE") +
ite.getTargetException());
} catch (Exception e) {
System.err.println
(AUTH_POLICY +
rb.getString(": error adding Permission ") +
rb.getString(".error.adding.Permission.") +
pe.permission +
rb.getString(" ") +
rb.getString("SPACE") +
e);
}
}
......@@ -652,9 +652,9 @@ public class PolicyFile extends javax.security.auth.Policy {
} catch (Exception e) {
System.err.println
(AUTH_POLICY +
rb.getString(": error adding Entry ") +
rb.getString(".error.adding.Entry.") +
ge +
rb.getString(" ") +
rb.getString("SPACE") +
e);
}
......@@ -1373,18 +1373,18 @@ public class PolicyFile extends javax.security.auth.Policy {
public String toString(){
StringBuffer sb = new StringBuffer();
sb.append(rb.getString("("));
sb.append(rb.getString("LPARAM"));
sb.append(getCodeSource());
sb.append("\n");
for (int j = 0; j < permissions.size(); j++) {
Permission p = permissions.elementAt(j);
sb.append(rb.getString(" "));
sb.append(rb.getString(" "));
sb.append(rb.getString("SPACE"));
sb.append(rb.getString("SPACE"));
sb.append(p);
sb.append(rb.getString("\n"));
sb.append(rb.getString("NEWLINE"));
}
sb.append(rb.getString(")"));
sb.append(rb.getString("\n"));
sb.append(rb.getString("RPARAM"));
sb.append(rb.getString("NEWLINE"));
return sb.toString();
}
......@@ -1415,7 +1415,7 @@ class PolicyPermissions extends PermissionCollection {
if (isReadOnly())
throw new SecurityException
(PolicyFile.rb.getString
("attempt to add a Permission to a readonly PermissionCollection"));
("attempt.to.add.a.Permission.to.a.readonly.PermissionCollection"));
if (perms == null) {
if (additionalPerms == null)
......
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -300,7 +300,7 @@ class PolicyParser {
keyStoreType = match("quoted string");
} else {
throw new ParsingException(st.lineno(),
rb.getString("expected keystore type"));
rb.getString("expected.keystore.type"));
}
}
......@@ -368,8 +368,8 @@ class PolicyParser {
"WILDCARD class but no WILDCARD name");
throw new ParsingException
(st.lineno(),
rb.getString("can not specify Principal with a ") +
rb.getString("wildcard class without a wildcard name"));
rb.getString("can.not.specify.Principal.with.a.") +
rb.getString("wildcard.class.without.a.wildcard.name"));
}
try {
......@@ -389,7 +389,7 @@ class PolicyParser {
} else {
throw new
ParsingException(st.lineno(),
rb.getString("expected codeBase or SignedBy"));
rb.getString("expected.codeBase.or.SignedBy"));
}
}
......@@ -397,7 +397,7 @@ class PolicyParser {
if (principals == null) {
throw new ParsingException
(st.lineno(),
rb.getString("only Principal-based grant entries permitted"));
rb.getString("only.Principal.based.grant.entries.permitted"));
}
e.principals = principals;
......@@ -416,7 +416,7 @@ class PolicyParser {
} else {
throw new
ParsingException(st.lineno(),
rb.getString("expected permission entry"));
rb.getString("expected.permission.entry"));
}
}
match("}");
......@@ -522,12 +522,12 @@ class PolicyParser {
switch (lookahead) {
case StreamTokenizer.TT_NUMBER:
throw new ParsingException(st.lineno(), expect,
rb.getString("number ") +
rb.getString("number.") +
String.valueOf(st.nval));
case StreamTokenizer.TT_EOF:
throw new ParsingException
(rb.getString("expected ") + expect +
rb.getString(", read end of file"));
(rb.getString("expected.") + expect +
rb.getString(".read.end.of.file"));
case StreamTokenizer.TT_WORD:
if (expect.equalsIgnoreCase(st.sval)) {
lookahead = st.nextToken();
......@@ -603,11 +603,11 @@ class PolicyParser {
switch (lookahead) {
case StreamTokenizer.TT_NUMBER:
throw new ParsingException(st.lineno(), ";",
rb.getString("number ") +
rb.getString("number.") +
String.valueOf(st.nval));
case StreamTokenizer.TT_EOF:
throw new ParsingException
(rb.getString("expected ';', read end of file"));
(rb.getString("expected.read.end.of.file"));
default:
lookahead = st.nextToken();
}
......@@ -942,13 +942,13 @@ class PolicyParser {
}
public ParsingException(int line, String msg) {
super(rb.getString("line ") + line + rb.getString(": ") + msg);
super(rb.getString("line.") + line + rb.getString("COLON") + msg);
}
public ParsingException(int line, String expect, String actual) {
super(rb.getString("line ") + line + rb.getString(": expected '") +
expect + rb.getString("', found '") + actual +
rb.getString("'"));
super(rb.getString("line.") + line + rb.getString(".expected.") +
expect + rb.getString(".found.") + actual +
rb.getString("QUOTE"));
}
}
......
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -89,7 +89,7 @@ public class SolarisNumericGroupPrincipal implements
*/
public SolarisNumericGroupPrincipal(String name, boolean primaryGroup) {
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
throw new NullPointerException(rb.getString("provided.null.name"));
this.name = name;
this.primaryGroup = primaryGroup;
......@@ -165,9 +165,9 @@ public class SolarisNumericGroupPrincipal implements
public String toString() {
return((primaryGroup ?
rb.getString
("SolarisNumericGroupPrincipal [Primary Group]: ") + name :
("SolarisNumericGroupPrincipal.Primary.Group.") + name :
rb.getString
("SolarisNumericGroupPrincipal [Supplementary Group]: ") + name));
("SolarisNumericGroupPrincipal.Supplementary.Group.") + name));
}
/**
......
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -80,7 +80,7 @@ public class SolarisNumericUserPrincipal implements
*/
public SolarisNumericUserPrincipal(String name) {
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
throw new NullPointerException(rb.getString("provided.null.name"));
this.name = name;
}
......@@ -134,7 +134,7 @@ public class SolarisNumericUserPrincipal implements
* <code>SolarisNumericUserPrincipal</code>.
*/
public String toString() {
return(rb.getString("SolarisNumericUserPrincipal: ") + name);
return(rb.getString("SolarisNumericUserPrincipal.") + name);
}
/**
......
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -76,7 +76,7 @@ public class SolarisPrincipal implements Principal, java.io.Serializable {
*/
public SolarisPrincipal(String name) {
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
throw new NullPointerException(rb.getString("provided.null.name"));
this.name = name;
}
......@@ -100,7 +100,7 @@ public class SolarisPrincipal implements Principal, java.io.Serializable {
* @return a string representation of this <code>SolarisPrincipal</code>.
*/
public String toString() {
return(rb.getString("SolarisPrincipal: ") + name);
return(rb.getString("SolarisPrincipal.") + name);
}
/**
......
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -395,7 +395,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
principals.listIterator();
while (li.hasNext()) {
PolicyParser.PrincipalEntry pppe = li.next();
returnMe = returnMe + rb.getString("\n") +
returnMe = returnMe + rb.getString("NEWLINE") +
pppe.principalClass + " " +
pppe.principalName;
}
......
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -77,7 +77,7 @@ public class UnixNumericGroupPrincipal implements
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
......@@ -159,14 +159,14 @@ public class UnixNumericGroupPrincipal implements
if (primaryGroup) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("UnixNumericGroupPrincipal [Primary Group]: name",
("UnixNumericGroupPrincipal.Primary.Group.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);
} else {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("UnixNumericGroupPrincipal [Supplementary Group]: name",
("UnixNumericGroupPrincipal.Supplementary.Group.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);
......
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -67,7 +67,7 @@ public class UnixNumericUserPrincipal implements
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
......@@ -127,7 +127,7 @@ public class UnixNumericUserPrincipal implements
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("UnixNumericUserPrincipal: name",
("UnixNumericUserPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);
......
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -64,7 +64,7 @@ public class UnixPrincipal implements Principal, java.io.Serializable {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("invalid null input: value",
("invalid.null.input.value",
"sun.security.util.AuthResources"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
......@@ -94,7 +94,7 @@ public class UnixPrincipal implements Principal, java.io.Serializable {
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
(sun.security.util.ResourcesMgr.getString
("UnixPrincipal: name",
("UnixPrincipal.name",
"sun.security.util.AuthResources"));
Object[] source = {name};
return form.format(source);
......
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -87,7 +87,7 @@ public class X500Principal implements Principal, java.io.Serializable {
*/
public X500Principal(String name) {
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
throw new NullPointerException(rb.getString("provided.null.name"));
try {
thisX500Name = new X500Name(name);
......
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -190,7 +190,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
} catch (PropertyExpander.ExpandException peee) {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("Unable to properly expand config",
("Unable.to.properly.expand.config",
"sun.security.util.AuthResources"));
Object[] source = {extra_config};
throw new IOException(form.format(source));
......@@ -206,7 +206,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
} else {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("extra_config (No such file or directory)",
("extra.config.No.such.file.or.directory.",
"sun.security.util.AuthResources"));
Object[] source = {extra_config};
throw new IOException(form.format(source));
......@@ -243,7 +243,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
} catch (PropertyExpander.ExpandException peee) {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("Unable to properly expand config",
("Unable.to.properly.expand.config",
"sun.security.util.AuthResources"));
Object[] source = {config_url};
throw new IOException(form.format(source));
......@@ -286,7 +286,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
debugConfig.println(fnfe.toString());
}
throw new IOException(ResourcesMgr.getString
("Configuration Error:\n\tNo such file or directory",
("Configuration.Error.No.such.file.or.directory",
"sun.security.util.AuthResources"));
} finally {
if (isr != null) {
......@@ -426,7 +426,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tInvalid control flag, flag",
("Configuration.Error.Invalid.control.flag.flag",
"sun.security.util.AuthResources"));
Object[] source = {sflag};
throw new IOException(form.format(source));
......@@ -474,8 +474,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
// add this configuration entry
if (newConfig.containsKey(appName)) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\t" +
"Can not specify multiple entries for appName",
("Configuration.Error.Can.not.specify.multiple.entries.for.appName",
"sun.security.util.AuthResources"));
Object[] source = {appName};
throw new IOException(form.format(source));
......@@ -491,8 +490,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
case StreamTokenizer.TT_EOF:
MessageFormat form1 = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\texpected [expect], " +
"read [end of file]",
("Configuration.Error.expected.expect.read.end.of.file.",
"sun.security.util.AuthResources"));
Object[] source1 = {expect};
throw new IOException(form1.format(source1));
......@@ -508,8 +506,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: " +
"expected [expect], found [value]",
("Configuration.Error.Line.line.expected.expect.found.value.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
......@@ -522,7 +519,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: expected [expect]",
("Configuration.Error.Line.line.expected.expect.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
......@@ -535,7 +532,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: expected [expect]",
("Configuration.Error.Line.line.expected.expect.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
......@@ -548,7 +545,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: expected [expect]",
("Configuration.Error.Line.line.expected.expect.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
......@@ -561,7 +558,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
lookahead = nextToken();
} else {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: expected [expect]",
("Configuration.Error.Line.line.expected.expect.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
......@@ -570,8 +567,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
default:
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: " +
"expected [expect], found [value]",
("Configuration.Error.Line.line.expected.expect.found.value.",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), expect, st.sval};
throw new IOException(form.format(source));
......@@ -667,8 +663,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
if (s == null || s.length() == 0) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("Configuration Error:\n\tLine line: " +
"system property [value] expanded to empty value",
("Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
"sun.security.util.AuthResources"));
Object[] source = {new Integer(linenum), value};
throw new IOException(form.format(source));
......
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -686,9 +686,9 @@ public class JndiLoginModule implements LoginModule {
Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback(protocol + " "
+ rb.getString("username: "));
+ rb.getString("username."));
callbacks[1] = new PasswordCallback(protocol + " " +
rb.getString("password: "),
rb.getString("password."),
false);
try {
......
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -150,7 +150,7 @@ public class KeyStoreLoginModule implements LoginModule {
private static final TextOutputCallback bannerCallback =
new TextOutputCallback
(TextOutputCallback.INFORMATION,
rb.getString("Please enter keystore information"));
rb.getString("Please.enter.keystore.information"));
private final ConfirmationCallback confirmationCallback =
new ConfirmationCallback
(ConfirmationCallback.INFORMATION,
......@@ -364,10 +364,10 @@ public class KeyStoreLoginModule implements LoginModule {
NameCallback aliasCallback;
if (keyStoreAlias == null || keyStoreAlias.length() == 0) {
aliasCallback = new NameCallback(
rb.getString("Keystore alias: "));
rb.getString("Keystore.alias."));
} else {
aliasCallback =
new NameCallback(rb.getString("Keystore alias: "),
new NameCallback(rb.getString("Keystore.alias."),
keyStoreAlias);
}
......@@ -379,11 +379,11 @@ public class KeyStoreLoginModule implements LoginModule {
break;
case NORMAL:
keyPassCallback = new PasswordCallback
(rb.getString("Private key password (optional): "), false);
(rb.getString("Private.key.password.optional."), false);
// fall thru
case TOKEN:
storePassCallback = new PasswordCallback
(rb.getString("Keystore password: "), false);
(rb.getString("Keystore.password."), false);
break;
}
prompt(aliasCallback, storePassCallback, keyPassCallback);
......
......@@ -780,7 +780,7 @@ public class Krb5LoginModule implements LoginModule {
Callback[] callbacks = new Callback[1];
MessageFormat form = new MessageFormat(
rb.getString(
"Kerberos username [[defUsername]]: "));
"Kerberos.username.defUsername."));
Object[] source = {defUsername};
callbacks[0] = new NameCallback(form.format(source));
callbackHandler.handle(callbacks);
......@@ -835,7 +835,7 @@ public class Krb5LoginModule implements LoginModule {
String userName = krb5PrincName.toString();
MessageFormat form = new MessageFormat(
rb.getString(
"Kerberos password for [username]: "));
"Kerberos.password.for.username."));
Object[] source = {userName};
callbacks[0] = new PasswordCallback(
form.format(source),
......
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -969,8 +969,8 @@ public class LdapLoginModule implements LoginModule {
"to acquire authentication information from the user");
Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback(rb.getString("username: "));
callbacks[1] = new PasswordCallback(rb.getString("password: "), false);
callbacks[0] = new NameCallback(rb.getString("username."));
callbacks[1] = new PasswordCallback(rb.getString("password."), false);
try {
callbackHandler.handle(callbacks);
......
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -237,7 +237,7 @@ public abstract class Policy {
} catch (Exception e) {
throw new SecurityException
(sun.security.util.ResourcesMgr.getString
("unable to instantiate Subject-based policy"));
("unable.to.instantiate.Subject.based.policy"));
}
}
}
......
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -172,7 +172,7 @@ public final class PrivateCredentialPermission extends Permission {
if (!"read".equalsIgnoreCase(actions))
throw new IllegalArgumentException
(ResourcesMgr.getString("actions can only be 'read'"));
(ResourcesMgr.getString("actions.can.only.be.read."));
init(name);
}
......@@ -344,12 +344,11 @@ public final class PrivateCredentialPermission extends Permission {
if (tokenizer.hasMoreTokens() == false) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("permission name [name] syntax invalid: "));
("permission.name.name.syntax.invalid."));
Object[] source = {name};
throw new IllegalArgumentException
(form.format(source) + ResourcesMgr.getString
("Credential Class not followed by a " +
"Principal Class and Name"));
("Credential.Class.not.followed.by.a.Principal.Class.and.Name"));
}
while (tokenizer.hasMoreTokens()) {
......@@ -364,11 +363,11 @@ public final class PrivateCredentialPermission extends Permission {
if (tokenizer.hasMoreTokens() == false) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("permission name [name] syntax invalid: "));
("permission.name.name.syntax.invalid."));
Object[] source = {name};
throw new IllegalArgumentException
(form.format(source) + ResourcesMgr.getString
("Principal Class not followed by a Principal Name"));
("Principal.Class.not.followed.by.a.Principal.Name"));
}
// skip delimiter
......@@ -379,11 +378,11 @@ public final class PrivateCredentialPermission extends Permission {
if (!principalName.startsWith("\"")) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("permission name [name] syntax invalid: "));
("permission.name.name.syntax.invalid."));
Object[] source = {name};
throw new IllegalArgumentException
(form.format(source) + ResourcesMgr.getString
("Principal Name must be surrounded by quotes"));
("Principal.Name.must.be.surrounded.by.quotes"));
}
if (!principalName.endsWith("\"")) {
......@@ -401,11 +400,11 @@ public final class PrivateCredentialPermission extends Permission {
if (!principalName.endsWith("\"")) {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("permission name [name] syntax invalid: "));
("permission.name.name.syntax.invalid."));
Object[] source = {name};
throw new IllegalArgumentException
(form.format(source) + ResourcesMgr.getString
("Principal Name missing end quote"));
("Principal.Name.missing.end.quote"));
}
}
......@@ -418,9 +417,7 @@ public final class PrivateCredentialPermission extends Permission {
if (principalClass.equals("*") &&
!principalName.equals("*")) {
throw new IllegalArgumentException(ResourcesMgr.getString
("PrivateCredentialPermission Principal Class " +
"can not be a wildcard (*) value if Principal Name " +
"is not a wildcard (*) value"));
("PrivateCredentialPermission.Principal.Class.can.not.be.a.wildcard.value.if.Principal.Name.is.not.a.wildcard.value"));
}
if (testing)
......@@ -556,8 +553,7 @@ public final class PrivateCredentialPermission extends Permission {
public String toString() {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("CredOwner:\n\tPrincipal Class = class\n\t" +
"Principal Name = name"));
("CredOwner.Principal.Class.class.Principal.Name.name"));
Object[] source = {principalClass, principalName};
return (form.format(source));
}
......
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -204,7 +204,7 @@ public final class Subject implements java.io.Serializable {
pubCredentials == null ||
privCredentials == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null input(s)"));
(ResourcesMgr.getString("invalid.null.input.s."));
this.principals = Collections.synchronizedSet(new SecureSet<Principal>
(this, PRINCIPAL_SET, principals));
......@@ -289,7 +289,7 @@ public final class Subject implements java.io.Serializable {
if (acc == null) {
throw new NullPointerException(ResourcesMgr.getString
("invalid null AccessControlContext provided"));
("invalid.null.AccessControlContext.provided"));
}
// return the Subject from the DomainCombiner of the provided context
......@@ -346,7 +346,7 @@ public final class Subject implements java.io.Serializable {
}
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null action provided"));
(ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext
// for doPrivileged
......@@ -406,7 +406,7 @@ public final class Subject implements java.io.Serializable {
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null action provided"));
(ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext for doPrivileged
final AccessControlContext currentAcc = AccessController.getContext();
......@@ -460,7 +460,7 @@ public final class Subject implements java.io.Serializable {
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null action provided"));
(ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext
// for doPrivileged
......@@ -524,7 +524,7 @@ public final class Subject implements java.io.Serializable {
if (action == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null action provided"));
(ResourcesMgr.getString("invalid.null.action.provided"));
// set up the new Subject-based AccessControlContext for doPrivileged
final AccessControlContext callerAcc =
......@@ -603,7 +603,7 @@ public final class Subject implements java.io.Serializable {
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null Class provided"));
(ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
......@@ -697,7 +697,7 @@ public final class Subject implements java.io.Serializable {
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null Class provided"));
(ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
......@@ -742,7 +742,7 @@ public final class Subject implements java.io.Serializable {
if (c == null)
throw new NullPointerException
(ResourcesMgr.getString("invalid null Class provided"));
(ResourcesMgr.getString("invalid.null.Class.provided"));
// always return an empty Set instead of null
// so LoginModules can add to the Set if necessary
......@@ -832,15 +832,15 @@ public final class Subject implements java.io.Serializable {
*/
String toString(boolean includePrivateCredentials) {
String s = ResourcesMgr.getString("Subject:\n");
String s = ResourcesMgr.getString("Subject.");
String suffix = "";
synchronized(principals) {
Iterator<Principal> pI = principals.iterator();
while (pI.hasNext()) {
Principal p = pI.next();
suffix = suffix + ResourcesMgr.getString("\tPrincipal: ") +
p.toString() + ResourcesMgr.getString("\n");
suffix = suffix + ResourcesMgr.getString(".Principal.") +
p.toString() + ResourcesMgr.getString("NEWLINE");
}
}
......@@ -849,8 +849,8 @@ public final class Subject implements java.io.Serializable {
while (pI.hasNext()) {
Object o = pI.next();
suffix = suffix +
ResourcesMgr.getString("\tPublic Credential: ") +
o.toString() + ResourcesMgr.getString("\n");
ResourcesMgr.getString(".Public.Credential.") +
o.toString() + ResourcesMgr.getString("NEWLINE");
}
}
......@@ -861,12 +861,12 @@ public final class Subject implements java.io.Serializable {
try {
Object o = pI.next();
suffix += ResourcesMgr.getString
("\tPrivate Credential: ") +
(".Private.Credential.") +
o.toString() +
ResourcesMgr.getString("\n");
ResourcesMgr.getString("NEWLINE");
} catch (SecurityException se) {
suffix += ResourcesMgr.getString
("\tPrivate Credential inaccessible\n");
(".Private.Credential.inaccessible.");
break;
}
}
......@@ -1036,7 +1036,7 @@ public final class Subject implements java.io.Serializable {
if (subject.isReadOnly()) {
throw new IllegalStateException(ResourcesMgr.getString
("Subject is read-only"));
("Subject.is.read.only"));
}
java.lang.SecurityManager sm = System.getSecurityManager();
......@@ -1062,7 +1062,7 @@ public final class Subject implements java.io.Serializable {
if (subject.isReadOnly()) {
throw new IllegalStateException
(ResourcesMgr.getString("Subject is read-only"));
(ResourcesMgr.getString("Subject.is.read.only"));
}
java.lang.SecurityManager sm = System.getSecurityManager();
......@@ -1084,9 +1084,7 @@ public final class Subject implements java.io.Serializable {
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"));
("attempting.to.add.an.object.which.is.not.an.instance.of.java.security.Principal.to.a.Subject.s.Principal.Set"));
}
break;
default:
......@@ -1389,8 +1387,7 @@ public final class Subject implements java.io.Serializable {
if (!o.getClass().isAssignableFrom(c)) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("attempting to add an object which is not an " +
"instance of class"));
("attempting.to.add.an.object.which.is.not.an.instance.of.class"));
Object[] source = {c.toString()};
throw new SecurityException(form.format(source));
}
......
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -167,7 +167,7 @@ public class AppConfigurationEntry {
*/
public String toString() {
return (sun.security.util.ResourcesMgr.getString
("LoginModuleControlFlag: ") + controlFlag);
("LoginModuleControlFlag.") + controlFlag);
}
}
}
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -244,7 +244,7 @@ public class LoginContext {
if (name == null)
throw new LoginException
(ResourcesMgr.getString("Invalid null input: name"));
(ResourcesMgr.getString("Invalid.null.input.name"));
// get the Configuration
if (config == null) {
......@@ -268,7 +268,7 @@ public class LoginContext {
entries = config.getAppConfigurationEntry(OTHER);
if (entries == null) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("No LoginModules configured for name"));
("No.LoginModules.configured.for.name"));
Object[] source = {name};
throw new LoginException(form.format(source));
}
......@@ -382,7 +382,7 @@ public class LoginContext {
init(name);
if (subject == null)
throw new LoginException
(ResourcesMgr.getString("invalid null Subject provided"));
(ResourcesMgr.getString("invalid.null.Subject.provided"));
this.subject = subject;
subjectProvided = true;
loadDefaultCallbackHandler();
......@@ -418,7 +418,7 @@ public class LoginContext {
init(name);
if (callbackHandler == null)
throw new LoginException(ResourcesMgr.getString
("invalid null CallbackHandler provided"));
("invalid.null.CallbackHandler.provided"));
this.callbackHandler = new SecureCallbackHandler
(java.security.AccessController.getContext(),
callbackHandler);
......@@ -459,7 +459,7 @@ public class LoginContext {
this(name, subject);
if (callbackHandler == null)
throw new LoginException(ResourcesMgr.getString
("invalid null CallbackHandler provided"));
("invalid.null.CallbackHandler.provided"));
this.callbackHandler = new SecureCallbackHandler
(java.security.AccessController.getContext(),
callbackHandler);
......@@ -633,7 +633,7 @@ public class LoginContext {
public void logout() throws LoginException {
if (subject == null) {
throw new LoginException(ResourcesMgr.getString
("null subject - logout called before login"));
("null.subject.logout.called.before.login"));
}
if (configProvided) {
......@@ -811,21 +811,20 @@ public class LoginContext {
} catch (NoSuchMethodException nsme) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("unable to instantiate LoginModule, module, because " +
"it does not provide a no-argument constructor"));
("unable.to.instantiate.LoginModule.module.because.it.does.not.provide.a.no.argument.constructor"));
Object[] source = {moduleStack[i].entry.getLoginModuleName()};
throwException(null, new LoginException(form.format(source)));
} catch (InstantiationException ie) {
throwException(null, new LoginException(ResourcesMgr.getString
("unable to instantiate LoginModule: ") +
("unable.to.instantiate.LoginModule.") +
ie.getMessage()));
} catch (ClassNotFoundException cnfe) {
throwException(null, new LoginException(ResourcesMgr.getString
("unable to find LoginModule class: ") +
("unable.to.find.LoginModule.class.") +
cnfe.getMessage()));
} catch (IllegalAccessException iae) {
throwException(null, new LoginException(ResourcesMgr.getString
("unable to access LoginModule: ") +
("unable.to.access.LoginModule.") +
iae.getMessage()));
} catch (InvocationTargetException ite) {
......@@ -934,7 +933,7 @@ public class LoginContext {
} else if (success == false) {
// no module succeeded -- all modules were IGNORED
throwException(new LoginException
(ResourcesMgr.getString("Login Failure: all modules ignored")),
(ResourcesMgr.getString("Login.Failure.all.modules.ignored")),
null);
} else {
// success
......
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -155,12 +155,12 @@ public final class X500Principal implements Principal, java.io.Serializable {
if (name == null) {
throw new NullPointerException
(sun.security.util.ResourcesMgr.getString
("provided null name"));
("provided.null.name"));
}
if (keywordMap == null) {
throw new NullPointerException
(sun.security.util.ResourcesMgr.getString
("provided null keyword map"));
("provided.null.keyword.map"));
}
try {
......@@ -391,7 +391,7 @@ public final class X500Principal implements Principal, java.io.Serializable {
if (oidMap == null) {
throw new NullPointerException
(sun.security.util.ResourcesMgr.getString
("provided null OID map"));
("provided.null.OID.map"));
}
if (format != null) {
if (format.equalsIgnoreCase(RFC1779)) {
......
......@@ -1123,7 +1123,7 @@ public final class SunPKCS11 extends AuthProvider {
java.text.MessageFormat form = new java.text.MessageFormat
(ResourcesMgr.getString
("PKCS11 Token [providerName] Password: "));
("PKCS11.Token.providerName.Password."));
Object[] source = { getName() };
PasswordCallback pcall = new PasswordCallback(form.format(source),
......
/*
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -653,7 +653,7 @@ public class PolicyFile extends java.security.Policy {
}
} catch (PolicyParser.ParsingException pe) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
(POLICY + ": error parsing policy:\n\tmessage"));
(POLICY + ".error.parsing.policy.message"));
Object[] source = {policy, pe.getLocalizedMessage()};
System.err.println(form.format(source));
if (debug != null)
......@@ -895,7 +895,7 @@ public class PolicyFile extends java.security.Policy {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
(POLICY +
": error adding Permission, perm:\n\tmessage"));
".error.adding.Permission.perm.message"));
Object[] source = {pe.permission,
ite.getTargetException().toString()};
System.err.println(form.format(source));
......@@ -903,7 +903,7 @@ public class PolicyFile extends java.security.Policy {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
(POLICY +
": error adding Permission, perm:\n\tmessage"));
".error.adding.Permission.perm.message"));
Object[] source = {pe.permission,
e.toString()};
System.err.println(form.format(source));
......@@ -915,7 +915,7 @@ public class PolicyFile extends java.security.Policy {
} catch (Exception e) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
(POLICY
+ ": error adding Entry:\n\tmessage"));
+ ".error.adding.Entry.message"));
Object[] source = {e.toString()};
System.err.println(form.format(source));
}
......@@ -1950,7 +1950,7 @@ public class PolicyFile extends java.security.Policy {
if (colonIndex == -1) {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("alias name not provided (pe.name)"));
("alias.name.not.provided.pe.name."));
Object[] source = {pe.name};
throw new Exception(form.format(source));
}
......@@ -1958,7 +1958,7 @@ public class PolicyFile extends java.security.Policy {
if ((suffix = getDN(suffix, keystore)) == null) {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("unable to perform substitution on alias, suffix"));
("unable.to.perform.substitution.on.alias.suffix"));
Object[] source = {value.substring(colonIndex+1)};
throw new Exception(form.format(source));
}
......@@ -1968,7 +1968,7 @@ public class PolicyFile extends java.security.Policy {
} else {
MessageFormat form = new MessageFormat
(ResourcesMgr.getString
("substitution value, prefix, unsupported"));
("substitution.value.prefix.unsupported"));
Object[] source = {prefix};
throw new Exception(form.format(source));
}
......@@ -2127,18 +2127,18 @@ public class PolicyFile extends java.security.Policy {
@Override public String toString(){
StringBuilder sb = new StringBuilder();
sb.append(ResourcesMgr.getString("("));
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(" "));
sb.append(ResourcesMgr.getString(" "));
sb.append(ResourcesMgr.getString("SPACE"));
sb.append(ResourcesMgr.getString("SPACE"));
sb.append(p);
sb.append(ResourcesMgr.getString("\n"));
sb.append(ResourcesMgr.getString("NEWLINE"));
}
sb.append(ResourcesMgr.getString(")"));
sb.append(ResourcesMgr.getString("\n"));
sb.append(ResourcesMgr.getString("RPARAM"));
sb.append(ResourcesMgr.getString("NEWLINE"));
return sb.toString();
}
}
......@@ -2195,7 +2195,7 @@ public class PolicyFile extends java.security.Policy {
super(type);
if (type == null) {
throw new NullPointerException
(ResourcesMgr.getString("type can't be null"));
(ResourcesMgr.getString("type.can.t.be.null"));
}
this.type = type;
this.name = name;
......
/*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -219,8 +219,7 @@ public class PolicyParser {
if (keyStoreUrlString == null && storePassURL != null) {
throw new ParsingException(ResourcesMgr.getString
("keystorePasswordURL can not be specified without also " +
"specifying keystore"));
("keystorePasswordURL.can.not.be.specified.without.also.specifying.keystore"));
}
}
......@@ -357,7 +356,7 @@ public class PolicyParser {
keyStoreType = match("quoted string");
} else {
throw new ParsingException(st.lineno(),
ResourcesMgr.getString("expected keystore type"));
ResourcesMgr.getString("expected.keystore.type"));
}
// parse keystore provider
......@@ -370,7 +369,7 @@ public class PolicyParser {
keyStoreProvider = match("quoted string");
} else {
throw new ParsingException(st.lineno(),
ResourcesMgr.getString("expected keystore provider"));
ResourcesMgr.getString("expected.keystore.provider"));
}
}
......@@ -421,7 +420,7 @@ public class PolicyParser {
throw new ParsingException(
st.lineno(),
ResourcesMgr.getString
("multiple Codebase expressions"));
("multiple.Codebase.expressions"));
e.codeBase = match("quoted string");
peekAndMatch(",");
} else if (peekAndMatch("SignedBy")) {
......@@ -429,7 +428,7 @@ public class PolicyParser {
throw new ParsingException(
st.lineno(),
ResourcesMgr.getString(
"multiple SignedBy expressions"));
"multiple.SignedBy.expressions"));
e.signedBy = match("quoted string");
// verify syntax of the aliases
......@@ -448,7 +447,7 @@ public class PolicyParser {
throw new ParsingException(
st.lineno(),
ResourcesMgr.getString(
"SignedBy has empty alias"));
"SignedBy.has.empty.alias"));
peekAndMatch(",");
} else if (peekAndMatch("Principal")) {
......@@ -491,8 +490,7 @@ public class PolicyParser {
throw new ParsingException
(st.lineno(),
ResourcesMgr.getString
("can not specify Principal with a " +
"wildcard class without a wildcard name"));
("can.not.specify.Principal.with.a.wildcard.class.without.a.wildcard.name"));
}
}
......@@ -529,8 +527,7 @@ public class PolicyParser {
} else {
throw new ParsingException(st.lineno(),
ResourcesMgr.getString(
"expected codeBase or SignedBy or " +
"Principal"));
"expected.codeBase.or.SignedBy.or.Principal"));
}
}
......@@ -554,7 +551,7 @@ public class PolicyParser {
throw new
ParsingException(st.lineno(),
ResourcesMgr.getString(
"expected permission entry"));
"expected.permission.entry"));
}
}
match("}");
......@@ -727,12 +724,12 @@ public class PolicyParser {
switch (lookahead) {
case StreamTokenizer.TT_NUMBER:
throw new ParsingException(st.lineno(), expect,
ResourcesMgr.getString("number ") +
ResourcesMgr.getString("number.") +
String.valueOf(st.nval));
case StreamTokenizer.TT_EOF:
MessageFormat form = new MessageFormat(
ResourcesMgr.getString
("expected [expect], read [end of file]"));
("expected.expect.read.end.of.file."));
Object[] source = {expect};
throw new ParsingException(form.format(source));
case StreamTokenizer.TT_WORD:
......@@ -809,11 +806,11 @@ public class PolicyParser {
switch (lookahead) {
case StreamTokenizer.TT_NUMBER:
throw new ParsingException(st.lineno(), ";",
ResourcesMgr.getString("number ") +
ResourcesMgr.getString("number.") +
String.valueOf(st.nval));
case StreamTokenizer.TT_EOF:
throw new ParsingException(ResourcesMgr.getString
("expected [;], read [end of file]"));
("expected.read.end.of.file."));
default:
lookahead = st.nextToken();
}
......@@ -973,7 +970,7 @@ public class PolicyParser {
public PrincipalEntry(String principalClass, String principalName) {
if (principalClass == null || principalName == null)
throw new NullPointerException(ResourcesMgr.getString(
"null principalClass or principalName"));
"null.principalClass.or.principalName"));
this.principalClass = principalClass;
this.principalName = principalName;
}
......@@ -1199,7 +1196,7 @@ public class PolicyParser {
public ParsingException(int line, String msg) {
super("line " + line + ": " + msg);
MessageFormat form = new MessageFormat
(ResourcesMgr.getString("line number: msg"));
(ResourcesMgr.getString("line.number.msg"));
Object[] source = {new Integer(line), msg};
i18nMessage = form.format(source);
}
......@@ -1208,7 +1205,7 @@ public class PolicyParser {
super("line " + line + ": expected [" + expect +
"], found [" + actual + "]");
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("line number: expected [expect], found [actual]"));
("line.number.expected.expect.found.actual."));
Object[] source = {new Integer(line), expect, actual};
i18nMessage = form.format(source);
}
......
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -40,103 +40,103 @@ public class AuthResources extends java.util.ListResourceBundle {
private static final Object[][] contents = {
// NT principals
{"invalid null input: value", "invalid null input: {0}"},
{"NTDomainPrincipal: name", "NTDomainPrincipal: {0}"},
{"NTNumericCredential: name", "NTNumericCredential: {0}"},
{"Invalid NTSid value", "Invalid NTSid value"},
{"NTSid: name", "NTSid: {0}"},
{"NTSidDomainPrincipal: name", "NTSidDomainPrincipal: {0}"},
{"NTSidGroupPrincipal: name", "NTSidGroupPrincipal: {0}"},
{"NTSidPrimaryGroupPrincipal: name", "NTSidPrimaryGroupPrincipal: {0}"},
{"NTSidUserPrincipal: name", "NTSidUserPrincipal: {0}"},
{"NTUserPrincipal: name", "NTUserPrincipal: {0}"},
{"invalid.null.input.value", "invalid null input: {0}"},
{"NTDomainPrincipal.name", "NTDomainPrincipal: {0}"},
{"NTNumericCredential.name", "NTNumericCredential: {0}"},
{"Invalid.NTSid.value", "Invalid NTSid value"},
{"NTSid.name", "NTSid: {0}"},
{"NTSidDomainPrincipal.name", "NTSidDomainPrincipal: {0}"},
{"NTSidGroupPrincipal.name", "NTSidGroupPrincipal: {0}"},
{"NTSidPrimaryGroupPrincipal.name", "NTSidPrimaryGroupPrincipal: {0}"},
{"NTSidUserPrincipal.name", "NTSidUserPrincipal: {0}"},
{"NTUserPrincipal.name", "NTUserPrincipal: {0}"},
// UnixPrincipals
{"UnixNumericGroupPrincipal [Primary Group]: name",
{"UnixNumericGroupPrincipal.Primary.Group.name",
"UnixNumericGroupPrincipal [Primary Group]: {0}"},
{"UnixNumericGroupPrincipal [Supplementary Group]: name",
{"UnixNumericGroupPrincipal.Supplementary.Group.name",
"UnixNumericGroupPrincipal [Supplementary Group]: {0}"},
{"UnixNumericUserPrincipal: name", "UnixNumericUserPrincipal: {0}"},
{"UnixPrincipal: name", "UnixPrincipal: {0}"},
{"UnixNumericUserPrincipal.name", "UnixNumericUserPrincipal: {0}"},
{"UnixPrincipal.name", "UnixPrincipal: {0}"},
// com.sun.security.auth.login.ConfigFile
{"Unable to properly expand config", "Unable to properly expand {0}"},
{"extra_config (No such file or directory)",
{"Unable.to.properly.expand.config", "Unable to properly expand {0}"},
{"extra.config.No.such.file.or.directory.",
"{0} (No such file or directory)"},
{"Configuration Error:\n\tNo such file or directory",
{"Configuration.Error.No.such.file.or.directory",
"Configuration Error:\n\tNo such file or directory"},
{"Configuration Error:\n\tInvalid control flag, flag",
{"Configuration.Error.Invalid.control.flag.flag",
"Configuration Error:\n\tInvalid control flag, {0}"},
{"Configuration Error:\n\tCan not specify multiple entries for appName",
{"Configuration.Error.Can.not.specify.multiple.entries.for.appName",
"Configuration Error:\n\tCan not specify multiple entries for {0}"},
{"Configuration Error:\n\texpected [expect], read [end of file]",
{"Configuration.Error.expected.expect.read.end.of.file.",
"Configuration Error:\n\texpected [{0}], read [end of file]"},
{"Configuration Error:\n\tLine line: expected [expect], found [value]",
{"Configuration.Error.Line.line.expected.expect.found.value.",
"Configuration Error:\n\tLine {0}: expected [{1}], found [{2}]"},
{"Configuration Error:\n\tLine line: expected [expect]",
{"Configuration.Error.Line.line.expected.expect.",
"Configuration Error:\n\tLine {0}: expected [{1}]"},
{"Configuration Error:\n\tLine line: system property [value] expanded to empty value",
{"Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
"Configuration Error:\n\tLine {0}: system property [{1}] expanded to empty value"},
// com.sun.security.auth.module.JndiLoginModule
{"username: ","username: "},
{"password: ","password: "},
{"username.","username: "},
{"password.","password: "},
// com.sun.security.auth.module.KeyStoreLoginModule
{"Please enter keystore information",
{"Please.enter.keystore.information",
"Please enter keystore information"},
{"Keystore alias: ","Keystore alias: "},
{"Keystore password: ","Keystore password: "},
{"Private key password (optional): ",
{"Keystore.alias.","Keystore alias: "},
{"Keystore.password.","Keystore password: "},
{"Private.key.password.optional.",
"Private key password (optional): "},
// com.sun.security.auth.module.Krb5LoginModule
{"Kerberos username [[defUsername]]: ",
{"Kerberos.username.defUsername.",
"Kerberos username [{0}]: "},
{"Kerberos password for [username]: ",
{"Kerberos.password.for.username.",
"Kerberos password for {0}: "},
/*** EVERYTHING BELOW IS DEPRECATED ***/
// com.sun.security.auth.PolicyFile
{": error parsing ", ": error parsing "},
{": ", ": "},
{": error adding Permission ", ": error adding Permission "},
{" ", " "},
{": error adding Entry ", ": error adding Entry "},
{"(", "("},
{")", ")"},
{"attempt to add a Permission to a readonly PermissionCollection",
{".error.parsing.", ": error parsing "},
{"COLON", ": "},
{".error.adding.Permission.", ": error adding Permission "},
{"SPACE", " "},
{".error.adding.Entry.", ": error adding Entry "},
{"LPARAM", "("},
{"RPARAM", ")"},
{"attempt.to.add.a.Permission.to.a.readonly.PermissionCollection",
"attempt to add a Permission to a readonly PermissionCollection"},
// com.sun.security.auth.PolicyParser
{"expected keystore type", "expected keystore type"},
{"can not specify Principal with a ",
{"expected.keystore.type", "expected keystore type"},
{"can.not.specify.Principal.with.a.",
"can not specify Principal with a "},
{"wildcard class without a wildcard name",
{"wildcard.class.without.a.wildcard.name",
"wildcard class without a wildcard name"},
{"expected codeBase or SignedBy", "expected codeBase or SignedBy"},
{"only Principal-based grant entries permitted",
{"expected.codeBase.or.SignedBy", "expected codeBase or SignedBy"},
{"only.Principal.based.grant.entries.permitted",
"only Principal-based grant entries permitted"},
{"expected permission entry", "expected permission entry"},
{"number ", "number "},
{"expected ", "expected "},
{", read end of file", ", read end of file"},
{"expected ';', read end of file", "expected ';', read end of file"},
{"line ", "line "},
{": expected '", ": expected '"},
{"', found '", "', found '"},
{"'", "'"},
{"expected.permission.entry", "expected permission entry"},
{"number.", "number "},
{"expected.", "expected "},
{".read.end.of.file", ", read end of file"},
{"expected.read.end.of.file", "expected ';', read end of file"},
{"line.", "line "},
{".expected.", ": expected '"},
{".found.", "', found '"},
{"QUOTE", "'"},
// SolarisPrincipals
{"SolarisNumericGroupPrincipal [Primary Group]: ",
{"SolarisNumericGroupPrincipal.Primary.Group.",
"SolarisNumericGroupPrincipal [Primary Group]: "},
{"SolarisNumericGroupPrincipal [Supplementary Group]: ",
{"SolarisNumericGroupPrincipal.Supplementary.Group.",
"SolarisNumericGroupPrincipal [Supplementary Group]: "},
{"SolarisNumericUserPrincipal: ",
{"SolarisNumericUserPrincipal.",
"SolarisNumericUserPrincipal: "},
{"SolarisPrincipal: ", "SolarisPrincipal: "},
{"provided null name", "provided null name"}
{"SolarisPrincipal.", "SolarisPrincipal: "},
{"provided.null.name", "provided null name"}
};
......
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6987827
* @summary security/util/Resources.java needs improvement
*/
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
/**
* This test makes sure that the keys in resources files are using the new
* format and there is no duplication.
*/
public class NewNamesFormat {
public static void main(String[] args) throws Exception {
checkRes("sun.security.util.Resources");
checkRes("sun.security.util.AuthResources");
checkRes("sun.security.tools.JarSignerResources");
}
private static void checkRes(String resName) throws Exception {
System.out.println("Checking " + resName + "...");
Class clazz = Class.forName(resName);
Method m = clazz.getMethod("getContents");
Object[][] contents = (Object[][])m.invoke(clazz.newInstance());
Set<String> keys = new HashSet<String>();
for (Object[] pair: contents) {
String key = (String)pair[0];
if (keys.contains(key)) {
System.out.println("Found dup: " + key);
throw new Exception();
}
checkKey(key);
keys.add(key);
}
}
private static void checkKey(String key) throws Exception {
for (char c: key.toCharArray()) {
if (Character.isLetter(c) || Character.isDigit(c) ||
c == '{' || c == '}' || c == '.') {
// OK
} else {
System.out.println("Illegal char [" + c + "] in key: " + key);
throw new Exception();
}
}
}
}
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册