Commits

Sebastian Sdorra committed 7ff977c

util classes should be final with a private constructor

Comments (0)

Files changed (22)

scm-clients/scm-client-api/src/main/java/sonia/scm/client/ScmClient.java

  *
  * @author Sebastian Sdorra
  */
-public class ScmClient
+public final class ScmClient
 {
 
   /** Field description */
   /** the logger for ScmClient */
   private static final Logger logger = LoggerFactory.getLogger(ScmClient.class);
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private ScmClient() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**
    * @throws ScmClientException
    */
   public static ScmClientSession createSession(String url, String username,
-          String password)
-          throws ScmClientException
+    String password)
+    throws ScmClientException
   {
     return getProvider().createSession(url, username, password);
   }
    * @throws ScmClientException
    */
   public static ScmClientSession createSession(String url)
-          throws ScmClientException
+    throws ScmClientException
   {
     return getProvider().createSession(url, null, null);
   }
     else if (logger.isInfoEnabled())
     {
       logger.info("create ScmClient with provider {}",
-                  provider.getClass().getName());
+        provider.getClass().getName());
     }
 
     return provider;

scm-core/src/main/java/sonia/scm/SCMContext.java

  *
  * @author Sebastian Sdorra
  */
-public class SCMContext
+public final class SCMContext
 {
 
   /** Default java package for finding extensions */
   /** Name of the anonymous user */
   public static final String USER_ANONYMOUS = "anonymous";
 
-  /** 
-   * the anonymous user 
+  /**
+   * the anonymous user
    * @since 1.21
    */
   public static final User ANONYMOUS = new User(USER_ANONYMOUS,
   /** Singleton instance of {@link SCMContextProvider} */
   private static volatile SCMContextProvider provider;
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private SCMContext() {}
+
   //~--- get methods ----------------------------------------------------------
 
   /**

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

  */
 
 
+
 package sonia.scm.net;
 
 //~--- non-JDK imports --------------------------------------------------------
  * @author Sebastian Sdorra
  * @since 1.23
  */
-public class Proxies
+public final class Proxies
 {
 
   /**
    */
   private static final Logger logger = LoggerFactory.getLogger(Proxies.class);
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private Proxies() {}
+
   //~--- get methods ----------------------------------------------------------
 
   /**

scm-core/src/main/java/sonia/scm/security/Role.java

  */
 
 
+
 package sonia.scm.security;
 
 /**
 
   /** Field description */
   public static final String USER = "user";
+
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private Role() {}
 }

scm-core/src/main/java/sonia/scm/security/Tokens.java

  */
 
 
+
 package sonia.scm.security;
 
 //~--- non-JDK imports --------------------------------------------------------
 {
 
   /**
+   * Constructs ...
+   *
+   */
+  private Tokens() {}
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
    * Build an {@link AuthenticationToken} for use with
    * {@link Subject#login(org.apache.shiro.authc.AuthenticationToken)}.
    *

scm-core/src/main/java/sonia/scm/template/Templates.java

  */
 
 
+
 package sonia.scm.template;
 
 //~--- non-JDK imports --------------------------------------------------------
  * @author Sebastian Sdorra
  * @since 1.22
  */
-public class Templates
+public final class Templates
 {
 
   /**
    */
   private static final Logger logger = LoggerFactory.getLogger(Templates.class);
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private Templates() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**

scm-core/src/main/java/sonia/scm/url/UrlProviderFactory.java

  * @since 1.9
  * @author Sebastian Sdorra
  */
-public class UrlProviderFactory
+public final class UrlProviderFactory
 {
 
   /** Field description */
   /** Field description */
   private static final String EXTENSION_XML = ".xml";
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private UrlProviderFactory() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**

scm-core/src/main/java/sonia/scm/util/LinkTextParser.java

  *
  * @author Sebastian Sdorra
  */
-public class LinkTextParser
+public final class LinkTextParser
 {
 
   /** Field description */
   private static final Pattern REGEX_URL =
     Pattern.compile(
-        "\\(?\\b((?:https?://|ftps?://|mailto:|www[.])[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|])");
+      "\\(?\\b((?:https?://|ftps?://|mailto:|www[.])[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|])");
 
   /** Field description */
   private static final String REPLACE_URL =
     "<a target=\"_blank\" href=\"{1}\">{0}</a>";
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private LinkTextParser() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**
       if (token.getReplacement() != null)
       {
         buffer.append(MessageFormat.format(REPLACE_URL, token.getValue(),
-                                           token.getReplacement()));
+          token.getReplacement()));
       }
       else
       {
         buffer.append(token.getValue().replace("<", "&lt;").replace(">",
-                "&gt;"));
+          "&gt;"));
       }
     }
 
    *
    *
    * @version        Enter version here..., 11/11/06
-   * @author         Enter your name here...    
+   * @author         Enter your name here...
    */
   private static class Token
   {

scm-plugin-backend/src/main/java/sonia/scm/plugin/BaseDirectory.java

  */
 
 
+
 package sonia.scm.plugin;
 
 //~--- non-JDK imports --------------------------------------------------------
  *
  * @author Sebastian Sdorra
  */
-public class BaseDirectory
+public final class BaseDirectory
 {
 
   /** Field description */
    * Constructs ...
    *
    */
-  public BaseDirectory()
+  private BaseDirectory()
   {
     baseDirectory = findBaseDirectory();
   }

scm-plugin-backend/src/main/java/sonia/scm/plugin/Roles.java

  */
 
 
+
 package sonia.scm.plugin;
 
 /**
  *
  * @author Sebastian Sdorra
  */
-public class Roles
+public final class Roles
 {
 
   /** Field description */
   public static final String ADMIN = "admin";
+
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private Roles() {}
 }

scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScanners.java

  */
 
 
+
 package sonia.scm.plugin.scanner;
 
 //~--- non-JDK imports --------------------------------------------------------
  *
  * @author Sebastian Sdorra
  */
-public class PluginScanners
+public final class PluginScanners
 {
 
   /**
   private static final Logger logger =
     LoggerFactory.getLogger(PluginScanners.class);
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private PluginScanners() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**

scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitSubModuleParser.java

  */
 
 
+
 package sonia.scm.repository;
 
 //~--- non-JDK imports --------------------------------------------------------
  *
  * @author Sebastian Sdorra
  */
-public class GitSubModuleParser
+public final class GitSubModuleParser
 {
 
   /**
+   * Constructs ...
+   *
+   */
+  private GitSubModuleParser() {}
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
    * //~--- methods --------------------------------------------------------------
    *
    *

scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/installer/HgInstallerFactory.java

  *
  * @author Sebastian Sdorra
  */
-public class HgInstallerFactory
+public final class HgInstallerFactory
 {
 
   /**
+   * Constructs ...
+   *
+   */
+  private HgInstallerFactory() {}
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
    * Method description
    *
    *

scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgPyFix.java

  */
 
 
+
 package sonia.scm.repository;
 
 //~--- non-JDK imports --------------------------------------------------------
  *
  * @author Sebastian Sdorra
  */
-public class HgPyFix
+public final class HgPyFix
 {
 
   /** Field description */
    */
   private static final Logger logger = LoggerFactory.getLogger(HgUtil.class);
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private HgPyFix() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**
    * Visible for testing
    *
    *
-   * @param hg
    *
    * @param hgBat
    */

scm-test/src/main/java/sonia/scm/repository/PersonTestData.java

  */
 
 
+
 package sonia.scm.repository;
 
 /**
  * @author Sebastian Sdorra
  * @since 1.18
  */
-public class PersonTestData
+public final class PersonTestData
 {
 
   /** Field description */
   /** Field description */
   public static final Person ZAPHOD =
     Person.toPerson("Zaphod Beeblebrox <zaphod.beeblebrox@hitchhiker.com>");
+
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private PersonTestData() {}
 }

scm-test/src/main/java/sonia/scm/repository/RepositoryTestData.java

  *
  * @author Sebastian Sdorra
  */
-public class RepositoryTestData
+public final class RepositoryTestData
 {
 
   /**
+   * Constructs ...
+   *
+   */
+  private RepositoryTestData() {}
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
    * Method description
    *
    *
   public static Repository createHappyVerticalPeopleTransporter()
   {
     return createHappyVerticalPeopleTransporter(
-        DummyRepositoryHandler.TYPE_NAME);
+      DummyRepositoryHandler.TYPE_NAME);
   }
 
   /**
 
     happyVerticalPeopleTransporter.setType(type);
     happyVerticalPeopleTransporter.setContact(
-        "zaphod.beeblebrox@hitchhiker.com");
+      "zaphod.beeblebrox@hitchhiker.com");
     happyVerticalPeopleTransporter.setName("happyVerticalPeopleTransporter");
     happyVerticalPeopleTransporter.setDescription(
-        "Happy Vertical People Transporter");
+      "Happy Vertical People Transporter");
     happyVerticalPeopleTransporter.setUrl(
-        "http://hitchhiker.com/dummy/HeartOfGold");
+      "http://hitchhiker.com/dummy/HeartOfGold");
 
     return happyVerticalPeopleTransporter;
   }
     heartOfGold.setContact("zaphod.beeblebrox@hitchhiker.com");
     heartOfGold.setName("HeartOfGold");
     heartOfGold.setDescription(
-        "Heart of Gold is the first prototype ship to successfully utilise the revolutionary Infinite Improbability Drive");
+      "Heart of Gold is the first prototype ship to successfully utilise the revolutionary Infinite Improbability Drive");
     heartOfGold.setUrl("http://hitchhiker.com/dummy/HeartOfGold");
 
     return heartOfGold;
   public static Repository createRestaurantAtTheEndOfTheUniverse()
   {
     return createRestaurantAtTheEndOfTheUniverse(
-        DummyRepositoryHandler.TYPE_NAME);
+      DummyRepositoryHandler.TYPE_NAME);
   }
 
   /**

scm-test/src/main/java/sonia/scm/repository/client/RepositoryClientFactory.java

  *
  * @author Sebastian Sdorra
  */
-public class RepositoryClientFactory
+public final class RepositoryClientFactory
 {
 
   /**
+   * Constructs ...
+   *
+   */
+  private RepositoryClientFactory() {}
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
    * Method description
    *
    *
    * @throws RepositoryClientException
    */
   public static RepositoryClient createClient(String type,
-          File localRepository, String remoteRepository)
-          throws RepositoryClientException
+    File localRepository, String remoteRepository)
+    throws RepositoryClientException
   {
     return createClient(type, localRepository, remoteRepository, null, null);
   }
    * @throws RepositoryClientException
    */
   public static RepositoryClient createClient(String type,
-          File localRepository, String remoteRepository, String username,
-          String password)
-          throws RepositoryClientException
+    File localRepository, String remoteRepository, String username,
+    String password)
+    throws RepositoryClientException
   {
     RepositoryClient client = null;
 
       if ("git".equals(type))
       {
         client = new GitRepositoryClient(localRepository, remoteRepository,
-                                         username, password);
+          username, password);
       }
       else if ("svn".equals(type))
       {
         client = new SvnRepositoryClient(localRepository, remoteRepository,
-                                         username, password);
+          username, password);
       }
       else if ("hg".equals(type))
       {
         client = new HgRepositoryClient(localRepository, remoteRepository,
-                                        username, password);
+          username, password);
       }
     }
     catch (Exception ex)

scm-test/src/main/java/sonia/scm/user/UserTestData.java

  *
  * @author Sebastian Sdorra
  */
-public class UserTestData
+public final class UserTestData
 {
 
   /**
+   * Constructs ...
+   *
+   */
+  private UserTestData() {}
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
    * Method description
    *
    *
   public static User createTrillian()
   {
     return new User("trillian", "Tricia McMillan",
-                    "tricia.mcmillan@hitchhiker.com");
+      "tricia.mcmillan@hitchhiker.com");
   }
 
   /**
   public static User createZaphod()
   {
     return new User("zaphod", "Zaphod Beeblebrox",
-                    "zaphod.beeblebrox@hitchhiker.com");
+      "zaphod.beeblebrox@hitchhiker.com");
   }
 }

scm-webapp/src/main/java/sonia/scm/plugin/ext/Extensions.java

  */
 
 
+
 package sonia.scm.plugin.ext;
 
 //~--- non-JDK imports --------------------------------------------------------
  *
  * @author Sebastian Sdorra
  */
-public class Extensions
+public final class Extensions
 {
 
   /**
+   * Constructs ...
+   *
+   */
+  private Extensions() {}
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
    * Method description
    *
    *

scm-webapp/src/main/java/sonia/scm/upgrade/ClientDateFormatConverter.java

  */
 
 
+
 package sonia.scm.upgrade;
 
 //~--- non-JDK imports --------------------------------------------------------
  *
  * @author Sebastian Sdorra
  */
-public class ClientDateFormatConverter
+public final class ClientDateFormatConverter
 {
 
   /** Field description */
   private static final Logger logger =
     LoggerFactory.getLogger(ClientDateFormatConverter.class);
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private ClientDateFormatConverter() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**
    * Documentations:
    * - Extjs: http://trac.geoext.org/browser/ext/3.4.0/docs/source/Date.html
-   * - Moments: http://momentjs.com/docs/#/displaying/format/
+   * - Moments: http://momentjs.com/docs/#/displaying/format
    *
    *
    * @param value
     result = replaceDateFormatChars(result, "T", "z");
 
     logger.debug(
-      "converted extjs date format \"{}\" to moments date format \"{}\"", value,
-      result);
+      "converted extjs date format \"{}\" to moments date format \"{}\"",
+      value, result);
 
     return result;
   }

scm-webapp/src/main/java/sonia/scm/user/UserEventHack.java

  */
 
 
+
 package sonia.scm.user;
 
 //~--- non-JDK imports --------------------------------------------------------
  *
  * @author Sebastian Sdorra
  */
-public class UserEventHack
+public final class UserEventHack
 {
 
   /**
   private static final Logger logger =
     LoggerFactory.getLogger(UserEventHack.class);
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private UserEventHack() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**

scm-webapp/src/main/java/sonia/scm/util/Decorators.java

  */
 
 
+
 package sonia.scm.util;
 
 //~--- non-JDK imports --------------------------------------------------------
  *
  * @author Sebastian Sdorra
  */
-public class Decorators
+public final class Decorators
 {
 
   /**
   private static final Logger logger =
     LoggerFactory.getLogger(Decorators.class);
 
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructs ...
+   *
+   */
+  private Decorators() {}
+
   //~--- methods --------------------------------------------------------------
 
   /**