Commits

Sebastian Sdorra committed b9576b8

fix some potential bugs

  • Participants
  • Parent commits aea7af2

Comments (0)

Files changed (11)

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

    * Method description
    *
    *
+   * @param obj
+   *
+   * @return
+   */
+  @Override
+  public boolean equals(Object obj)
+  {
+    if (obj == null)
+    {
+      return false;
+    }
+
+    if (getClass() != obj.getClass())
+    {
+      return false;
+    }
+
+    final PluginVersion other = (PluginVersion) obj;
+
+    if (this.maintenance != other.maintenance)
+    {
+      return false;
+    }
+
+    if (this.major != other.major)
+    {
+      return false;
+    }
+
+    if (this.minor != other.minor)
+    {
+      return false;
+    }
+
+    if ((this.parsedVersion == null)
+        ? (other.parsedVersion != null)
+        : !this.parsedVersion.equals(other.parsedVersion))
+    {
+      return false;
+    }
+
+    if (this.snapshot != other.snapshot)
+    {
+      return false;
+    }
+
+    if (this.type != other.type)
+    {
+      return false;
+    }
+
+    if (this.typeVersion != other.typeVersion)
+    {
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  @Override
+  public int hashCode()
+  {
+    int hash = 5;
+
+    hash = 61 * hash + this.maintenance;
+    hash = 61 * hash + this.major;
+    hash = 61 * hash + this.minor;
+    hash = 61 * hash + ((this.parsedVersion != null)
+                        ? this.parsedVersion.hashCode()
+                        : 0);
+    hash = 61 * hash + (this.snapshot
+                        ? 1
+                        : 0);
+    hash = 61 * hash + ((this.type != null)
+                        ? this.type.hashCode()
+                        : 0);
+    hash = 61 * hash + this.typeVersion;
+
+    return hash;
+  }
+
+  /**
+   * Method description
+   *
+   *
    * @return
    */
   @Override

scm-core/src/main/java/sonia/scm/repository/AbstractSimpleRepositoryHandler.java

 import org.slf4j.LoggerFactory;
 
 import sonia.scm.ConfigurationException;
-import sonia.scm.SCMContextProvider;
 import sonia.scm.io.CommandResult;
 import sonia.scm.io.ExtendedCommand;
 import sonia.scm.io.FileSystem;
   /**
    * Method description
    *
-   *
-   * @param context
-   */
-  @Override
-  public void init(SCMContextProvider context)
-  {
-    super.init(context);
-  }
-
-  /**
-   * Method description
-   *
    */
   @Override
   public void loadConfig()

scm-core/src/main/java/sonia/scm/repository/PermissionUtil.java

     {
       String name = p.getName();
 
-      if ((name != null) && (p.getType().getValue() >= pt.getValue()))
+      if (((name != null) && (p.getType().getValue() >= pt.getValue()))
+          && (name.equals(username)
+              || (p.isGroupPermission() && groups.contains(p.getName()))))
       {
-        if (name.equals(username)
-            || (p.isGroupPermission() && groups.contains(p.getName())))
-        {
-          result = true;
+        result = true;
 
-          break;
-        }
+        break;
       }
     }
 

scm-core/src/main/java/sonia/scm/resources/ResourceHandlerComparator.java

 
 //~--- JDK imports ------------------------------------------------------------
 
+import java.io.Serializable;
+
 import java.util.Comparator;
 
 /**
  *
  * @author Sebastian Sdorra
  */
-public class ResourceHandlerComparator implements Comparator<ResourceHandler>
+public class ResourceHandlerComparator
+        implements Comparator<ResourceHandler>, Serializable
 {
 
+  /** Field description */
+  private static final long serialVersionUID = -1760229246326556762L;
+
+  //~--- methods --------------------------------------------------------------
+
   /**
    * Method description
    *

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

 {
 
   /** Field description */
-  public static final String DEFAULT_CHECKPARAMETER = "--version";
+  private static final String DEFAULT_CHECKPARAMETER = "--version";
 
   /** Field description */
-  public static final String[] DEFAULT_PATH = new String[]
+  private static final String[] DEFAULT_PATH = new String[]
   {
 
     // default path
         cmdPath = cmd;
       }
     }
-    catch (IOException ex) {}
+    catch (IOException ex)
+    {
+      if (logger.isTraceEnabled())
+      {
+        logger.trace("could not execute command", ex);
+      }
+    }
 
     if (cmdPath == null)
     {

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

 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 
 import java.util.Enumeration;
 

scm-webapp/src/main/java/sonia/scm/BindingExtensionProcessor.java

           binder.bind(extensionClass);
         }
       }
-      catch (Exception ex)
+      catch (IllegalAccessException ex)
+      {
+        logger.error(ex.getMessage(), ex);
+      }
+      catch (InstantiationException ex)
       {
         logger.error(ex.getMessage(), ex);
       }

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

 import sonia.scm.plugin.DefaultPluginManager;
 import sonia.scm.plugin.OverviewPluginFilter;
 import sonia.scm.plugin.PluginInformation;
-import sonia.scm.util.Util;
 
 //~--- JDK imports ------------------------------------------------------------
 

scm-webapp/src/main/java/sonia/scm/group/xml/XmlGroupManager.java

 
 import java.util.Collection;
 import java.util.LinkedList;
-import java.util.Set;
 
 /**
  *

scm-webapp/src/main/java/sonia/scm/plugin/AetherPluginHandler.java

     List<Dependency> dependencies = getInstalledDependencies(null);
 
     collectDependencies(dependency, dependencies);
-
-    
   }
 
   /**
       {
         String id = plugin.getId();
 
-        if ((skipId == null) ||!id.equals(skipId))
+        if (Util.isNotEmpty(id) && ((skipId == null) ||!id.equals(skipId)))
         {
-          if (Util.isNotEmpty(id))
-          {
-            dependencies.add(new Dependency(new DefaultArtifact(id),
-                                            PLUGIN_SCOPE));
-          }
+          dependencies.add(new Dependency(new DefaultArtifact(id),
+                                          PLUGIN_SCOPE));
         }
       }
     }

scm-webapp/src/main/java/sonia/scm/plugin/OverviewPluginFilter.java

 {
 
   /** Field description */
-  public static OverviewPluginFilter INSTANCE = new OverviewPluginFilter();
+  public static final OverviewPluginFilter INSTANCE =
+    new OverviewPluginFilter();
 
   //~--- methods --------------------------------------------------------------