8044461: Cleanup new Boolean and single character strings
Reviewed-by: rriggs, alanb, lancea
Contributed-by: otaviopolianasantana@gmail.com
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Fri May 30 15:46:12 2014 -0400
@@ -512,7 +512,7 @@
}
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;
}
--- a/jdk/src/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java Fri May 30 15:46:12 2014 -0400
@@ -102,7 +102,7 @@
}
location = url.substring(addrStart, addrEnd);
- int keyStart = location.indexOf("/");
+ int keyStart = location.indexOf('/');
if (keyStart >= 0) {
// Has key string
if (keyStart == (location.length() -1)) {
--- a/jdk/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java Fri May 30 15:46:12 2014 -0400
@@ -336,7 +336,7 @@
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);
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Fri May 30 15:46:12 2014 -0400
@@ -149,7 +149,7 @@
* 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 @@
start += 2; // skip double slash
// find last slash
- int posn = url.indexOf("/", start);
+ int posn = url.indexOf('/', start);
if (posn >= 0) {
start = posn;
} else {
--- a/jdk/src/share/classes/com/sun/rmi/rmid/ExecOptionPermission.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/rmi/rmid/ExecOptionPermission.java Fri May 30 15:46:12 2014 -0400
@@ -303,7 +303,7 @@
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 @@
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);
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java Fri May 30 15:46:12 2014 -0400
@@ -6831,7 +6831,7 @@
// 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
--- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java Fri May 30 15:46:12 2014 -0400
@@ -910,7 +910,7 @@
// now remove the last ","
strWhereClause = strWhereClause.substring
- (0, strWhereClause.lastIndexOf(","));
+ (0, strWhereClause.lastIndexOf(','));
// Add from clause
strWhereClause = strWhereClause.concat(" from ");
@@ -920,7 +920,7 @@
//Remove the last ","
strWhereClause = strWhereClause.substring
- (0, strWhereClause.lastIndexOf(","));
+ (0, strWhereClause.lastIndexOf(','));
// Add the where clause
strWhereClause = strWhereClause.concat(" where ");
--- a/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java Fri May 30 15:46:12 2014 -0400
@@ -240,7 +240,7 @@
// 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");
--- a/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java Fri May 30 15:46:12 2014 -0400
@@ -1147,7 +1147,7 @@
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;
--- a/jdk/src/share/classes/com/sun/rowset/internal/XmlResolver.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/rowset/internal/XmlResolver.java Fri May 30 15:46:12 2014 -0400
@@ -39,7 +39,7 @@
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));
--- a/jdk/src/share/classes/com/sun/security/auth/module/JndiLoginModule.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/security/auth/module/JndiLoginModule.java Fri May 30 15:46:12 2014 -0400
@@ -694,7 +694,7 @@
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 + " "
--- a/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java Fri May 30 15:46:12 2014 -0400
@@ -400,7 +400,7 @@
// 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));
}
}
--- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java Fri May 30 15:46:12 2014 -0400
@@ -857,7 +857,7 @@
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;
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java Fri May 30 15:46:12 2014 -0400
@@ -1079,7 +1079,7 @@
}
} 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);
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/AllClassesQuery.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/AllClassesQuery.java Fri May 30 15:46:12 2014 -0400
@@ -67,7 +67,7 @@
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>";
--- a/jdk/src/share/classes/java/lang/Class.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/lang/Class.java Fri May 30 15:46:12 2014 -0400
@@ -1296,7 +1296,7 @@
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
--- a/jdk/src/share/classes/java/lang/ClassLoader.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java Fri May 30 15:46:12 2014 -0400
@@ -2133,7 +2133,7 @@
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 @@
result = packageAssertionStatus.get(className);
if (result != null)
return result.booleanValue();
- dotIndex = className.lastIndexOf(".", dotIndex-1);
+ dotIndex = className.lastIndexOf('.', dotIndex-1);
}
// Return the classloader default
--- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Fri May 30 15:46:12 2014 -0400
@@ -85,7 +85,7 @@
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);
}
--- a/jdk/src/share/classes/java/net/CookieManager.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/net/CookieManager.java Fri May 30 15:46:12 2014 -0400
@@ -294,7 +294,7 @@
// 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 @@
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 @@
} catch (NumberFormatException numberFormatException) {
}
lst = lst.substring(i+1);
- i = lst.indexOf(",");
+ i = lst.indexOf(',');
}
if (!lst.isEmpty()) {
try {
--- a/jdk/src/share/classes/java/net/InetAddress.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/net/InetAddress.java Fri May 30 15:46:12 2014 -0400
@@ -1138,7 +1138,7 @@
// 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);
--- a/jdk/src/share/classes/java/net/Socket.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/net/Socket.java Fri May 30 15:46:12 2014 -0400
@@ -1017,7 +1017,7 @@
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");
--- a/jdk/src/share/classes/java/net/SocketPermission.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/net/SocketPermission.java Fri May 30 15:46:12 2014 -0400
@@ -777,7 +777,7 @@
// Literal IPv6 address
host = getName().substring(1, getName().indexOf(']'));
} else {
- int i = getName().indexOf(":");
+ int i = getName().indexOf(':');
if (i == -1)
host = getName();
else {
--- a/jdk/src/share/classes/java/net/SocksSocketImpl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/net/SocksSocketImpl.java Fri May 30 15:46:12 2014 -0400
@@ -368,7 +368,7 @@
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 @@
String host = saddr.getHostString();
// IPv6 litteral?
if (saddr.getAddress() instanceof Inet6Address &&
- (!host.startsWith("[")) && (host.indexOf(":") >= 0)) {
+ (!host.startsWith("[")) && (host.indexOf(':') >= 0)) {
host = "[" + host + "]";
}
try {
--- a/jdk/src/share/classes/java/net/URI.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/net/URI.java Fri May 30 15:46:12 2014 -0400
@@ -1851,9 +1851,9 @@
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 @@
* 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;
--- a/jdk/src/share/classes/java/security/BasicPermission.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/security/BasicPermission.java Fri May 30 15:46:12 2014 -0400
@@ -430,7 +430,7 @@
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);
--- a/jdk/src/share/classes/java/security/Provider.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/security/Provider.java Fri May 30 15:46:12 2014 -0400
@@ -931,7 +931,7 @@
}
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 "
--- a/jdk/src/share/classes/java/security/Security.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/security/Security.java Fri May 30 15:46:12 2014 -0400
@@ -1114,7 +1114,7 @@
// 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));
}
--- a/jdk/src/share/classes/java/util/PropertyPermission.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/util/PropertyPermission.java Fri May 30 15:46:12 2014 -0400
@@ -546,7 +546,7 @@
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);
--- a/jdk/src/share/classes/java/util/jar/JarVerifier.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java Fri May 30 15:46:12 2014 -0400
@@ -276,7 +276,7 @@
// 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<>();
--- a/jdk/src/share/classes/java/util/logging/LogManager.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java Fri May 30 15:46:12 2014 -0400
@@ -779,7 +779,7 @@
int ix = 1;
for (;;) {
- int ix2 = name.indexOf(".", ix);
+ int ix2 = name.indexOf('.', ix);
if (ix2 < 0) {
break;
}
@@ -802,7 +802,7 @@
}
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);
--- a/jdk/src/share/classes/java/util/logging/XMLFormatter.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/XMLFormatter.java Fri May 30 15:46:12 2014 -0400
@@ -174,7 +174,7 @@
// 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 {
--- a/jdk/src/share/classes/javax/management/MBeanPermission.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/javax/management/MBeanPermission.java Fri May 30 15:46:12 2014 -0400
@@ -290,7 +290,7 @@
// Parse ObjectName
- int openingBracket = name.indexOf("[");
+ int openingBracket = name.indexOf('[');
if (openingBracket == -1) {
// If "[on]" missing then ObjectName("*:*")
//
@@ -329,7 +329,7 @@
// Parse member
- int poundSign = name.indexOf("#");
+ int poundSign = name.indexOf('#');
if (poundSign == -1)
setMember("*");
--- a/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java Fri May 30 15:46:12 2014 -0400
@@ -329,7 +329,7 @@
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 @@
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)) {
--- a/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java Fri May 30 15:46:12 2014 -0400
@@ -934,7 +934,7 @@
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 @@
/* 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);
--- a/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java Fri May 30 15:46:12 2014 -0400
@@ -495,7 +495,7 @@
// 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();
--- a/jdk/src/share/classes/javax/security/sasl/Sasl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/javax/security/sasl/Sasl.java Fri May 30 15:46:12 2014 -0400
@@ -600,7 +600,7 @@
// 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);
--- a/jdk/src/share/classes/sun/jvmstat/monitor/AbstractMonitor.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/monitor/AbstractMonitor.java Fri May 30 15:46:12 2014 -0400
@@ -84,7 +84,7 @@
* {@inheritDoc}
*/
public String getBaseName() {
- int baseIndex = name.lastIndexOf(".")+1;
+ int baseIndex = name.lastIndexOf('.') + 1;
return name.substring(baseIndex);
}
--- a/jdk/src/share/classes/sun/jvmstat/monitor/HostIdentifier.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/monitor/HostIdentifier.java Fri May 30 15:46:12 2014 -0400
@@ -138,8 +138,8 @@
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
--- a/jdk/src/share/classes/sun/management/StackTraceElementCompositeData.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/management/StackTraceElementCompositeData.java Fri May 30 15:46:12 2014 -0400
@@ -68,7 +68,7 @@
ste.getMethodName(),
ste.getFileName(),
new Integer(ste.getLineNumber()),
- new Boolean(ste.isNativeMethod()),
+ ste.isNativeMethod(),
};
try {
return new CompositeDataSupport(stackTraceElementCompositeType,
--- a/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java Fri May 30 15:46:12 2014 -0400
@@ -120,8 +120,8 @@
new Long(threadInfo.getLockOwnerId()),
threadInfo.getLockOwnerName(),
stackTraceData,
- new Boolean(threadInfo.isSuspended()),
- new Boolean(threadInfo.isInNative()),
+ threadInfo.isSuspended(),
+ threadInfo.isInNative(),
lockedMonitorsData,
lockedSyncsData,
};
--- a/jdk/src/share/classes/sun/management/VMOptionCompositeData.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/management/VMOptionCompositeData.java Fri May 30 15:46:12 2014 -0400
@@ -59,7 +59,7 @@
final Object[] vmOptionItemValues = {
option.getName(),
option.getValue(),
- new Boolean(option.isWriteable()),
+ option.isWriteable(),
option.getOrigin().toString(),
};
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/NotificationTargetImpl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/NotificationTargetImpl.java Fri May 30 15:46:12 2014 -0400
@@ -70,8 +70,8 @@
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 @@
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 @@
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());
--- a/jdk/src/share/classes/sun/misc/ExtensionInfo.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/misc/ExtensionInfo.java Fri May 30 15:46:12 2014 -0400
@@ -273,8 +273,8 @@
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 @@
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)
{
--- a/jdk/src/share/classes/sun/misc/JarIndex.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/misc/JarIndex.java Fri May 30 15:46:12 2014 -0400
@@ -172,7 +172,7 @@
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 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;
--- a/jdk/src/share/classes/sun/misc/URLClassPath.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/misc/URLClassPath.java Fri May 30 15:46:12 2014 -0400
@@ -793,7 +793,7 @@
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 @@
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 @@
*/
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)));
}
--- a/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java Fri May 30 15:46:12 2014 -0400
@@ -258,7 +258,7 @@
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 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 @@
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 @@
s = line;
line = "";
}
- i = s.indexOf("=");
+ i = s.indexOf('=');
if (i > 0) {
String fact = s.substring(0, i);
String value = s.substring(i + 1);
--- a/jdk/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java Fri May 30 15:46:12 2014 -0400
@@ -325,7 +325,7 @@
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);
--- a/jdk/src/share/classes/sun/net/util/IPAddressUtil.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/net/util/IPAddressUtil.java Fri May 30 15:46:12 2014 -0400
@@ -132,7 +132,7 @@
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;
}
--- a/jdk/src/share/classes/sun/net/www/ParseUtil.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/net/www/ParseUtil.java Fri May 30 15:46:12 2014 -0400
@@ -356,8 +356,8 @@
* 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 @@
} 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;
--- a/jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java Fri May 30 15:46:12 2014 -0400
@@ -341,6 +341,6 @@
* (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;
}
}
--- a/jdk/src/share/classes/sun/rmi/runtime/Log.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/rmi/runtime/Log.java Fri May 30 15:46:12 2014 -0400
@@ -426,7 +426,7 @@
* 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);
}
--- a/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java Fri May 30 15:46:12 2014 -0400
@@ -141,7 +141,7 @@
{
try {
String command, param;
- int delim = QueryString.indexOf("=");
+ int delim = QueryString.indexOf('=');
if (delim == -1) {
command = QueryString;
param = "";
--- a/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java Fri May 30 15:46:12 2014 -0400
@@ -50,8 +50,8 @@
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;
}
--- a/jdk/src/share/classes/sun/security/jgss/wrapper/Krb5Util.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/security/jgss/wrapper/Krb5Util.java Fri May 30 15:46:12 2014 -0400
@@ -39,7 +39,7 @@
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);
--- a/jdk/src/share/classes/sun/security/provider/PolicyFile.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/PolicyFile.java Fri May 30 15:46:12 2014 -0400
@@ -1271,7 +1271,7 @@
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 @@
int colonIndex;
String prefix = value;
String suffix;
- if ((colonIndex = value.indexOf(":")) != -1) {
+ if ((colonIndex = value.indexOf(':')) != -1) {
prefix = value.substring(0, colonIndex);
}
--- a/jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java Fri May 30 15:46:12 2014 -0400
@@ -338,7 +338,7 @@
}
String sigType;
if (keyType.contains("_")) {
- int k = keyType.indexOf("_");
+ int k = keyType.indexOf('_');
sigType = keyType.substring(k + 1);
keyType = keyType.substring(0, k);
} else {
--- a/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java Fri May 30 15:46:12 2014 -0400
@@ -302,7 +302,7 @@
final String sigKeyAlgorithm;
KeyType(String algorithm) {
- int k = algorithm.indexOf("_");
+ int k = algorithm.indexOf('_');
if (k == -1) {
keyAlgorithm = algorithm;
sigKeyAlgorithm = null;
--- a/jdk/src/share/classes/sun/security/util/HostnameChecker.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/security/util/HostnameChecker.java Fri May 30 15:46:12 2014 -0400
@@ -300,8 +300,8 @@
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 @@
*/
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 @@
// update the match scope
name = name.substring(beforeStartIdx + beforeWildcard.length());
- wildcardIdx = afterWildcard.indexOf("*");
+ wildcardIdx = afterWildcard.indexOf('*');
}
return name.endsWith(afterWildcard);
}
--- a/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java Fri May 30 15:46:12 2014 -0400
@@ -98,7 +98,7 @@
} 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;
--- a/jdk/src/share/classes/sun/security/x509/CRLExtensions.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/security/x509/CRLExtensions.java Fri May 30 15:46:12 2014 -0400
@@ -185,7 +185,7 @@
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;
--- a/jdk/src/share/classes/sun/tools/jconsole/ConnectDialog.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/ConnectDialog.java Fri May 30 15:46:12 2014 -0400
@@ -325,7 +325,7 @@
} 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);
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/Utils.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/Utils.java Fri May 30 15:46:12 2014 -0400
@@ -210,7 +210,7 @@
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 @@
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("[]");
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/XOperations.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/XOperations.java Fri May 30 15:46:12 2014 -0400
@@ -113,7 +113,7 @@
if (methodLabel.getText().length() > 20) {
methodLabel.setText(methodLabel.getText().
substring(methodLabel.getText().
- lastIndexOf(".") + 1,
+ lastIndexOf('.') + 1,
methodLabel.getText().length()));
}
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/XTree.java Wed Jul 05 19:43:07 2017 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/XTree.java Fri May 30 15:46:12 2014 -0400
@@ -475,7 +475,7 @@
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 @@
if (props.startsWith(",")) {
props = props.substring(1);
}
- eq = props.indexOf("=");
+ eq = props.indexOf('=');
}
return map;
}
@@ -821,7 +821,7 @@
}
private void buildKeyValue() {
- int index = tokenValue.indexOf("=");
+ int index = tokenValue.indexOf('=');
if (index < 0) {
key = tokenValue;
value = tokenValue;