You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2017/12/05 11:41:35 UTC

ant-ivy git commit: tersify logic ;->

Repository: ant-ivy
Updated Branches:
  refs/heads/master a12365084 -> 14bdf34a9


tersify logic ;->

Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/14bdf34a
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/14bdf34a
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/14bdf34a

Branch: refs/heads/master
Commit: 14bdf34a9bb5f2b93205c2972d54889d4fd2aae9
Parents: a123650
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Tue Dec 5 12:36:37 2017 +0100
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Tue Dec 5 12:36:37 2017 +0100

----------------------------------------------------------------------
 .../module/descriptor/DefaultModuleDescriptor.java     |  9 +--------
 .../apache/ivy/core/report/ArtifactDownloadReport.java |  9 +--------
 .../org/apache/ivy/osgi/core/BundleCapability.java     |  9 +--------
 src/java/org/apache/ivy/osgi/core/BundleInfo.java      | 13 ++-----------
 .../org/apache/ivy/osgi/core/BundleRequirement.java    |  9 +--------
 .../ivy/osgi/core/ExecutionEnvironmentProfile.java     |  9 +--------
 src/java/org/apache/ivy/osgi/core/ExportPackage.java   |  9 +--------
 src/java/org/apache/ivy/osgi/filter/CompareFilter.java |  9 +--------
 .../apache/ivy/osgi/filter/MultiOperatorFilter.java    | 12 +++---------
 .../org/apache/ivy/osgi/filter/UniOperatorFilter.java  |  9 +--------
 .../apache/ivy/osgi/repo/EditableRepoDescriptor.java   |  9 +--------
 src/java/org/apache/ivy/osgi/util/Version.java         | 13 ++-----------
 src/java/org/apache/ivy/osgi/util/VersionRange.java    | 13 ++-----------
 .../ivy/plugins/repository/sftp/SFTPRepository.java    |  6 ++----
 14 files changed, 20 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
index 99d92e2..6b528e0 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
@@ -571,14 +571,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
             return false;
         }
         DefaultModuleDescriptor other = (DefaultModuleDescriptor) obj;
-        if (revId == null) {
-            if (other.revId != null) {
-                return false;
-            }
-        } else if (!revId.equals(other.revId)) {
-            return false;
-        }
-        return true;
+        return revId == null ? other.revId == null : revId.equals(other.revId);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java b/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
index 6ca13ca..8fb72bd 100644
--- a/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
+++ b/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
@@ -189,14 +189,7 @@ public class ArtifactDownloadReport {
             return true;
         }
         ArtifactDownloadReport other = (ArtifactDownloadReport) obj;
-        if (artifact == null) {
-            if (other.artifact != null) {
-                return false;
-            }
-        } else if (!artifact.equals(other.artifact)) {
-            return false;
-        }
-        return true;
+        return artifact == null ? other.artifact == null : artifact.equals(other.artifact);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/core/BundleCapability.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/BundleCapability.java b/src/java/org/apache/ivy/osgi/core/BundleCapability.java
index a4abc76..54c190a 100644
--- a/src/java/org/apache/ivy/osgi/core/BundleCapability.java
+++ b/src/java/org/apache/ivy/osgi/core/BundleCapability.java
@@ -79,14 +79,7 @@ public class BundleCapability {
         } else if (!name.equals(other.name)) {
             return false;
         }
-        if (version == null) {
-            if (other.version != null) {
-                return false;
-            }
-        } else if (!version.equals(other.version)) {
-            return false;
-        }
-        return true;
+        return version == null ? other.version == null : version.equals(other.version);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/core/BundleInfo.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/BundleInfo.java b/src/java/org/apache/ivy/osgi/core/BundleInfo.java
index 661848c..b2c19f8 100644
--- a/src/java/org/apache/ivy/osgi/core/BundleInfo.java
+++ b/src/java/org/apache/ivy/osgi/core/BundleInfo.java
@@ -325,17 +325,8 @@ public class BundleInfo {
         } else if (!versionTarget.equals(other.versionTarget)) {
             return false;
         }
