You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/07/04 17:53:15 UTC

[3/6] camel git commit: CAMEL-10118: Changed resolutor to avoid throwing unnecessary errors when dedpendencies are not needed

CAMEL-10118: Changed resolutor to avoid throwing unnecessary errors when dedpendencies are not needed


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c4d05f08
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c4d05f08
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c4d05f08

Branch: refs/heads/master
Commit: c4d05f08f28993274768ff6edc95930954bf484d
Parents: 44461c2
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Mon Jul 4 16:26:32 2016 +0200
Committer: Nicola Ferraro <ni...@gmail.com>
Committed: Mon Jul 4 16:26:32 2016 +0200

----------------------------------------------------------------------
 .../itest/springboot/util/DependencyResolver.java      | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c4d05f08/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
index 0f58d01..19fd33d 100644
--- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
+++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
@@ -44,7 +44,6 @@ public final class DependencyResolver {
      *
      * @param groupArtifact the groupId and artifactId in the form "groupId:artifactId"
      * @return the maven canonical form of the artifact "groupId:artifactId:version"
-     * @throws RuntimeException if the version cannot be resolved
      */
     public static String withVersion(String groupArtifact) {
         return withVersion(DEFAULT_PREFIX, groupArtifact);
@@ -57,7 +56,6 @@ public final class DependencyResolver {
      * @param prefix the prefix to use to lookup the property from surefire
      * @param groupArtifact the groupId and artifactId in the form "groupId:artifactId"
      * @return the maven canonical form of the artifact "groupId:artifactId:version"
-     * @throws RuntimeException if the version cannot be resolved
      */
     public static String withVersion(String prefix, String groupArtifact) {
         String version = System.getProperty(prefix + groupArtifact);
@@ -68,13 +66,18 @@ public final class DependencyResolver {
                 version = resolveSurefireProperty(prefix + groupArtifact);
             }
         } catch (Exception e) {
-            throw new IllegalStateException("Error while retrieving version for artifact: " + groupArtifact, e);
+            // cannot use logging libs
+            System.out.println("RESOLVER ERROR>> Error while retrieving version for artifact: " + groupArtifact);
+            e.printStackTrace();
+            return groupArtifact;
         }
 
         if (version == null) {
-            throw new IllegalStateException("Cannot determine version for maven artifact: " + groupArtifact);
+            System.out.println("RESOLVER ERROR>> Cannot determine version for maven artifact: " + groupArtifact);
+            return groupArtifact;
         } else if (!isResolved(version)) {
-            throw new IllegalStateException("Cannot resolve version for maven artifact: " + groupArtifact + ". Missing property value: " + version);
+            System.out.println("RESOLVER ERROR>> Cannot resolve version for maven artifact: " + groupArtifact + ". Missing property value: " + version);
+            return groupArtifact;
         }
 
         return groupArtifact + ":" + version;