Commits

Sebastian Sdorra  committed 8bd741d

use index of char instead of index of string, if possible

  • Participants
  • Parent commits a51a6d1

Comments (0)

Files changed (16)

File maven/scm-maven-plugin/src/main/java/sonia/scm/maven/PackageMojo.java

       if (resolveMetadata)
       {
         String path = localRepository.pathOf(artifact);
-        int lastIndex = path.lastIndexOf(".");
+        int lastIndex = path.lastIndexOf('.');
 
         if (lastIndex > 0)
         {

File scm-core/src/main/java/sonia/scm/io/INIConfigurationReader.java

         else if ((section != null) &&!line.startsWith(";")
                  &&!line.startsWith("#"))
         {
-          int index = line.indexOf("=");
+          int index = line.indexOf('=');
 
           if (index > 0)
           {

File scm-core/src/main/java/sonia/scm/net/Proxies.java

         url = url.substring(index + 3);
       }
 
-      index = url.indexOf("/");
+      index = url.indexOf('/');
 
       if (index > 0)
       {

File scm-core/src/main/java/sonia/scm/plugin/PluginVersion.java

   {
     this.unparsedVersion = versionString;
 
-    int index = versionString.indexOf("-");
+    int index = versionString.indexOf('-');
     String versionPart = null;
     String qualifierPart = null;
 

File scm-core/src/main/java/sonia/scm/repository/Person.java

     {
       String name = value;
       String mail = null;
-      int s = value.indexOf("<");
-      int e = value.indexOf(">");
+      int s = value.indexOf('<');
+      int e = value.indexOf('>');
 
       if ((s > 0) && (e > 0))
       {

File scm-core/src/main/java/sonia/scm/url/UrlUtil.java

 
     if (Util.isNotEmpty(revision))
     {
-      int index = revision.indexOf(":");
+      int index = revision.indexOf(':');
 
       if (index > 0)
       {

File scm-core/src/main/java/sonia/scm/util/HttpUtil.java

    */
   public static String removeMatrixParameter(String uri)
   {
-    int index = uri.indexOf(";");
+    int index = uri.indexOf(';');
 
     if (index > 0)
     {

File scm-core/src/main/java/sonia/scm/util/RegistryUtil.java

             if (value.startsWith("\""))
             {
               value = value.substring(1);
-              value = value.substring(0, value.indexOf("\""));
+              value = value.substring(0, value.indexOf('"'));
             }
 
             if (logger.isDebugEnabled())

File scm-core/src/main/java/sonia/scm/web/cgi/CGIRunner.java

     // into exec here...
     String execCmd = path;
 
-    if ((execCmd.charAt(0) != '"') && (execCmd.indexOf(" ") >= 0))
+    if ((execCmd.charAt(0) != '"') && (execCmd.indexOf(' ') >= 0))
     {
       execCmd = "\"" + execCmd + "\"";
     }

File scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/javahg/HgFileviewCommand.java

    */
   private String getNameFromPath(String path)
   {
-    int index = path.lastIndexOf("/");
+    int index = path.lastIndexOf('/');
 
     if (index > 0)
     {

File scm-webapp/src/main/java/sonia/scm/api/rest/resources/RepositoryResource.java

   private String getContentDispositionNameFromPath(String path)
   {
     String name = path;
-    int index = path.lastIndexOf("/");
+    int index = path.lastIndexOf('/');
 
     if (index >= 0)
     {

File scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginLoader.java

     {
 
       // 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);
     }
 

File scm-webapp/src/main/java/sonia/scm/plugin/DefaultPluginManager.java

    */
   private String getPluginIdPrefix(String pluginId)
   {
-    return pluginId.substring(0, pluginId.lastIndexOf(":"));
+    return pluginId.substring(0, pluginId.lastIndexOf(':'));
   }
 
   /**

File scm-webapp/src/main/java/sonia/scm/template/TemplateServlet.java

     params.put("locale", locale);
 
     String country = locale;
-    int i = country.indexOf("_");
+    int i = country.indexOf('_');
 
     if (i > 0)
     {

File scm-webapp/src/main/java/sonia/scm/web/cgi/DefaultCGIExecutor.java

 
     String execCmd = path;
 
-    if ((execCmd.charAt(0) != '"') && (execCmd.indexOf(" ") >= 0))
+    if ((execCmd.charAt(0) != '"') && (execCmd.indexOf(' ') >= 0))
     {
       execCmd = "\"".concat(execCmd).concat("\"");
     }

File scm-webapp/src/test/java/sonia/scm/cache/EhCacheTest.java

  */
 public class EhCacheTest
 {
-
+  
   /**
    * Method description
    *