ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gin...@apache.org
Subject [4/5] ant-ivy git commit: Useless casts
Date Fri, 03 Aug 2018 12:10:05 GMT
Useless casts

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

Branch: refs/heads/master
Commit: 27a3549ae7d628ae2333f8af82e9a3ca01a08549
Parents: 93f11da
Author: Gintas Grigelionis <gintas@apache.org>
Authored: Fri Aug 3 13:57:33 2018 +0200
Committer: Gintas Grigelionis <gintas@apache.org>
Committed: Fri Aug 3 13:57:33 2018 +0200

----------------------------------------------------------------------
 .../repository/ssh/AbstractSshBasedRepository.java        | 10 ++++------
 .../org/apache/ivy/plugins/resolver/BasicResolver.java    |  5 ++---
 2 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/27a3549a/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
b/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
index 7bacf8c..4edc2d5 100644
--- a/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
+++ b/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
@@ -182,9 +182,9 @@ public abstract class AbstractSshBasedRepository extends AbstractRepository
{
      * @return credentials for given host
      **/
     private Credentials requestCredentials(String host) {
-        Object o = credentialsCache.get(host);
-        if (o == null) {
-            Credentials c = CredentialsUtil.promptCredentials(new Credentials(null, host,
user,
+        Credentials c = credentialsCache.get(host);
+        if (c == null) {
+            c = CredentialsUtil.promptCredentials(new Credentials(null, host, user,
                     userPassword), getPassFile());
             if (c != null) {
                 if (credentialsCache.size() > MAX_CREDENTIALS_CACHE_SIZE) {
@@ -192,10 +192,8 @@ public abstract class AbstractSshBasedRepository extends AbstractRepository
{
                 }
                 credentialsCache.put(host, c);
             }
-            return c;
-        } else {
-            return (Credentials) o;
         }
+        return c;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/27a3549a/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java b/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
index b68b465..ac318d1 100644
--- a/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
@@ -708,15 +708,14 @@ public abstract class BasicResolver extends AbstractResolver {
                 continue;
             }
             if (versionMatcher.needModuleDescriptor(mrid, foundMrid)) {
-                ResolvedResource r = rmdparser.parse(rres.getResource(), rres.getRevision());
+                MDResolvedResource r = rmdparser.parse(rres.getResource(), rres.getRevision());
                 if (r == null) {
                     Message.debug("\t" + name + ": impossible to get module descriptor resource:
"
                             + rres);
                     rejected.add(rres.getRevision() + " (no or bad MD)");
                     continue;
                 }
-                ModuleDescriptor md = ((MDResolvedResource) r).getResolvedModuleRevision()
-                        .getDescriptor();
+                ModuleDescriptor md = r.getResolvedModuleRevision().getDescriptor();
                 if (md.isDefault()) {
                     Message.debug("\t" + name + ": default md rejected by version matcher"
                             + "requiring module descriptor: " + rres);


Mime
View raw message