mirror of https://github.com/apache/ant-ivy
tidy up the code
This commit is contained in:
parent
1b84f2ee7a
commit
12aeeec70f
|
|
@ -51,7 +51,7 @@ public class AntMessageLogger extends AbstractMessageLogger {
|
|||
&& ((AntMessageLogger) current).task instanceof Task) {
|
||||
Task currentTask = (Task) ((AntMessageLogger) current).task;
|
||||
|
||||
if ((currentTask.getTaskName() != null)
|
||||
if (currentTask.getTaskName() != null
|
||||
&& currentTask.getTaskName().equals(((Task) task).getTaskName())) {
|
||||
// The current AntMessageLogger already logs with the same
|
||||
// prefix as the given task. So we shouldn't do anything...
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class IvyConfigure extends Task {
|
|||
String settingsId = settings.getId();
|
||||
Object otherRef = getProject().getReference(settingsId);
|
||||
|
||||
if ((otherRef != null) && OVERRIDE_NOT_ALLOWED.equals(override)) {
|
||||
if (otherRef != null && OVERRIDE_NOT_ALLOWED.equals(override)) {
|
||||
throw new BuildException(
|
||||
"Overriding a previous definition of ivy:settings with the id '" + settingsId
|
||||
+ "' is not allowed when using override='" + OVERRIDE_NOT_ALLOWED
|
||||
|
|
|
|||
|
|
@ -262,7 +262,6 @@ public final class IvyPatternHelper {
|
|||
tokenSeen = false;
|
||||
tokenHadValue = false;
|
||||
break;
|
||||
|
||||
case ')':
|
||||
if (!insideOptionalPart || insideToken) {
|
||||
throw new IllegalArgumentException(
|
||||
|
|
@ -275,10 +274,8 @@ public final class IvyPatternHelper {
|
|||
} else if (!tokenSeen) {
|
||||
buffer.append('(').append(optionalPart.toString()).append(')');
|
||||
}
|
||||
|
||||
insideOptionalPart = false;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
if (insideToken) {
|
||||
throw new IllegalArgumentException("invalid start of token at position "
|
||||
|
|
@ -288,7 +285,6 @@ public final class IvyPatternHelper {
|
|||
tokenBuffer = new StringBuffer();
|
||||
insideToken = true;
|
||||
break;
|
||||
|
||||
case ']':
|
||||
if (!insideToken) {
|
||||
throw new IllegalArgumentException("invalid end of token at position " + i
|
||||
|
|
@ -298,7 +294,6 @@ public final class IvyPatternHelper {
|
|||
String token = tokenBuffer.toString();
|
||||
Object tokenValue = tokensCopy.get(token);
|
||||
String value = (tokenValue == null) ? null : tokenValue.toString();
|
||||
|
||||
if (insideOptionalPart) {
|
||||
tokenHadValue = !isNullOrEmpty(value);
|
||||
optionalPart.append(value);
|
||||
|
|
@ -308,11 +303,9 @@ public final class IvyPatternHelper {
|
|||
}
|
||||
buffer.append(value);
|
||||
}
|
||||
|
||||
insideToken = false;
|
||||
tokenSeen = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (insideToken) {
|
||||
tokenBuffer.append(ch);
|
||||
|
|
|
|||
|
|
@ -1564,7 +1564,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
|||
}
|
||||
|
||||
public void restore() throws IOException {
|
||||
if ((backup != null) && backup.exists()) {
|
||||
if (backup != null && backup.exists()) {
|
||||
File original = new File(originalPath);
|
||||
FileUtil.copy(backup, original, null, true);
|
||||
backup.delete();
|
||||
|
|
@ -1572,7 +1572,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
|||
}
|
||||
|
||||
public void cleanUp() {
|
||||
if ((backup != null) && backup.exists()) {
|
||||
if (backup != null && backup.exists()) {
|
||||
backup.delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
|
|||
}
|
||||
|
||||
public void addDependencyConfiguration(String masterConf, String depConf) {
|
||||
if ((md != null) && !"*".equals(masterConf) && !"%".equals(masterConf)) {
|
||||
if (md != null && !"*".equals(masterConf) && !"%".equals(masterConf)) {
|
||||
Configuration config;
|
||||
if (masterConf.startsWith("!")) {
|
||||
config = md.getConfiguration(masterConf.substring(1));
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ public class OverrideDependencyDescriptorMediator implements DependencyDescripto
|
|||
return dd;
|
||||
}
|
||||
|
||||
String version = this.version == null ? mrid.getRevision() : this.version;
|
||||
String branch = this.branch == null ? mrid.getBranch() : this.branch;
|
||||
String version = (this.version == null) ? mrid.getRevision() : this.version;
|
||||
String branch = (this.branch == null) ? mrid.getBranch() : this.branch;
|
||||
|
||||
// if this is a noop, do not construct any new object
|
||||
if (version.equals(dd.getDependencyRevisionId().getRevision())
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
|||
}
|
||||
String defaultConf = getDefaultConf(conf);
|
||||
conf = getMainConf(conf);
|
||||
if ((md.getConfiguration(conf) == null)
|
||||
if (md.getConfiguration(conf) == null
|
||||
|| PRIVATE.equals(md.getConfiguration(conf).getVisibility())) {
|
||||
if ("".equals(defaultConf)) {
|
||||
return new String[0];
|
||||
|
|
@ -821,7 +821,7 @@ public class IvyNode implements Comparable<IvyNode> {
|
|||
}
|
||||
|
||||
if ((dependencyArtifacts == null || dependencyArtifacts.isEmpty())
|
||||
&& (includes.isEmpty())) {
|
||||
&& includes.isEmpty()) {
|
||||
// no artifacts / includes: we get all artifacts as defined by the descriptor
|
||||
for (String conf : confs) {
|
||||
artifacts.addAll(Arrays.asList(md.getArtifacts(conf)));
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class IvyVariableContainerImpl implements IvyVariableContainer {
|
|||
}
|
||||
|
||||
public void setEnvironmentPrefix(String prefix) {
|
||||
if ((prefix != null) && !prefix.endsWith(".")) {
|
||||
if (prefix != null && !prefix.endsWith(".")) {
|
||||
this.envPrefix = prefix + ".";
|
||||
} else {
|
||||
this.envPrefix = prefix;
|
||||
|
|
@ -79,7 +79,7 @@ public class IvyVariableContainerImpl implements IvyVariableContainer {
|
|||
*/
|
||||
public String getVariable(String name) {
|
||||
String val = null;
|
||||
if ((envPrefix != null) && name.startsWith(envPrefix)) {
|
||||
if (envPrefix != null && name.startsWith(envPrefix)) {
|
||||
val = System.getenv(name.substring(envPrefix.length()));
|
||||
} else {
|
||||
val = variables.get(name);
|
||||
|
|
|
|||
|
|
@ -264,7 +264,6 @@ public class ManifestHeaderValue {
|
|||
switch (readNext()) {
|
||||
case '\0':
|
||||
break;
|
||||
|
||||
case ',':
|
||||
case ';':
|
||||
endParameterValue();
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ public class LatestRevisionStrategy extends ComparatorLatestStrategy {
|
|||
Integer sm1 = specialMeanings.get(parts1[i].toLowerCase(Locale.US));
|
||||
Integer sm2 = specialMeanings.get(parts2[i].toLowerCase(Locale.US));
|
||||
if (sm1 != null) {
|
||||
sm2 = sm2 == null ? new Integer(0) : sm2;
|
||||
if (sm2 == null) {
|
||||
sm2 = new Integer(0);
|
||||
}
|
||||
return sm1.compareTo(sm2);
|
||||
}
|
||||
if (sm2 != null) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class MapMatcher {
|
|||
for (Map.Entry<String, Matcher> entry : matchers.entrySet()) {
|
||||
Matcher matcher = entry.getValue();
|
||||
String value = m.get(entry.getKey());
|
||||
if ((value == null) || !matcher.matches(value)) {
|
||||
if (value == null || !matcher.matches(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ public class PomModuleDescriptorBuilder {
|
|||
mrid = ModuleRevisionId.newInstance(groupId, artifactId, version);
|
||||
ivyModuleDescriptor.setModuleRevisionId(mrid);
|
||||
|
||||
if ((version == null) || version.endsWith("SNAPSHOT")) {
|
||||
if (version == null || version.endsWith("SNAPSHOT")) {
|
||||
ivyModuleDescriptor.setStatus("integration");
|
||||
} else {
|
||||
ivyModuleDescriptor.setStatus("release");
|
||||
|
|
@ -305,8 +305,7 @@ public class PomModuleDescriptorBuilder {
|
|||
ConfMapper mapping = MAVEN2_CONF_MAPPING.get(scope);
|
||||
mapping.addMappingConfs(dd, dep.isOptional());
|
||||
Map<String, String> extraAtt = new HashMap<>();
|
||||
if ((dep.getClassifier() != null)
|
||||
|| (dep.getType() != null && !"jar".equals(dep.getType()))) {
|
||||
if (dep.getClassifier() != null || dep.getType() != null && !"jar".equals(dep.getType())) {
|
||||
String type = "jar";
|
||||
if (dep.getType() != null) {
|
||||
type = dep.getType();
|
||||
|
|
@ -373,7 +372,7 @@ public class PomModuleDescriptorBuilder {
|
|||
// https://repo1.maven.org/maven2/com/atomikos/atomikos-util/3.6.4/atomikos-util-3.6.4.pom
|
||||
ModuleId dependencyId = descriptor.getDependencyId();
|
||||
ModuleRevisionId mRevId = ivyModuleDescriptor.getModuleRevisionId();
|
||||
if ((mRevId != null) && mRevId.getModuleId().equals(dependencyId)) {
|
||||
if (mRevId != null && mRevId.getModuleId().equals(dependencyId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -494,7 +493,7 @@ public class PomModuleDescriptorBuilder {
|
|||
String key = getDependencyMgtExtraInfoKeyForScope(dep.getGroupId(), dep.getArtifactId());
|
||||
result = ivyModuleDescriptor.getExtraInfoContentByTagName(key);
|
||||
}
|
||||
if ((result == null) || !MAVEN2_CONF_MAPPING.containsKey(result)) {
|
||||
if (result == null || !MAVEN2_CONF_MAPPING.containsKey(result)) {
|
||||
result = "compile";
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ public final class PomModuleDescriptorWriter {
|
|||
List<DependencyDescriptor> result = new ArrayList<>();
|
||||
for (DependencyDescriptor dd : md.getDependencies()) {
|
||||
String[] depConfs = dd.getDependencyConfigurations(confs);
|
||||
if ((depConfs != null) && (depConfs.length > 0)) {
|
||||
if (depConfs != null && depConfs.length > 0) {
|
||||
result.add(dd);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ public class PomReader {
|
|||
Document pomDomDoc = XMLHelper.parseToDom(source, new EntityResolver() {
|
||||
public InputSource resolveEntity(String publicId, String systemId)
|
||||
throws SAXException, IOException {
|
||||
if ((systemId != null) && systemId.endsWith("m2-entities.ent")) {
|
||||
if (systemId != null && systemId.endsWith("m2-entities.ent")) {
|
||||
return new InputSource(
|
||||
PomReader.class.getResourceAsStream("m2-entities.ent"));
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ public class PomReader {
|
|||
String name = getFirstChildText(license, LICENSE_NAME);
|
||||
String url = getFirstChildText(license, LICENSE_URL);
|
||||
|
||||
if ((name == null) && (url == null)) {
|
||||
if (name == null && url == null) {
|
||||
// move to next license
|
||||
continue;
|
||||
}
|
||||
|
|
@ -287,11 +287,17 @@ public class PomReader {
|
|||
return null;
|
||||
} else {
|
||||
String relocGroupId = getFirstChildText(relocation, GROUP_ID);
|
||||
if (relocGroupId == null) {
|
||||
relocGroupId = getGroupId();
|
||||
}
|
||||
String relocArtId = getFirstChildText(relocation, ARTIFACT_ID);
|
||||
if (relocArtId == null) {
|
||||
relocArtId = getArtifactId();
|
||||
}
|
||||
String relocVersion = getFirstChildText(relocation, VERSION);
|
||||
relocGroupId = relocGroupId == null ? getGroupId() : relocGroupId;
|
||||
relocArtId = relocArtId == null ? getArtifactId() : relocArtId;
|
||||
relocVersion = relocVersion == null ? getVersion() : relocVersion;
|
||||
if (relocVersion == null) {
|
||||
relocVersion = getVersion();
|
||||
}
|
||||
return ModuleRevisionId.newInstance(relocGroupId, relocArtId, relocVersion);
|
||||
}
|
||||
}
|
||||
|
|
@ -408,7 +414,7 @@ public class PomReader {
|
|||
if (node instanceof Element && EXCLUSION.equals(node.getNodeName())) {
|
||||
String groupId = getFirstChildText((Element) node, GROUP_ID);
|
||||
String artifactId = getFirstChildText((Element) node, ARTIFACT_ID);
|
||||
if ((groupId != null) && (artifactId != null)) {
|
||||
if (groupId != null && artifactId != null) {
|
||||
exclusions.add(ModuleId.newInstance(groupId, artifactId));
|
||||
}
|
||||
}
|
||||
|
|
@ -719,8 +725,8 @@ public class PomReader {
|
|||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
} else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length)
|
||||
|| ((off + len) < 0)) {
|
||||
} else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length
|
||||
|| (off + len) < 0) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
} else if (len == 0) {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
|
|||
} else if ("mapped".equals(qName)) {
|
||||
dd.addDependencyConfiguration(conf,
|
||||
settings.substitute(attributes.getValue("name")));
|
||||
} else if (("conflict".equals(qName) && state == State.DEPS)
|
||||
} else if ("conflict".equals(qName) && state == State.DEPS
|
||||
|| "manager".equals(qName) && state == State.CONFLICT) {
|
||||
managerStarted(attributes, state == State.CONFLICT ? "name" : "manager");
|
||||
} else if ("override".equals(qName) && state == State.DEPS) {
|
||||
|
|
@ -922,7 +922,7 @@ public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
|
|||
ModuleRevisionId revId = ModuleRevisionId.newInstance(org, name, branch, rev,
|
||||
extraAttributes);
|
||||
ModuleRevisionId dynamicId = null;
|
||||
if ((revConstraint == null) && (branchConstraint == null)) {
|
||||
if (revConstraint == null && branchConstraint == null) {
|
||||
// no dynamic constraints defined, so dynamicId equals revId
|
||||
dynamicId = ModuleRevisionId.newInstance(org, name, branch, rev, extraAttributes,
|
||||
false);
|
||||
|
|
@ -1223,9 +1223,9 @@ public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
|
|||
}
|
||||
} else if ("configurations".equals(qName)) {
|
||||
checkConfigurations();
|
||||
} else if ((state == State.DEP_ARTIFACT && "artifact".equals(qName))
|
||||
|| (state == State.ARTIFACT_INCLUDE && "include".equals(qName))
|
||||
|| (state == State.ARTIFACT_EXCLUDE && "exclude".equals(qName))) {
|
||||
} else if (state == State.DEP_ARTIFACT && "artifact".equals(qName)
|
||||
|| state == State.ARTIFACT_INCLUDE && "include".equals(qName)
|
||||
|| state == State.ARTIFACT_EXCLUDE && "exclude".equals(qName)) {
|
||||
state = State.DEP;
|
||||
if (confAware.getConfigurations().length == 0) {
|
||||
for (String config : getMd().getConfigurationsNames()) {
|
||||
|
|
|
|||
|
|
@ -433,6 +433,12 @@ public final class XmlModuleDescriptorUpdater {
|
|||
String value = null;
|
||||
|
||||
switch (name) {
|
||||
case "organisation":
|
||||
value = org;
|
||||
break;
|
||||
case "module":
|
||||
value = module;
|
||||
break;
|
||||
case "revision":
|
||||
// replace inline revision with resolved parent revision
|
||||
ModuleDescriptor merged = options.getMergedDescriptor();
|
||||
|
|
@ -451,12 +457,6 @@ public final class XmlModuleDescriptorUpdater {
|
|||
value = substitute(settings, attributes.getValue(i));
|
||||
}
|
||||
break;
|
||||
case "organisation":
|
||||
value = org;
|
||||
break;
|
||||
case "module":
|
||||
value = module;
|
||||
break;
|
||||
default:
|
||||
value = substitute(settings, attributes.getValue(i));
|
||||
break;
|
||||
|
|
@ -554,7 +554,9 @@ public final class XmlModuleDescriptorUpdater {
|
|||
String module = substitute(settings, attributes.getValue("name"));
|
||||
String branch = substitute(settings, attributes.getValue("branch"));
|
||||
String branchConstraint = substitute(settings, attributes.getValue("branchConstraint"));
|
||||
branchConstraint = branchConstraint == null ? branch : branchConstraint;
|
||||
if (branchConstraint == null) {
|
||||
branchConstraint = branch;
|
||||
}
|
||||
|
||||
// look for the branch used in resolved revisions
|
||||
if (branch == null) {
|
||||
|
|
@ -576,7 +578,7 @@ public final class XmlModuleDescriptorUpdater {
|
|||
XmlModuleDescriptorParser.DEPENDENCY_REGULAR_ATTRIBUTES);
|
||||
ModuleRevisionId localMrid = ModuleRevisionId.newInstance(org, module, branch,
|
||||
revision, extraAttributes);
|
||||
ModuleRevisionId systemMrid = ns == null ? localMrid : ns.getToSystemTransformer()
|
||||
ModuleRevisionId systemMrid = (ns == null) ? localMrid : ns.getToSystemTransformer()
|
||||
.transform(localMrid);
|
||||
|
||||
String newBranch = resolvedBranches.get(systemMrid);
|
||||
|
|
@ -584,6 +586,12 @@ public final class XmlModuleDescriptorUpdater {
|
|||
for (int i = 0; i < attributes.getLength(); i++) {
|
||||
String attName = attributes.getQName(i);
|
||||
switch (attName) {
|
||||
case "org":
|
||||
write(" org=\"" + systemMrid.getOrganisation() + "\"");
|
||||
break;
|
||||
case "name":
|
||||
write(" name=\"" + systemMrid.getName() + "\"");
|
||||
break;
|
||||
case "rev":
|
||||
String rev = resolvedRevisions.get(systemMrid);
|
||||
if (rev == null) {
|
||||
|
|
@ -603,12 +611,6 @@ public final class XmlModuleDescriptorUpdater {
|
|||
case "revConstraint":
|
||||
write(" revConstraint=\"" + revisionConstraint + "\"");
|
||||
break;
|
||||
case "org":
|
||||
write(" org=\"" + systemMrid.getOrganisation() + "\"");
|
||||
break;
|
||||
case "name":
|
||||
write(" name=\"" + systemMrid.getName() + "\"");
|
||||
break;
|
||||
case "branch":
|
||||
if (newBranch != null) {
|
||||
write(" branch=\"" + newBranch + "\"");
|
||||
|
|
|
|||
|
|
@ -203,12 +203,9 @@ public class TransferEvent extends IvyEvent {
|
|||
*/
|
||||
protected void setRequestType(final int requestType) {
|
||||
switch (requestType) {
|
||||
|
||||
case REQUEST_PUT:
|
||||
break;
|
||||
case REQUEST_GET:
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("Illegal request type: " + requestType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ public class Scp {
|
|||
throw new RemoteScpException("Remote scp terminated unexpectedly.");
|
||||
}
|
||||
|
||||
if ((c != 1) && (c != 2)) {
|
||||
if (c != 1 && c != 2) {
|
||||
throw new RemoteScpException("Remote scp sent illegal error code.");
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ public class Scp {
|
|||
"Malformed C line sent by remote SCP binary, line too short.");
|
||||
}
|
||||
|
||||
if ((line.charAt(CLINE_SPACE_INDEX1) != ' ') || (line.charAt(CLINE_SPACE_INDEX2) == ' ')) {
|
||||
if (line.charAt(CLINE_SPACE_INDEX1) != ' ' || line.charAt(CLINE_SPACE_INDEX2) == ' ') {
|
||||
throw new RemoteScpException("Malformed C line sent by remote SCP binary.");
|
||||
}
|
||||
|
||||
|
|
@ -201,11 +201,11 @@ public class Scp {
|
|||
String lengthSubstring = line.substring(CLINE_SPACE_INDEX2, lengthNameSep);
|
||||
String nameSubstring = line.substring(lengthNameSep + 1);
|
||||
|
||||
if ((lengthSubstring.length() <= 0) || (nameSubstring.length() <= 0)) {
|
||||
if (lengthSubstring.length() <= 0 || nameSubstring.length() <= 0) {
|
||||
throw new RemoteScpException("Malformed C line sent by remote SCP binary.");
|
||||
}
|
||||
|
||||
if ((CLINE_SPACE_INDEX2 + 1 + lengthSubstring.length() + nameSubstring.length()) != line
|
||||
if (CLINE_SPACE_INDEX2 + 1 + lengthSubstring.length() + nameSubstring.length() != line
|
||||
.length()) {
|
||||
throw new RemoteScpException("Malformed C line sent by remote SCP binary.");
|
||||
}
|
||||
|
|
@ -387,7 +387,7 @@ public class Scp {
|
|||
os.flush();
|
||||
continue;
|
||||
}
|
||||
if ((c == 1) || (c == 2)) {
|
||||
if (c == 1 || c == 2) {
|
||||
throw new RemoteScpException("Remote SCP error: " + line);
|
||||
}
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ public class Scp {
|
|||
throws IOException, RemoteScpException {
|
||||
ChannelExec channel = null;
|
||||
|
||||
if ((localFile == null) || (remoteTargetName == null)) {
|
||||
if (localFile == null || remoteTargetName == null) {
|
||||
throw new IllegalArgumentException("Null argument.");
|
||||
}
|
||||
|
||||
|
|
@ -544,7 +544,7 @@ public class Scp {
|
|||
RemoteScpException {
|
||||
ChannelExec channel = null;
|
||||
|
||||
if ((remoteFile == null) || (localTarget == null)) {
|
||||
if (remoteFile == null || localTarget == null) {
|
||||
throw new IllegalArgumentException("Null argument.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ public class VsftpRepository extends AbstractRepository {
|
|||
private Ivy ivy = null;
|
||||
|
||||
public VsftpRepository() {
|
||||
|
||||
}
|
||||
|
||||
public VsftpRepository(final TimeoutConstraint timeoutConstraint) {
|
||||
|
|
@ -161,9 +160,9 @@ public class VsftpRepository extends AbstractRepository {
|
|||
}
|
||||
|
||||
int index = source.lastIndexOf('/');
|
||||
String srcName = index == -1 ? source : source.substring(index + 1);
|
||||
final File to = destDir == null ? Checks.checkAbsolute(srcName, "source") : new File(
|
||||
destDir, srcName);
|
||||
String srcName = (index == -1) ? source : source.substring(index + 1);
|
||||
final File to = (destDir == null) ? Checks.checkAbsolute(srcName, "source")
|
||||
: new File(destDir, srcName);
|
||||
|
||||
final IOException[] ex = new IOException[1];
|
||||
Thread get = new IvyThread() {
|
||||
|
|
@ -516,8 +515,8 @@ public class VsftpRepository extends AbstractRepository {
|
|||
sleep(sleep);
|
||||
sleep = reuseConnection
|
||||
- (System.currentTimeMillis() - lastCommand);
|
||||
if (inCommand) {
|
||||
sleep = sleep <= 0 ? reuseConnection : sleep;
|
||||
if (inCommand && sleep <= 0) {
|
||||
sleep = reuseConnection;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public abstract class AbstractPatternsBasedResolver extends BasicResolver {
|
|||
for (String pattern : patternList) {
|
||||
ResolvedResource rres = findResourceUsingPattern(moduleRevision, pattern, artifact,
|
||||
rmdparser, date);
|
||||
if ((rres != null) && !foundRevisions.contains(rres.getRevision())) {
|
||||
if (rres != null && !foundRevisions.contains(rres.getRevision())) {
|
||||
// only add the first found ResolvedResource for each revision
|
||||
foundRevisions.add(rres.getRevision());
|
||||
resolvedResources.add(rres);
|
||||
|
|
@ -212,7 +212,7 @@ public abstract class AbstractPatternsBasedResolver extends BasicResolver {
|
|||
|
||||
String partiallyResolvedPattern = IvyPatternHelper.substituteTokens(pattern, tokenValues);
|
||||
String token = IvyPatternHelper.getFirstToken(partiallyResolvedPattern);
|
||||
if ((token == null) && exist(partiallyResolvedPattern)) {
|
||||
if (token == null && exist(partiallyResolvedPattern)) {
|
||||
// no more tokens to resolve
|
||||
result.add(tokenValues);
|
||||
return result;
|
||||
|
|
@ -235,7 +235,7 @@ public abstract class AbstractPatternsBasedResolver extends BasicResolver {
|
|||
filterNames(valueList);
|
||||
|
||||
for (String value : valueList) {
|
||||
if ((matcher != null) && !matcher.matches(value)) {
|
||||
if (matcher != null && !matcher.matches(value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public final class ResolverHelper {
|
|||
+ ": token not found in pattern");
|
||||
return null;
|
||||
}
|
||||
if (((pattern.length() <= index + tokenString.length()) || fileSep.equals(pattern
|
||||
if ((pattern.length() <= index + tokenString.length() || fileSep.equals(pattern
|
||||
.substring(index + tokenString.length(), index + tokenString.length() + 1)))
|
||||
&& (index == 0 || fileSep.equals(pattern.substring(index - 1, index)))) {
|
||||
// the searched token is a whole name
|
||||
|
|
@ -247,7 +247,7 @@ public final class ResolverHelper {
|
|||
+ ": token not found in pattern");
|
||||
return null;
|
||||
}
|
||||
if (((pattern.length() <= index + tokenString.length()) || "/".equals(pattern
|
||||
if ((pattern.length() <= index + tokenString.length() || "/".equals(pattern
|
||||
.substring(index + tokenString.length(), index + tokenString.length() + 1)))
|
||||
&& (index == 0 || "/".equals(pattern.substring(index - 1, index)))) {
|
||||
// the searched token is a whole name
|
||||
|
|
|
|||
|
|
@ -156,11 +156,10 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator {
|
|||
Iterator<PGPSecretKey> it2 = kRing.getSecretKeys();
|
||||
while (key == null && it2.hasNext()) {
|
||||
PGPSecretKey k = it2.next();
|
||||
if ((keyId == null) && k.isSigningKey()) {
|
||||
if (keyId == null && k.isSigningKey()) {
|
||||
key = k;
|
||||
}
|
||||
if ((keyId != null)
|
||||
&& (Long.valueOf(keyId, 16) == (k.getKeyID() & MASK))) {
|
||||
if (keyId != null && Long.valueOf(keyId, 16) == (k.getKeyID() & MASK)) {
|
||||
key = k;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,9 +137,9 @@ public class MavenTimedSnapshotVersionMatcher extends AbstractVersionMatcher {
|
|||
|
||||
/**
|
||||
* Returns the "base" revision that this {@link MavenSnapshotRevision} represents. For
|
||||
* example, for the regular snapshot revision {@link 1.2.3-SNAPSHOT}, the base revision
|
||||
* example, for the regular snapshot revision {@code 1.2.3-SNAPSHOT}, the base revision
|
||||
* is {@code 1.2.3}. Similarly for timestamped snapshot version
|
||||
* {@code 1.0.2-20100925.223013-19}, the base revision is {@link 1.0.2}
|
||||
* {@code 1.0.2-20100925.223013-19}, the base revision is {@code 1.0.2}
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -159,10 +159,6 @@ public abstract class AbstractURLHandler implements URLHandler {
|
|||
}
|
||||
InputStream result = null;
|
||||
switch (encoding) {
|
||||
case "gzip":
|
||||
case "x-gzip":
|
||||
result = new GZIPInputStream(in);
|
||||
break;
|
||||
case "deflate":
|
||||
// There seems to be 2 variants of the "deflate"-encoding.
|
||||
// I couldn't find a way to auto-detect which variant was
|
||||
|
|
@ -190,6 +186,10 @@ public abstract class AbstractURLHandler implements URLHandler {
|
|||
inflater.end();
|
||||
}
|
||||
break;
|
||||
case "gzip":
|
||||
case "x-gzip":
|
||||
result = new GZIPInputStream(in);
|
||||
break;
|
||||
default:
|
||||
result = in;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class ApacheURLLister {
|
|||
String href = matcher.group(1);
|
||||
String text = matcher.group(2);
|
||||
|
||||
if ((href == null) || (text == null)) {
|
||||
if (href == null || text == null) {
|
||||
// the groups were not found (shouldn't happen, really)
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,12 +168,14 @@ public class IvyMakePomTest {
|
|||
optional = nextChild.getTextContent();
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unexpected child element " + nextChild.getNodeName() + " under dependency element");
|
||||
throw new RuntimeException("Unexpected child element "
|
||||
+ nextChild.getNodeName() + " under dependency element");
|
||||
}
|
||||
// move to next sibling
|
||||
nextChild = nextChild.getNextSibling();
|
||||
}
|
||||
return new PomDependency(groupId, artifactId, version, scope, classifier, optional != null && Boolean.parseBoolean(optional));
|
||||
return new PomDependency(groupId, artifactId, version, scope, classifier,
|
||||
optional != null && Boolean.parseBoolean(optional));
|
||||
}
|
||||
|
||||
private static Node skipIfTextNode(final Node node) {
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class ManifestHeaderTest {
|
|||
@Rule
|
||||
public ExpectedException expExc = ExpectedException.none();
|
||||
|
||||
@Parameterized.Parameters(name = "illegal token at {1} in {0}")
|
||||
@Parameterized.Parameters(name = "Illegal token at {1} in {0}")
|
||||
public static Collection<Object[]> data() {
|
||||
return Arrays.asList(new Object[][] {{"value1=", 6},
|
||||
{"value1;version=1;value2", 22}, {"value1;version=", 14},
|
||||
|
|
|
|||
|
|
@ -199,9 +199,6 @@ public class LatestConflictManagerTest {
|
|||
case "A":
|
||||
assertEquals("A revision should be 1.0.0", "1.0.0", mrid.getRevision());
|
||||
break;
|
||||
case "D":
|
||||
assertEquals("D revision should be 1.0.0", "1.0.0", mrid.getRevision());
|
||||
break;
|
||||
case "B":
|
||||
// by transitivity
|
||||
assertEquals("B revision should be 1.0.0", "1.0.0", mrid.getRevision());
|
||||
|
|
@ -209,6 +206,9 @@ public class LatestConflictManagerTest {
|
|||
case "C":
|
||||
assertEquals("C revision should be 1.0.2", "1.0.2", mrid.getRevision());
|
||||
break;
|
||||
case "D":
|
||||
assertEquals("D revision should be 1.0.0", "1.0.0", mrid.getRevision());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ import static org.hamcrest.Matchers.endsWith;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Test {@link HttpClientHandler}
|
||||
|
|
|
|||
Loading…
Reference in New Issue