mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
fix some potential bugs
This commit is contained in:
@@ -176,6 +176,97 @@ public class PluginVersion implements Comparable<PluginVersion>
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.slf4j.Logger;
|
||||
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;
|
||||
@@ -155,18 +154,6 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void init(SCMContextProvider context)
|
||||
{
|
||||
super.init(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -163,17 +163,15 @@ public class PermissionUtil
|
||||
{
|
||||
String name = p.getName();
|
||||
|
||||
if ((name != null) && (p.getType().getValue() >= pt.getValue()))
|
||||
{
|
||||
if (name.equals(username)
|
||||
|| (p.isGroupPermission() && groups.contains(p.getName())))
|
||||
if (((name != null) && (p.getType().getValue() >= pt.getValue()))
|
||||
&& (name.equals(username)
|
||||
|| (p.isGroupPermission() && groups.contains(p.getName()))))
|
||||
{
|
||||
result = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -39,15 +39,23 @@ import sonia.scm.util.Util;
|
||||
|
||||
//~--- 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
|
||||
*
|
||||
|
||||
@@ -66,10 +66,10 @@ public class IOUtil
|
||||
{
|
||||
|
||||
/** 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
|
||||
@@ -336,7 +336,13 @@ public class IOUtil
|
||||
cmdPath = cmd;
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {}
|
||||
catch (IOException ex)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("could not execute command", ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (cmdPath == null)
|
||||
{
|
||||
|
||||
@@ -47,9 +47,7 @@ import sonia.scm.util.Util;
|
||||
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;
|
||||
|
||||
|
||||
@@ -208,7 +208,11 @@ public class BindingExtensionProcessor implements ExtensionProcessor
|
||||
binder.bind(extensionClass);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (IllegalAccessException ex)
|
||||
{
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
catch (InstantiationException ex)
|
||||
{
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.google.inject.Singleton;
|
||||
import sonia.scm.plugin.DefaultPluginManager;
|
||||
import sonia.scm.plugin.OverviewPluginFilter;
|
||||
import sonia.scm.plugin.PluginInformation;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ import java.io.IOException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -167,8 +167,6 @@ public class AetherPluginHandler
|
||||
List<Dependency> dependencies = getInstalledDependencies(null);
|
||||
|
||||
collectDependencies(dependency, dependencies);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,16 +362,13 @@ public class AetherPluginHandler
|
||||
{
|
||||
String id = plugin.getId();
|
||||
|
||||
if ((skipId == null) ||!id.equals(skipId))
|
||||
{
|
||||
if (Util.isNotEmpty(id))
|
||||
if (Util.isNotEmpty(id) && ((skipId == null) ||!id.equals(skipId)))
|
||||
{
|
||||
dependencies.add(new Dependency(new DefaultArtifact(id),
|
||||
PLUGIN_SCOPE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ public class OverviewPluginFilter implements PluginFilter
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static OverviewPluginFilter INSTANCE = new OverviewPluginFilter();
|
||||
public static final OverviewPluginFilter INSTANCE =
|
||||
new OverviewPluginFilter();
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user