8044461: Cleanup new Boolean and single character strings

Reviewed-by: rriggs, alanb, lancea
This commit is contained in:
Otavio Goncalves de Santana 2014-05-30 15:46:12 -04:00 committed by Roger Riggs
parent 490b1acb50
commit 8f0e6e3060
64 changed files with 104 additions and 104 deletions

View File

@ -512,7 +512,7 @@ class ConstantPool {
}
static String qualifiedStringValue(String s1, String s234) {
// Qualification by dot must decompose uniquely. Second string might already be qualified.
assert(s1.indexOf(".") < 0);
assert(s1.indexOf('.') < 0);
return s1+"."+s234;
}

View File

@ -102,7 +102,7 @@ public final class CorbanameUrl {
}
location = url.substring(addrStart, addrEnd);
int keyStart = location.indexOf("/");
int keyStart = location.indexOf('/');
if (keyStart >= 0) {
// Has key string
if (keyStart == (location.length() -1)) {

View File

@ -336,7 +336,7 @@ public class RegistryContext implements Context, Referenceable {
String url = "rmi://";
// Enclose IPv6 literal address in '[' and ']'
url = (host.indexOf(":") > -1) ? url + "[" + host + "]" :
url = (host.indexOf(':') > -1) ? url + "[" + host + "]" :
url + host;
if (port > 0) {
url += ":" + Integer.toString(port);

View File

@ -149,7 +149,7 @@ abstract public class GenericURLContext implements Context {
* foo:rest/of/name foo:
*/
protected String getURLPrefix(String url) throws NamingException {
int start = url.indexOf(":");
int start = url.indexOf(':');
if (start < 0) {
throw new OperationNotSupportedException("Invalid URL: " + url);
@ -160,7 +160,7 @@ abstract public class GenericURLContext implements Context {
start += 2; // skip double slash
// find last slash
int posn = url.indexOf("/", start);
int posn = url.indexOf('/', start);
if (posn >= 0) {
start = posn;
} else {

View File

@ -303,7 +303,7 @@ public final class ExecOptionPermission extends Permission
offset = pname.length() - 1;
while ((last = pname.lastIndexOf(".", offset)) != -1) {
while ((last = pname.lastIndexOf('.', offset)) != -1) {
pname = pname.substring(0, last+1) + "*";
x = permissions.get(pname);
@ -318,7 +318,7 @@ public final class ExecOptionPermission extends Permission
pname = p.getName();
offset = pname.length() - 1;
while ((last = pname.lastIndexOf("=", offset)) != -1) {
while ((last = pname.lastIndexOf('=', offset)) != -1) {
pname = pname.substring(0, last+1) + "*";
x = permissions.get(pname);

View File

@ -6831,7 +6831,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
// table name else isolate table name.
indexFrom = command.toLowerCase().indexOf("from");
indexComma = command.indexOf(",", indexFrom);
indexComma = command.indexOf(',', indexFrom);
if(indexComma == -1) {
// implies only one table

View File

@ -910,7 +910,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
// now remove the last ","
strWhereClause = strWhereClause.substring
(0, strWhereClause.lastIndexOf(","));
(0, strWhereClause.lastIndexOf(','));
// Add from clause
strWhereClause = strWhereClause.concat(" from ");
@ -920,7 +920,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
//Remove the last ","
strWhereClause = strWhereClause.substring
(0, strWhereClause.lastIndexOf(","));
(0, strWhereClause.lastIndexOf(','));
// Add the where clause
strWhereClause = strWhereClause.concat(" where ");

View File

@ -240,7 +240,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
// Remove the string after "@xxxx"
// before writing it to the xml file.
String strProviderInstance = (caller.getSyncProvider()).toString();
String strProvider = strProviderInstance.substring(0, (caller.getSyncProvider()).toString().indexOf("@"));
String strProvider = strProviderInstance.substring(0, (caller.getSyncProvider()).toString().indexOf('@'));
propString("sync-provider-name", strProvider);
propString("sync-provider-vendor", "Oracle Corporation");

View File

@ -1147,7 +1147,7 @@ public class XmlReaderContentHandler extends DefaultHandler {
if (nullValue) {
rs.setSyncProvider(null);
} else {
String str = s.substring(0,s.indexOf("@")+1);
String str = s.substring(0,s.indexOf('@')+1);
rs.setSyncProvider(str);
}
break;

View File

@ -39,7 +39,7 @@ import org.xml.sax.InputSource;
public class XmlResolver implements EntityResolver {
public InputSource resolveEntity(String publicId, String systemId) {
String schemaName = systemId.substring(systemId.lastIndexOf("/"));
String schemaName = systemId.substring(systemId.lastIndexOf('/'));
if(systemId.startsWith("http://java.sun.com/xml/ns/jdbc")) {
return new InputSource(this.getClass().getResourceAsStream(schemaName));

View File

@ -694,7 +694,7 @@ public class JndiLoginModule implements LoginModule {
throw new LoginException("Error: no CallbackHandler available " +
"to garner authentication information from the user");
String protocol = userProvider.substring(0, userProvider.indexOf(":"));
String protocol = userProvider.substring(0, userProvider.indexOf(':'));
Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback(protocol + " "

View File

@ -400,7 +400,7 @@ public class LdapLoginModule implements LoginModule {
// Add any JNDI properties to the environment
for (String key : options.keySet()) {
if (key.indexOf(".") > -1) {
if (key.indexOf('.') > -1) {
ldapEnvironment.put(key, options.get(key));
}
}

View File

@ -857,7 +857,7 @@ public class CommandInterpreter {
bpSpec = runtime.createClassLineBreakpoint(classId, lineNumber);
} else {
// Try stripping method from class.method token.
int idot = token.lastIndexOf(".");
int idot = token.lastIndexOf('.');
if ( (idot <= 0) || /* No dot or dot in first char */
(idot >= token.length() - 1) ) { /* dot in last char */
return null;

View File

@ -1079,7 +1079,7 @@ class Commands {
}
} else {
// Try stripping method from class.method token.
int idot = token.lastIndexOf(".");
int idot = token.lastIndexOf('.');
if ( (idot <= 0) || /* No dot or dot in first char */
(idot >= token.length() - 1) ) { /* dot in last char */
printBreakpointCommandUsage(atForm, inForm);

View File

@ -67,7 +67,7 @@ class AllClassesQuery extends QueryHandler {
continue;
}
String name = clazz.getName();
int pos = name.lastIndexOf(".");
int pos = name.lastIndexOf('.');
String pkg;
if (name.startsWith("[")) { // Only in ancient heap dumps
pkg = "<Arrays>";

View File

@ -1296,7 +1296,7 @@ public final class Class<T> implements java.io.Serializable,
String simpleName = getSimpleBinaryName();
if (simpleName == null) { // top level class
simpleName = getName();
return simpleName.substring(simpleName.lastIndexOf(".")+1); // strip the package name
return simpleName.substring(simpleName.lastIndexOf('.')+1); // strip the package name
}
// According to JLS3 "Binary Compatibility" (13.1) the binary
// name of non-package classes (not top level) is the binary

View File

@ -2133,7 +2133,7 @@ public abstract class ClassLoader {
return result.booleanValue();
// Check for most specific package entry
int dotIndex = className.lastIndexOf(".");
int dotIndex = className.lastIndexOf('.');
if (dotIndex < 0) { // default package
result = packageAssertionStatus.get(null);
if (result != null)
@ -2144,7 +2144,7 @@ public abstract class ClassLoader {
result = packageAssertionStatus.get(className);
if (result != null)
return result.booleanValue();
dotIndex = className.lastIndexOf(".", dotIndex-1);
dotIndex = className.lastIndexOf('.', dotIndex-1);
}
// Return the classloader default

View File

@ -85,7 +85,7 @@ class InvokerBytecodeGenerator {
private InvokerBytecodeGenerator(LambdaForm lambdaForm, int localsMapSize,
String className, String invokerName, MethodType invokerType) {
if (invokerName.contains(".")) {
int p = invokerName.indexOf(".");
int p = invokerName.indexOf('.');
className = invokerName.substring(0, p);
invokerName = invokerName.substring(p+1);
}

View File

@ -294,7 +294,7 @@ public class CookieManager extends CookieHandler
// the path is the directory of the page/doc
String path = uri.getPath();
if (!path.endsWith("/")) {
int i = path.lastIndexOf("/");
int i = path.lastIndexOf('/');
if (i > 0) {
path = path.substring(0, i + 1);
} else {
@ -364,7 +364,7 @@ public class CookieManager extends CookieHandler
static private boolean isInPortList(String lst, int port) {
int i = lst.indexOf(",");
int i = lst.indexOf(',');
int val = -1;
while (i > 0) {
try {
@ -375,7 +375,7 @@ public class CookieManager extends CookieHandler
} catch (NumberFormatException numberFormatException) {
}
lst = lst.substring(i+1);
i = lst.indexOf(",");
i = lst.indexOf(',');
}
if (!lst.isEmpty()) {
try {

View File

@ -1138,7 +1138,7 @@ class InetAddress implements java.io.Serializable {
// This is supposed to be an IPv6 literal
// Check if a numeric or string zone id is present
int pos;
if ((pos=host.indexOf ("%")) != -1) {
if ((pos=host.indexOf ('%')) != -1) {
numericZone = checkNumericZone (host);
if (numericZone == -1) { /* remainder of string must be an ifname */
ifname = host.substring (pos+1);

View File

@ -1017,7 +1017,7 @@ class Socket implements java.io.Closeable {
if (isClosed())
throw new SocketException("Socket is closed");
if (!on) {
getImpl().setOption(SocketOptions.SO_LINGER, new Boolean(on));
getImpl().setOption(SocketOptions.SO_LINGER, on);
} else {
if (linger < 0) {
throw new IllegalArgumentException("invalid value for SO_LINGER");

View File

@ -777,7 +777,7 @@ public final class SocketPermission extends Permission
// Literal IPv6 address
host = getName().substring(1, getName().indexOf(']'));
} else {
int i = getName().indexOf(":");
int i = getName().indexOf(':');
if (i == -1)
host = getName();
else {

View File

@ -368,7 +368,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
String host = epoint.getHostString();
// IPv6 litteral?
if (epoint.getAddress() instanceof Inet6Address &&
(!host.startsWith("[")) && (host.indexOf(":") >= 0)) {
(!host.startsWith("[")) && (host.indexOf(':') >= 0)) {
host = "[" + host + "]";
}
try {
@ -688,7 +688,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
String host = saddr.getHostString();
// IPv6 litteral?
if (saddr.getAddress() instanceof Inet6Address &&
(!host.startsWith("[")) && (host.indexOf(":") >= 0)) {
(!host.startsWith("[")) && (host.indexOf(':') >= 0)) {
host = "[" + host + "]";
}
try {

View File

@ -1851,9 +1851,9 @@ public final class URI
sb.append("//");
if (authority.startsWith("[")) {
// authority should (but may not) contain an embedded IPv6 address
int end = authority.indexOf("]");
int end = authority.indexOf(']');
String doquote = authority, dontquote = "";
if (end != -1 && authority.indexOf(":") != -1) {
if (end != -1 && authority.indexOf(':') != -1) {
// the authority contains an IPv6 address
if (end == authority.length()) {
dontquote = authority;
@ -1889,8 +1889,8 @@ public final class URI
* because we must not quote a literal IPv6 address
*/
if (opaquePart.startsWith("//[")) {
int end = opaquePart.indexOf("]");
if (end != -1 && opaquePart.indexOf(":")!=-1) {
int end = opaquePart.indexOf(']');
if (end != -1 && opaquePart.indexOf(':')!=-1) {
String doquote, dontquote;
if (end == opaquePart.length()) {
dontquote = opaquePart;

View File

@ -430,7 +430,7 @@ final class BasicPermissionCollection
offset = path.length()-1;
while ((last = path.lastIndexOf(".", offset)) != -1) {
while ((last = path.lastIndexOf('.', offset)) != -1) {
path = path.substring(0, last+1) + "*";
//System.out.println("check "+path);

View File

@ -931,7 +931,7 @@ public abstract class Provider extends Properties {
}
private String[] getTypeAndAlgorithm(String key) {
int i = key.indexOf(".");
int i = key.indexOf('.');
if (i < 1) {
if (debug != null) {
debug.println("Ignoring invalid entry in provider "

View File

@ -1114,7 +1114,7 @@ public final class Security {
// implementation of an algorithm. We are only interested
// in entries which lead to the implementation
// classes.
if (currentKey.indexOf(" ") < 0) {
if (currentKey.indexOf(' ') < 0) {
result.add(currentKey.substring(
serviceName.length() + 1));
}

View File

@ -546,7 +546,7 @@ final class PropertyPermissionCollection extends PermissionCollection
offset = name.length()-1;
while ((last = name.lastIndexOf(".", offset)) != -1) {
while ((last = name.lastIndexOf('.', offset)) != -1) {
name = name.substring(0, last+1) + "*";
//System.out.println("check "+name);

View File

@ -276,7 +276,7 @@ class JarVerifier {
// now we are parsing a signature block file
String key = uname.substring(0, uname.lastIndexOf("."));
String key = uname.substring(0, uname.lastIndexOf('.'));
if (signerCache == null)
signerCache = new ArrayList<>();

View File

@ -779,7 +779,7 @@ public class LogManager {
int ix = 1;
for (;;) {
int ix2 = name.indexOf(".", ix);
int ix2 = name.indexOf('.', ix);
if (ix2 < 0) {
break;
}
@ -802,7 +802,7 @@ public class LogManager {
}
LogNode node = root;
while (name.length() > 0) {
int ix = name.indexOf(".");
int ix = name.indexOf('.');
String head;
if (ix > 0) {
head = name.substring(0, ix);

View File

@ -174,7 +174,7 @@ public class XMLFormatter extends Formatter {
// Check to see if the parameter was not a messagetext format
// or was not null or empty
if (parameters != null && parameters.length != 0
&& record.getMessage().indexOf("{") == -1 ) {
&& record.getMessage().indexOf('{') == -1 ) {
for (Object parameter : parameters) {
sb.append(" <param>");
try {

View File

@ -290,7 +290,7 @@ public class MBeanPermission extends Permission {
// Parse ObjectName
int openingBracket = name.indexOf("[");
int openingBracket = name.indexOf('[');
if (openingBracket == -1) {
// If "[on]" missing then ObjectName("*:*")
//
@ -329,7 +329,7 @@ public class MBeanPermission extends Permission {
// Parse member
int poundSign = name.indexOf("#");
int poundSign = name.indexOf('#');
if (poundSign == -1)
setMember("*");

View File

@ -329,7 +329,7 @@ public class DescriptorSupport
inFld = false;
} else if (inFld && inDesc) {
// want kw=value, eg, name="myname" value="myvalue"
int eq_separator = tok.indexOf("=");
int eq_separator = tok.indexOf('=');
if (eq_separator > 0) {
String kwPart = tok.substring(0,eq_separator);
String valPart = tok.substring(eq_separator+1);
@ -458,7 +458,7 @@ public class DescriptorSupport
if ((fields[i] == null) || (fields[i].equals(""))) {
continue;
}
int eq_separator = fields[i].indexOf("=");
int eq_separator = fields[i].indexOf('=');
if (eq_separator < 0) {
// illegal if no = or is first character
if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {

View File

@ -934,7 +934,7 @@ public class RequiredModelMBean
String opMethodName;
// Parse for class name and method
int opSplitter = opName.lastIndexOf(".");
int opSplitter = opName.lastIndexOf('.');
if (opSplitter > 0) {
opClassName = opName.substring(0,opSplitter);
opMethodName = opName.substring(opSplitter+1);
@ -943,7 +943,7 @@ public class RequiredModelMBean
/* Ignore anything after a left paren. We keep this for
compatibility but it isn't specified. */
opSplitter = opMethodName.indexOf("(");
opSplitter = opMethodName.indexOf('(');
if (opSplitter > 0)
opMethodName = opMethodName.substring(0,opSplitter);

View File

@ -495,7 +495,7 @@ public final class PrivateCredentialPermission extends Permission {
// perform new initialization from the permission name
if (getName().indexOf(" ") == -1 && getName().indexOf("\"") == -1) {
if (getName().indexOf(' ') == -1 && getName().indexOf('"') == -1) {
// name only has a credential class specified
credentialClass = getName();

View File

@ -600,7 +600,7 @@ public class Sasl {
// implementation of an algorithm. We are only interested
// in entries which lead to the implementation
// classes.
if (currentKey.indexOf(" ") < 0) {
if (currentKey.indexOf(' ') < 0) {
String className = providers[i].getProperty(currentKey);
if (!classes.contains(className)) {
classes.add(className);

View File

@ -84,7 +84,7 @@ public abstract class AbstractMonitor implements Monitor {
* {@inheritDoc}
*/
public String getBaseName() {
int baseIndex = name.lastIndexOf(".")+1;
int baseIndex = name.lastIndexOf('.') + 1;
return name.substring(baseIndex);
}

View File

@ -138,8 +138,8 @@ public class HostIdentifier {
String frag = u.getFragment();
URI u2 = null;
int c1index = uriString.indexOf(":");
int c2index = uriString.lastIndexOf(":");
int c1index = uriString.indexOf(':');
int c2index = uriString.lastIndexOf(':');
if (c2index != c1index) {
/*
* this is the scheme:hostname:port case. Attempt to

View File

@ -68,7 +68,7 @@ public class StackTraceElementCompositeData extends LazyCompositeData {
ste.getMethodName(),
ste.getFileName(),
new Integer(ste.getLineNumber()),
new Boolean(ste.isNativeMethod()),
ste.isNativeMethod(),
};
try {
return new CompositeDataSupport(stackTraceElementCompositeType,

View File

@ -120,8 +120,8 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
new Long(threadInfo.getLockOwnerId()),
threadInfo.getLockOwnerName(),
stackTraceData,
new Boolean(threadInfo.isSuspended()),
new Boolean(threadInfo.isInNative()),
threadInfo.isSuspended(),
threadInfo.isInNative(),
lockedMonitorsData,
lockedSyncsData,
};

View File

@ -59,7 +59,7 @@ public class VMOptionCompositeData extends LazyCompositeData {
final Object[] vmOptionItemValues = {
option.getName(),
option.getValue(),
new Boolean(option.isWriteable()),
option.isWriteable(),
option.getOrigin().toString(),
};

View File

@ -70,8 +70,8 @@ public class NotificationTargetImpl implements NotificationTarget {
String addrStr;
if (target.startsWith("[")) {
final int index = target.indexOf("]");
final int index2 = target.lastIndexOf(":");
final int index = target.indexOf(']');
final int index2 = target.lastIndexOf(':');
if(index == -1)
throw new IllegalArgumentException("Host starts with [ but " +
"does not end with ]");
@ -85,8 +85,8 @@ public class NotificationTargetImpl implements NotificationTarget {
if (addrStr.startsWith("["))
throw new IllegalArgumentException("More than one [[...]]");
} else {
final int index = target.indexOf(":");
final int index2 = target.lastIndexOf(":");
final int index = target.indexOf(':');
final int index2 = target.lastIndexOf(':');
if(index == -1) throw new
IllegalArgumentException("Missing port separator \":\"");
addrStr = target.substring(0, index);
@ -98,7 +98,7 @@ public class NotificationTargetImpl implements NotificationTarget {
address = InetAddress.getByName(addrStr);
//THE CHECK SHOULD BE STRONGER!!!
final int index = target.lastIndexOf(":");
final int index = target.lastIndexOf(':');
community = target.substring(index + 1, target.length());

View File

@ -273,8 +273,8 @@ public class ExtensionInfo {
else
{
// Look for index of "." in the string
int sIdx = source.indexOf(".");
int tIdx = target.indexOf(".");
int sIdx = source.indexOf('.');
int tIdx = target.indexOf('.');
if (sIdx == -1)
sIdx = source.length() - 1;
@ -304,10 +304,10 @@ public class ExtensionInfo {
String versionError = mf.format(args);
// Look for "-" for pre-release
int prIndex = token.indexOf("-");
int prIndex = token.indexOf('-');
// Look for "_" for patch release
int patchIndex = token.indexOf("_");
int patchIndex = token.indexOf('_');
if (prIndex == -1 && patchIndex == -1)
{

View File

@ -172,7 +172,7 @@ public class JarIndex {
if ((jarFiles = indexMap.get(fileName)) == null) {
/* try the package name again */
int pos;
if((pos = fileName.lastIndexOf("/")) != -1) {
if((pos = fileName.lastIndexOf('/')) != -1) {
jarFiles = indexMap.get(fileName.substring(0, pos));
}
}
@ -195,7 +195,7 @@ public class JarIndex {
public void add(String fileName, String jarName) {
String packageName;
int pos;
if((pos = fileName.lastIndexOf("/")) != -1) {
if((pos = fileName.lastIndexOf('/')) != -1) {
packageName = fileName.substring(0, pos);
} else {
packageName = fileName;

View File

@ -793,7 +793,7 @@ public class URLClassPath {
boolean validIndex(final String name) {
String packageName = name;
int pos;
if((pos = name.lastIndexOf("/")) != -1) {
if((pos = name.lastIndexOf('/')) != -1) {
packageName = name.substring(0, pos);
}
@ -803,7 +803,7 @@ public class URLClassPath {
while (enum_.hasMoreElements()) {
entry = enum_.nextElement();
entryName = entry.getName();
if((pos = entryName.lastIndexOf("/")) != -1)
if((pos = entryName.lastIndexOf('/')) != -1)
entryName = entryName.substring(0, pos);
if (entryName.equals(packageName)) {
return true;
@ -900,7 +900,7 @@ public class URLClassPath {
*/
JarIndex newIndex = newLoader.getIndex();
if(newIndex != null) {
int pos = jarName.lastIndexOf("/");
int pos = jarName.lastIndexOf('/');
newIndex.merge(this.index, (pos == -1 ?
null : jarName.substring(0, pos + 1)));
}

View File

@ -258,7 +258,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
d = null;
}
if (d != null && time != null) {
int c = time.indexOf(":");
int c = time.indexOf(':');
now.setTime(d);
now.set(Calendar.HOUR, Integer.parseInt(time.substring(0, c)));
now.set(Calendar.MINUTE, Integer.parseInt(time.substring(c + 1)));
@ -294,7 +294,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
public FtpDirEntry parseLine(String line) {
String name = null;
int i = line.lastIndexOf(";");
int i = line.lastIndexOf(';');
if (i > 0) {
name = line.substring(i + 1).trim();
line = line.substring(0, i);
@ -305,7 +305,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
FtpDirEntry file = new FtpDirEntry(name);
while (!line.isEmpty()) {
String s;
i = line.indexOf(";");
i = line.indexOf(';');
if (i > 0) {
s = line.substring(0, i);
line = line.substring(i + 1);
@ -313,7 +313,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
s = line;
line = "";
}
i = s.indexOf("=");
i = s.indexOf('=');
if (i > 0) {
String fact = s.substring(0, i);
String value = s.substring(i + 1);

View File

@ -325,7 +325,7 @@ public final class DNSNameService implements NameService {
while (i.hasNext()) {
String parentDomain = i.next();
int start = 0;
while ((start = parentDomain.indexOf(".")) != -1
while ((start = parentDomain.indexOf('.')) != -1
&& start < parentDomain.length() -1) {
try {
results = resolve(ctx, host+"."+parentDomain, ids, 0);

View File

@ -132,7 +132,7 @@ public class IPAddressUtil {
byte[] dst = new byte[INADDR16SZ];
int srcb_length = srcb.length;
int pc = src.indexOf ("%");
int pc = src.indexOf ('%');
if (pc == srcb_length -1) {
return null;
}

View File

@ -356,8 +356,8 @@ public class ParseUtil {
* because we must not quote a literal IPv6 address
*/
if (opaquePart.startsWith("//[")) {
int end = opaquePart.indexOf("]");
if (end != -1 && opaquePart.indexOf(":")!=-1) {
int end = opaquePart.indexOf(']');
if (end != -1 && opaquePart.indexOf(':')!=-1) {
String doquote, dontquote;
if (end == opaquePart.length()) {
dontquote = opaquePart;
@ -408,8 +408,8 @@ public class ParseUtil {
} else if (authority != null) {
sb.append("//");
if (authority.startsWith("[")) {
int end = authority.indexOf("]");
if (end != -1 && authority.indexOf(":")!=-1) {
int end = authority.indexOf(']');
if (end != -1 && authority.indexOf(':')!=-1) {
String doquote, dontquote;
if (end == authority.length()) {
dontquote = authority;

View File

@ -341,6 +341,6 @@ public final class ReflectUtil {
* (not to be confused with a Java Language anonymous inner class).
*/
public static boolean isVMAnonymousClass(Class<?> cls) {
return cls.getName().indexOf("/") > -1;
return cls.getName().indexOf('/') > -1;
}
}

View File

@ -426,7 +426,7 @@ public abstract class Log {
* Mimic old log messages that only contain unqualified names.
*/
private static String unqualifiedName(String name) {
int lastDot = name.lastIndexOf(".");
int lastDot = name.lastIndexOf('.');
if (lastDot >= 0) {
name = name.substring(lastDot + 1);
}

View File

@ -141,7 +141,7 @@ public final class CGIHandler {
{
try {
String command, param;
int delim = QueryString.indexOf("=");
int delim = QueryString.indexOf('=');
if (delim == -1) {
command = QueryString;
param = "";

View File

@ -50,8 +50,8 @@ public class GSSManagerImpl extends GSSManager {
if (osname.startsWith("SunOS") ||
osname.contains("OS X") ||
osname.startsWith("Linux")) {
return new Boolean(System.getProperty
(USE_NATIVE_PROP));
return Boolean.valueOf(System.getProperty
(USE_NATIVE_PROP));
}
return Boolean.FALSE;
}

View File

@ -39,7 +39,7 @@ class Krb5Util {
static String getTGSName(GSSNameElement name)
throws GSSException {
String krbPrinc = name.getKrbName();
int atIndex = krbPrinc.indexOf("@");
int atIndex = krbPrinc.indexOf('@');
String realm = krbPrinc.substring(atIndex + 1);
StringBuffer buf = new StringBuffer("krbtgt/");
buf.append(realm).append('@').append(realm);

View File

@ -1271,7 +1271,7 @@ public class PolicyFile extends java.security.Policy {
Boolean imp = AccessController.doPrivileged
(new PrivilegedAction<Boolean>() {
public Boolean run() {
return new Boolean(entry.getCodeSource().implies(cs));
return entry.getCodeSource().implies(cs);
}
});
if (!imp.booleanValue()) {
@ -1856,7 +1856,7 @@ public class PolicyFile extends java.security.Policy {
int colonIndex;
String prefix = value;
String suffix;
if ((colonIndex = value.indexOf(":")) != -1) {
if ((colonIndex = value.indexOf(':')) != -1) {
prefix = value.substring(0, colonIndex);
}

View File

@ -338,7 +338,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
}
String sigType;
if (keyType.contains("_")) {
int k = keyType.indexOf("_");
int k = keyType.indexOf('_');
sigType = keyType.substring(k + 1);
keyType = keyType.substring(0, k);
} else {

View File

@ -302,7 +302,7 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager
final String sigKeyAlgorithm;
KeyType(String algorithm) {
int k = algorithm.indexOf("_");
int k = algorithm.indexOf('_');
if (k == -1) {
keyAlgorithm = algorithm;
sigKeyAlgorithm = null;

View File

@ -300,8 +300,8 @@ public class HostnameChecker {
template = template.toLowerCase(Locale.ENGLISH);
// Retreive leftmost component
int templateIdx = template.indexOf(".");
int nameIdx = name.indexOf(".");
int templateIdx = template.indexOf('.');
int nameIdx = name.indexOf('.');
if (templateIdx == -1)
templateIdx = template.length();
@ -326,7 +326,7 @@ public class HostnameChecker {
*/
private static boolean matchWildCards(String name, String template) {
int wildcardIdx = template.indexOf("*");
int wildcardIdx = template.indexOf('*');
if (wildcardIdx == -1)
return name.equals(template);
@ -349,7 +349,7 @@ public class HostnameChecker {
// update the match scope
name = name.substring(beforeStartIdx + beforeWildcard.length());
wildcardIdx = afterWildcard.indexOf("*");
wildcardIdx = afterWildcard.indexOf('*');
}
return name.endsWith(afterWildcard);
}

View File

@ -98,7 +98,7 @@ public class SignatureFileVerifier {
} finally {
Providers.stopJarVerification(obj);
}
this.name = name.substring(0, name.lastIndexOf("."))
this.name = name.substring(0, name.lastIndexOf('.'))
.toUpperCase(Locale.ENGLISH);
this.md = md;
this.signerCache = signerCache;

View File

@ -185,7 +185,7 @@ public class CRLExtensions {
String name;
String id = attr.getPrefix();
if (id.equalsIgnoreCase(X509CertImpl.NAME)) { // fully qualified
int index = alias.lastIndexOf(".");
int index = alias.lastIndexOf('.');
name = alias.substring(index + 1);
} else
name = alias;

View File

@ -325,7 +325,7 @@ public class ConnectDialog extends InternalDialog
} else {
String host = remoteTF.getText().trim();
String port = "0";
int index = host.lastIndexOf(":");
int index = host.lastIndexOf(':');
if (index >= 0) {
port = host.substring(index + 1);
host = host.substring(0, index);

View File

@ -210,7 +210,7 @@ public class Utils {
public static String getArrayClassName(String name) {
String className = null;
if (name.startsWith("[")) {
int index = name.lastIndexOf("[");
int index = name.lastIndexOf('[');
className = name.substring(index, name.length());
if (className.startsWith("[L")) {
className = className.substring(2, className.length() - 1);
@ -241,7 +241,7 @@ public class Utils {
if (className == null) {
return name;
}
int index = name.lastIndexOf("[");
int index = name.lastIndexOf('[');
StringBuilder brackets = new StringBuilder(className);
for (int i = 0; i <= index; i++) {
brackets.append("[]");

View File

@ -113,7 +113,7 @@ public abstract class XOperations extends JPanel implements ActionListener {
if (methodLabel.getText().length() > 20) {
methodLabel.setText(methodLabel.getText().
substring(methodLabel.getText().
lastIndexOf(".") + 1,
lastIndexOf('.') + 1,
methodLabel.getText().length()));
}

View File

@ -475,7 +475,7 @@ public class XTree extends JTree {
private static Map<String, String> extractKeyValuePairs(
String props, ObjectName mbean) {
Map<String, String> map = new LinkedHashMap<String, String>();
int eq = props.indexOf("=");
int eq = props.indexOf('=');
while (eq != -1) {
String key = props.substring(0, eq);
String value = mbean.getKeyProperty(key);
@ -484,7 +484,7 @@ public class XTree extends JTree {
if (props.startsWith(",")) {
props = props.substring(1);
}
eq = props.indexOf("=");
eq = props.indexOf('=');
}
return map;
}
@ -821,7 +821,7 @@ public class XTree extends JTree {
}
private void buildKeyValue() {
int index = tokenValue.indexOf("=");
int index = tokenValue.indexOf('=');
if (index < 0) {
key = tokenValue;
value = tokenValue;