Repository: maven-resolver Updated Branches: refs/heads/master c5aaff390 -> da8bb35eb
Turn some IllegalArgumentExceptions into IllegalStateExceptions The rationale is that the values in question were valid when they were passed or for themselves, but in combination with others they do not add up, an illegal state has been reached. Project: http://git-wip-us.apache.org/repos/asf/maven-resolver/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-resolver/commit/da8bb35e Tree: http://git-wip-us.apache.org/repos/asf/maven-resolver/tree/da8bb35e Diff: http://git-wip-us.apache.org/repos/asf/maven-resolver/diff/da8bb35e Branch: refs/heads/master Commit: da8bb35ebbabe6b7cc6e86c3aee9ff8093949001 Parents: c5aaff3 Author: Michael Osipov <micha...@apache.org> Authored: Mon Nov 7 23:08:31 2016 +0100 Committer: Michael Osipov <micha...@apache.org> Committed: Mon Nov 7 23:08:31 2016 +0100 ---------------------------------------------------------------------- .../java/org/eclipse/aether/graph/DefaultDependencyNode.java | 6 +++--- .../org/eclipse/aether/internal/impl/DefaultInstaller.java | 4 ++-- .../aether/internal/test/util/DependencyGraphParser.java | 6 +++--- .../aether/transport/wagon/AbstractWagonTransporterTest.java | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/da8bb35e/maven-resolver-api/src/main/java/org/eclipse/aether/graph/DefaultDependencyNode.java ---------------------------------------------------------------------- diff --git a/maven-resolver-api/src/main/java/org/eclipse/aether/graph/DefaultDependencyNode.java b/maven-resolver-api/src/main/java/org/eclipse/aether/graph/DefaultDependencyNode.java index 61724dd..daf373d 100644 --- a/maven-resolver-api/src/main/java/org/eclipse/aether/graph/DefaultDependencyNode.java +++ b/maven-resolver-api/src/main/java/org/eclipse/aether/graph/DefaultDependencyNode.java @@ -178,7 +178,7 @@ public final class DefaultDependencyNode { if ( dependency == null ) { - throw new UnsupportedOperationException( "node does not have a dependency" ); + throw new IllegalStateException( "node does not have a dependency" ); } dependency = dependency.setArtifact( artifact ); this.artifact = dependency.getArtifact(); @@ -262,7 +262,7 @@ public final class DefaultDependencyNode { if ( dependency == null ) { - throw new UnsupportedOperationException( "node does not have a dependency" ); + throw new IllegalStateException( "node does not have a dependency" ); } dependency = dependency.setScope( scope ); } @@ -271,7 +271,7 @@ public final class DefaultDependencyNode { if ( dependency == null ) { - throw new UnsupportedOperationException( "node does not have a dependency" ); + throw new IllegalStateException( "node does not have a dependency" ); } dependency = dependency.setOptional( optional ); } http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/da8bb35e/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java ---------------------------------------------------------------------- diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java index 6016b77..ede49ed 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java @@ -255,7 +255,7 @@ public class DefaultInstaller { if ( dstFile.equals( srcFile ) ) { - throw new IllegalArgumentException( "Cannot install " + dstFile + " to same path" ); + throw new IllegalStateException( "cannot install " + dstFile + " to same path" ); } boolean copy = @@ -305,7 +305,7 @@ public class DefaultInstaller { if ( dstFile.equals( metadata.getFile() ) ) { - throw new IllegalArgumentException( "Cannot install " + dstFile + " to same path" ); + throw new IllegalStateException( "cannot install " + dstFile + " to same path" ); } fileProcessor.copy( metadata.getFile(), dstFile ); } http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/da8bb35e/maven-resolver-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java ---------------------------------------------------------------------- diff --git a/maven-resolver-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java b/maven-resolver-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java index 5c39c23..67eb20d 100644 --- a/maven-resolver-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java +++ b/maven-resolver-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java @@ -275,7 +275,7 @@ public class DependencyGraphParser DependencyNode child = nodes.get( reference ); if ( child == null ) { - throw new IllegalArgumentException( "undefined reference " + reference ); + throw new IllegalStateException( "undefined reference " + reference ); } node.getChildren().add( child ); } @@ -327,11 +327,11 @@ public class DependencyGraphParser NodeDefinition def = ctx.getDefinition(); if ( !isRoot && parent == null ) { - throw new IllegalArgumentException( "dangling node: " + def ); + throw new IllegalStateException( "dangling node: " + def ); } else if ( ctx.getLevel() == 0 && parent != null ) { - throw new IllegalArgumentException( "inconsistent leveling (parent for level 0?): " + def ); + throw new IllegalStateException( "inconsistent leveling (parent for level 0?): " + def ); } DefaultDependencyNode node; http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/da8bb35e/maven-resolver-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java ---------------------------------------------------------------------- diff --git a/maven-resolver-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java b/maven-resolver-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java index 2a58de3..adf080e 100644 --- a/maven-resolver-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java +++ b/maven-resolver-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java @@ -105,7 +105,7 @@ public abstract class AbstractWagonTransporterTest { return newWagon(); } - throw new IllegalArgumentException( "Unknown wagon role: " + roleHint ); + throw new IllegalArgumentException( "unknown wagon role: " + roleHint ); } public void release( Wagon wagon )