mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
use index of char instead of index of string, if possible
This commit is contained in:
@@ -340,7 +340,7 @@ public class PackageMojo extends AbstractBaseScmMojo
|
|||||||
if (resolveMetadata)
|
if (resolveMetadata)
|
||||||
{
|
{
|
||||||
String path = localRepository.pathOf(artifact);
|
String path = localRepository.pathOf(artifact);
|
||||||
int lastIndex = path.lastIndexOf(".");
|
int lastIndex = path.lastIndexOf('.');
|
||||||
|
|
||||||
if (lastIndex > 0)
|
if (lastIndex > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class INIConfigurationReader extends AbstractReader<INIConfiguration>
|
|||||||
else if ((section != null) &&!line.startsWith(";")
|
else if ((section != null) &&!line.startsWith(";")
|
||||||
&&!line.startsWith("#"))
|
&&!line.startsWith("#"))
|
||||||
{
|
{
|
||||||
int index = line.indexOf("=");
|
int index = line.indexOf('=');
|
||||||
|
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class Proxies
|
|||||||
url = url.substring(index + 3);
|
url = url.substring(index + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
index = url.indexOf("/");
|
index = url.indexOf('/');
|
||||||
|
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class PluginVersion implements Comparable<PluginVersion>
|
|||||||
{
|
{
|
||||||
this.unparsedVersion = versionString;
|
this.unparsedVersion = versionString;
|
||||||
|
|
||||||
int index = versionString.indexOf("-");
|
int index = versionString.indexOf('-');
|
||||||
String versionPart = null;
|
String versionPart = null;
|
||||||
String qualifierPart = null;
|
String qualifierPart = null;
|
||||||
|
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ public class Person implements Validateable, Serializable
|
|||||||
{
|
{
|
||||||
String name = value;
|
String name = value;
|
||||||
String mail = null;
|
String mail = null;
|
||||||
int s = value.indexOf("<");
|
int s = value.indexOf('<');
|
||||||
int e = value.indexOf(">");
|
int e = value.indexOf('>');
|
||||||
|
|
||||||
if ((s > 0) && (e > 0))
|
if ((s > 0) && (e > 0))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class UrlUtil
|
|||||||
|
|
||||||
if (Util.isNotEmpty(revision))
|
if (Util.isNotEmpty(revision))
|
||||||
{
|
{
|
||||||
int index = revision.indexOf(":");
|
int index = revision.indexOf(':');
|
||||||
|
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ public class HttpUtil
|
|||||||
*/
|
*/
|
||||||
public static String removeMatrixParameter(String uri)
|
public static String removeMatrixParameter(String uri)
|
||||||
{
|
{
|
||||||
int index = uri.indexOf(";");
|
int index = uri.indexOf(';');
|
||||||
|
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class RegistryUtil
|
|||||||
if (value.startsWith("\""))
|
if (value.startsWith("\""))
|
||||||
{
|
{
|
||||||
value = value.substring(1);
|
value = value.substring(1);
|
||||||
value = value.substring(0, value.indexOf("\""));
|
value = value.substring(0, value.indexOf('"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ public class CGIRunner
|
|||||||
// into exec here...
|
// into exec here...
|
||||||
String execCmd = path;
|
String execCmd = path;
|
||||||
|
|
||||||
if ((execCmd.charAt(0) != '"') && (execCmd.indexOf(" ") >= 0))
|
if ((execCmd.charAt(0) != '"') && (execCmd.indexOf(' ') >= 0))
|
||||||
{
|
{
|
||||||
execCmd = "\"" + execCmd + "\"";
|
execCmd = "\"" + execCmd + "\"";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ public class HgFileviewCommand extends AbstractCommand
|
|||||||
*/
|
*/
|
||||||
private String getNameFromPath(String path)
|
private String getNameFromPath(String path)
|
||||||
{
|
{
|
||||||
int index = path.lastIndexOf("/");
|
int index = path.lastIndexOf('/');
|
||||||
|
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1089,7 +1089,7 @@ public class RepositoryResource
|
|||||||
private String getContentDispositionNameFromPath(String path)
|
private String getContentDispositionNameFromPath(String path)
|
||||||
{
|
{
|
||||||
String name = path;
|
String name = path;
|
||||||
int index = path.lastIndexOf("/");
|
int index = path.lastIndexOf('/');
|
||||||
|
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
{
|
{
|
||||||
|
|
||||||
// jar:file:/some/path/file.jar!/META-INF/scm/plugin.xml
|
// jar:file:/some/path/file.jar!/META-INF/scm/plugin.xml
|
||||||
path = path.substring("jar:file:".length(), path.lastIndexOf("!"));
|
path = path.substring("jar:file:".length(), path.lastIndexOf('!'));
|
||||||
path = decodePath(path);
|
path = decodePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -673,7 +673,7 @@ public class DefaultPluginManager
|
|||||||
*/
|
*/
|
||||||
private String getPluginIdPrefix(String pluginId)
|
private String getPluginIdPrefix(String pluginId)
|
||||||
{
|
{
|
||||||
return pluginId.substring(0, pluginId.lastIndexOf(":"));
|
return pluginId.substring(0, pluginId.lastIndexOf(':'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public class TemplateServlet extends HttpServlet
|
|||||||
params.put("locale", locale);
|
params.put("locale", locale);
|
||||||
|
|
||||||
String country = locale;
|
String country = locale;
|
||||||
int i = country.indexOf("_");
|
int i = country.indexOf('_');
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ public class DefaultCGIExecutor extends AbstractCGIExecutor
|
|||||||
|
|
||||||
String execCmd = path;
|
String execCmd = path;
|
||||||
|
|
||||||
if ((execCmd.charAt(0) != '"') && (execCmd.indexOf(" ") >= 0))
|
if ((execCmd.charAt(0) != '"') && (execCmd.indexOf(' ') >= 0))
|
||||||
{
|
{
|
||||||
execCmd = "\"".concat(execCmd).concat("\"");
|
execCmd = "\"".concat(execCmd).concat("\"");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user