-        if (hasInnerClasspath != other.hasInnerClasspath) {
-            return false;
-        }
-        if (classpath == null) {
-            if (other.classpath != null) {
-                return false;
-            }
-        } else if (!classpath.equals(other.classpath)) {
-            return false;
-        }
-        return true;
+        return hasInnerClasspath == other.hasInnerClasspath
+                && (classpath == null ? other.classpath == null : classpath.equals(other.classpath));
     }
 
     public Set<BundleRequirement> getRequires() {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/core/BundleRequirement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/BundleRequirement.java b/src/java/org/apache/ivy/osgi/core/BundleRequirement.java
index d25021c..d41fb38 100644
--- a/src/java/org/apache/ivy/osgi/core/BundleRequirement.java
+++ b/src/java/org/apache/ivy/osgi/core/BundleRequirement.java
@@ -99,13 +99,6 @@ public class BundleRequirement {
         } else if (!resolution.equals(other.resolution)) {
             return false;
         }
-        if (version == null) {
-            if (other.version != null) {
-                return false;
-            }
-        } else if (!version.equals(other.version)) {
-            return false;
-        }
-        return true;
+        return version == null ? other.version == null : version.equals(other.version);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java b/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java
index e072285..6c8438b 100644
--- a/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java
+++ b/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java
@@ -64,14 +64,7 @@ public class ExecutionEnvironmentProfile {
         } else if (!name.equals(other.name)) {
             return false;
         }
-        if (pkgNames == null) {
-            if (other.pkgNames != null) {
-                return false;
-            }
-        } else if (!pkgNames.equals(other.pkgNames)) {
-            return false;
-        }
-        return true;
+        return pkgNames == null ? other.pkgNames == null : pkgNames.equals(other.pkgNames);
     }
 
     public String toString() {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/core/ExportPackage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ExportPackage.java b/src/java/org/apache/ivy/osgi/core/ExportPackage.java
index 7227c87..329ff33 100644
--- a/src/java/org/apache/ivy/osgi/core/ExportPackage.java
+++ b/src/java/org/apache/ivy/osgi/core/ExportPackage.java
@@ -57,14 +57,7 @@ public class ExportPackage extends BundleCapability {
             return false;
         }
         ExportPackage other = (ExportPackage) obj;
-        if (uses == null) {
-            if (other.uses != null) {
-                return false;
-            }
-        } else if (!uses.equals(other.uses)) {
-            return false;
-        }
-        return true;
+        return uses == null ? other.uses == null : uses.equals(other.uses);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/filter/CompareFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/filter/CompareFilter.java b/src/java/org/apache/ivy/osgi/filter/CompareFilter.java
index d3b43ca..840ec45 100644
--- a/src/java/org/apache/ivy/osgi/filter/CompareFilter.java
+++ b/src/java/org/apache/ivy/osgi/filter/CompareFilter.java
@@ -144,13 +144,6 @@ public class CompareFilter extends OSGiFilter {
         } else if (!operator.equals(other.operator)) {
             return false;
         }
-        if (rightValue == null) {
-            if (other.rightValue != null) {
-                return false;
-            }
-        } else if (!rightValue.equals(other.rightValue)) {
-            return false;
-        }
-        return true;
+        return rightValue == null ? other.rightValue == null : rightValue.equals(other.rightValue);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java b/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java
index 483f76d..b91ddd2 100644
--- a/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java
+++ b/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java
@@ -73,14 +73,8 @@ public abstract class MultiOperatorFilter extends OSGiFilter {
             return false;
         }
         MultiOperatorFilter other = (MultiOperatorFilter) obj;
-        if (subFilters == null) {
-            if (other.subFilters != null) {
-                return false;
-            }
-        } else if (other.subFilters == null || subFilters.size() != other.subFilters.size()
-                || !subFilters.containsAll(other.subFilters)) {
-            return false;
-        }
-        return true;
+        return subFilters == null ? other.subFilters == null
+                : other.subFilters != null && subFilters.size() == other.subFilters.size()
+                && subFilters.containsAll(other.subFilters);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/filter/UniOperatorFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/filter/UniOperatorFilter.java b/src/java/org/apache/ivy/osgi/filter/UniOperatorFilter.java
index 19f1556..efc4bc4 100644
--- a/src/java/org/apache/ivy/osgi/filter/UniOperatorFilter.java
+++ b/src/java/org/apache/ivy/osgi/filter/UniOperatorFilter.java
@@ -59,13 +59,6 @@ public abstract class UniOperatorFilter extends OSGiFilter {
             return false;
         }
         UniOperatorFilter other = (UniOperatorFilter) obj;
-        if (subFilter == null) {
-            if (other.subFilter != null) {
-                return false;
-            }
-        } else if (!subFilter.equals(other.subFilter)) {
-            return false;
-        }
-        return true;
+        return subFilter == null ? other.subFilter == null : subFilter.equals(other.subFilter);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java b/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
index 8890a90..be20397 100644
--- a/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
+++ b/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
@@ -157,14 +157,7 @@ public class EditableRepoDescriptor extends RepoDescriptor {
             return true;
         }
         EditableRepoDescriptor other = (EditableRepoDescriptor) obj;
-        if (modules == null) {
-            if (other.modules != null) {
-                return false;
-            }
-        } else if (!modules.equals(other.modules)) {
-            return false;
-        }
-        return true;
+        return modules == null ? other.modules == null : modules.equals(other.modules);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/util/Version.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/util/Version.java b/src/java/org/apache/ivy/osgi/util/Version.java
index e48df1a..7c469ca 100644
--- a/src/java/org/apache/ivy/osgi/util/Version.java
+++ b/src/java/org/apache/ivy/osgi/util/Version.java
@@ -151,17 +151,8 @@ public class Version implements Comparable<Version> {
         Version other = (Version) obj;
         ensureSplit();
         other.ensureSplit();
-        if (major != other.major || minor != other.minor || patch != other.patch) {
-            return false;
-        }
-        if (qualifier == null) {
-            if (other.qualifier != null) {
-                return false;
-            }
-        } else if (!qualifier.equals(other.qualifier)) {
-            return false;
-        }
-        return true;
+        return major == other.major && minor == other.minor && patch == other.patch
+                && (qualifier == null ? other.qualifier == null : qualifier.equals(other.qualifier));
     }
 
     public Version withNudgedPatch() {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/osgi/util/VersionRange.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/util/VersionRange.java b/src/java/org/apache/ivy/osgi/util/VersionRange.java
index 06a49e3..0e84e32 100644
--- a/src/java/org/apache/ivy/osgi/util/VersionRange.java
+++ b/src/java/org/apache/ivy/osgi/util/VersionRange.java
@@ -340,17 +340,8 @@ public class VersionRange {
         } else if (!endVersion.equals(other.endVersion)) {
             return false;
         }
-        if (startExclusive != other.startExclusive) {
-            return false;
-        }
-        if (startVersion == null) {
-            if (other.startVersion != null) {
-                return false;
-            }
-        } else if (!startVersion.equals(other.startVersion)) {
-            return false;
-        }
-        return true;
+        return startExclusive == other.startExclusive
+                && (startVersion == null ? other.startVersion == null : startVersion.equals(other.startVersion));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/14bdf34a/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java b/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
index b18e212..596846a 100644
--- a/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
+++ b/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
@@ -150,10 +150,8 @@ public class SFTPRepository extends AbstractSshBasedRepository {
     private void mkdirs(String directory, ChannelSftp c) throws SftpException {
         try {
             SftpATTRS att = c.stat(directory);
-            if (att != null) {
-                if (att.isDir()) {
-                    return;
-                }
+            if (att != null && att.isDir()) {
+                return;
             }
         } catch (SftpException ex) {
             if (directory.indexOf('/') != -1) {