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 2018/03/15 18:33:51 UTC
ant-ivy git commit: Tidy up the code
Repository: ant-ivy
Updated Branches:
refs/heads/master 2510c7bbd -> 5a2af8daa
Tidy up the code
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/5a2af8da
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/5a2af8da
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/5a2af8da
Branch: refs/heads/master
Commit: 5a2af8daac22943633622b8ec3cb03f26d4577b9
Parents: 2510c7b
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Thu Mar 15 19:33:36 2018 +0100
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Thu Mar 15 19:33:36 2018 +0100
----------------------------------------------------------------------
src/java/org/apache/ivy/Main.java | 1 -
src/java/org/apache/ivy/ant/IvyAntSettings.java | 1 -
.../apache/ivy/core/settings/XmlSettingsParser.java | 6 +++---
.../ivy/plugins/matcher/GlobPatternMatcher.java | 2 +-
.../parser/m2/PomModuleDescriptorParser.java | 6 ++----
.../org/apache/ivy/util/url/BasicURLHandler.java | 2 +-
.../org/apache/ivy/util/url/HttpClientHandler.java | 2 +-
.../org/apache/ivy/util/url/URLHandlerRegistry.java | 2 +-
test/java/org/apache/ivy/TestHelper.java | 2 --
.../org/apache/ivy/core/resolve/ResolveTest.java | 2 +-
.../core/settings/OnlineXmlSettingsParserTest.java | 4 ++--
.../parser/m2/MavenVersionRangeParserTest.java | 16 ++++++++--------
.../parser/m2/PomModuleDescriptorParserTest.java | 2 +-
.../apache/ivy/util/url/AbstractURLHandlerTest.java | 1 -
.../ivy/util/url/HttpclientURLHandlerTest.java | 2 +-
.../apache/ivy/util/url/IvyAuthenticatorTest.java | 1 -
16 files changed, 22 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/src/java/org/apache/ivy/Main.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/Main.java b/src/java/org/apache/ivy/Main.java
index 5d89bfb..516448e 100644
--- a/src/java/org/apache/ivy/Main.java
+++ b/src/java/org/apache/ivy/Main.java
@@ -58,7 +58,6 @@ import org.apache.ivy.util.cli.ParseException;
import org.apache.ivy.util.filter.FilterHelper;
import org.apache.ivy.util.url.CredentialsStore;
import org.apache.ivy.util.url.TimeoutConstrainedURLHandler;
-import org.apache.ivy.util.url.URLHandler;
import org.apache.ivy.util.url.URLHandlerDispatcher;
import org.apache.ivy.util.url.URLHandlerRegistry;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/src/java/org/apache/ivy/ant/IvyAntSettings.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyAntSettings.java b/src/java/org/apache/ivy/ant/IvyAntSettings.java
index 10929e8..7842afb 100644
--- a/src/java/org/apache/ivy/ant/IvyAntSettings.java
+++ b/src/java/org/apache/ivy/ant/IvyAntSettings.java
@@ -31,7 +31,6 @@ import org.apache.ivy.core.settings.IvyVariableContainer;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.url.CredentialsStore;
import org.apache.ivy.util.url.TimeoutConstrainedURLHandler;
-import org.apache.ivy.util.url.URLHandler;
import org.apache.ivy.util.url.URLHandlerDispatcher;
import org.apache.ivy.util.url.URLHandlerRegistry;
import org.apache.tools.ant.BuildException;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java b/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
index 3633a96..f55e38c 100644
--- a/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
+++ b/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
@@ -47,7 +47,7 @@ import org.apache.ivy.util.Configurator;
import org.apache.ivy.util.FileResolver;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.url.CredentialsStore;
-import org.apache.ivy.util.url.URLHandler;
+import org.apache.ivy.util.url.TimeoutConstrainedURLHandler;
import org.apache.ivy.util.url.URLHandlerRegistry;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
@@ -373,9 +373,9 @@ public class XmlSettingsParser extends DefaultHandler {
String requestMethod = attributes.get("httpRequestMethod");
if ("head".equalsIgnoreCase(requestMethod)) {
- URLHandlerRegistry.getHttp().setRequestMethod(URLHandler.REQUEST_METHOD_HEAD);
+ URLHandlerRegistry.getHttp().setRequestMethod(TimeoutConstrainedURLHandler.REQUEST_METHOD_HEAD);
} else if ("get".equalsIgnoreCase(requestMethod)) {
- URLHandlerRegistry.getHttp().setRequestMethod(URLHandler.REQUEST_METHOD_GET);
+ URLHandlerRegistry.getHttp().setRequestMethod(TimeoutConstrainedURLHandler.REQUEST_METHOD_GET);
} else if (!isNullOrEmpty(requestMethod)) {
throw new IllegalArgumentException(
"Invalid httpRequestMethod specified, must be one of {'HEAD', 'GET'}");
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java b/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
index 405f877..35ac55b 100644
--- a/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
+++ b/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
@@ -32,7 +32,7 @@ import org.apache.oro.text.regex.Perl5Matcher;
* </ul>
* <p>
* NOTE: this matcher is available only with
- * <a href="http://jakarta.apache.org/oro">Apache Jakarta Oro 2.0.8</a>
+ * <a href="http://jakarta.apache.org/oro">Apache Jakarta ORO 2.0.8</a>
* in your classpath.
* </p>
*
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
index a329560..5aba146 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
@@ -131,11 +131,9 @@ public final class PomModuleDescriptorParser implements ModuleDescriptorParser {
try {
final IvyContext ivyContext = IvyContext.pushNewCopyContext();
- @SuppressWarnings("unchecked")
- HashSet<ModuleRevisionId> parents = (HashSet<ModuleRevisionId>) ivyContext
- .get(PARENT_MAP_KEY);
+ HashSet<ModuleRevisionId> parents = ivyContext.get(PARENT_MAP_KEY);
if (parents == null) {
- parents = new LinkedHashSet<ModuleRevisionId>();
+ parents = new LinkedHashSet<>();
ivyContext.set(PARENT_MAP_KEY, parents);
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/src/java/org/apache/ivy/util/url/BasicURLHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/url/BasicURLHandler.java b/src/java/org/apache/ivy/util/url/BasicURLHandler.java
index 1a1e8ee..0ffd0a4 100644
--- a/src/java/org/apache/ivy/util/url/BasicURLHandler.java
+++ b/src/java/org/apache/ivy/util/url/BasicURLHandler.java
@@ -92,7 +92,7 @@ public class BasicURLHandler extends AbstractURLHandler implements TimeoutConstr
con.setRequestProperty("User-Agent", getUserAgent());
if (con instanceof HttpURLConnection) {
HttpURLConnection httpCon = (HttpURLConnection) con;
- if (getRequestMethod() == URLHandler.REQUEST_METHOD_HEAD) {
+ if (getRequestMethod() == TimeoutConstrainedURLHandler.REQUEST_METHOD_HEAD) {
httpCon.setRequestMethod("HEAD");
}
if (checkStatusCode(normalizedURL, httpCon)) {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/src/java/org/apache/ivy/util/url/HttpClientHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/url/HttpClientHandler.java b/src/java/org/apache/ivy/util/url/HttpClientHandler.java
index 3ecbfb0..b8bff16 100644
--- a/src/java/org/apache/ivy/util/url/HttpClientHandler.java
+++ b/src/java/org/apache/ivy/util/url/HttpClientHandler.java
@@ -223,7 +223,7 @@ public class HttpClientHandler extends AbstractURLHandler implements TimeoutCons
CloseableHttpResponse response = null;
try {
final String httpMethod;
- if (getRequestMethod() == URLHandler.REQUEST_METHOD_HEAD) {
+ if (getRequestMethod() == TimeoutConstrainedURLHandler.REQUEST_METHOD_HEAD) {
httpMethod = HttpHead.METHOD_NAME;
response = doHead(url, connectionTimeout, readTimeout);
} else {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java b/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
index 9f195e0..5ade5c8 100644
--- a/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
+++ b/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
@@ -39,7 +39,7 @@ public final class URLHandlerRegistry {
}
/**
- * This method is used to get appropriate http downloader depending on Jakarta Commons
+ * This method is used to get appropriate http downloader depending on HttpComponents
* HttpClient availability in classpath, or simply use jdk url handling in other cases.
*
* @return most accurate http downloader
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/test/java/org/apache/ivy/TestHelper.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/TestHelper.java b/test/java/org/apache/ivy/TestHelper.java
index 6f0b0fb..76846f9 100644
--- a/test/java/org/apache/ivy/TestHelper.java
+++ b/test/java/org/apache/ivy/TestHelper.java
@@ -50,8 +50,6 @@ import org.apache.tools.ant.taskdefs.Delete;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.nio.file.Path;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/test/java/org/apache/ivy/core/resolve/ResolveTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/resolve/ResolveTest.java b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
index dce0ecd..65870f7 100644
--- a/test/java/org/apache/ivy/core/resolve/ResolveTest.java
+++ b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
@@ -6296,7 +6296,7 @@ public class ResolveTest {
* Tests that if a pom.xml has multiple dependencies for the same module, but for different Maven classifiers,
* then the resolution of such dependencies, preserves those multiple (Ivy) artifacts against the dependency
*
- * @throws Exception
+ * @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1576">IVY-1576</a> for more details
*/
@Test
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/test/java/org/apache/ivy/core/settings/OnlineXmlSettingsParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/settings/OnlineXmlSettingsParserTest.java b/test/java/org/apache/ivy/core/settings/OnlineXmlSettingsParserTest.java
index 93623fa..1fd5603 100644
--- a/test/java/org/apache/ivy/core/settings/OnlineXmlSettingsParserTest.java
+++ b/test/java/org/apache/ivy/core/settings/OnlineXmlSettingsParserTest.java
@@ -22,7 +22,7 @@ import java.net.URL;
import org.apache.ivy.plugins.resolver.ChainResolver;
import org.apache.ivy.plugins.resolver.DependencyResolver;
import org.apache.ivy.plugins.resolver.IvyRepResolver;
-import org.apache.ivy.util.url.URLHandler;
+import org.apache.ivy.util.url.TimeoutConstrainedURLHandler;
import org.apache.ivy.util.url.URLHandlerDispatcher;
import org.apache.ivy.util.url.URLHandlerRegistry;
@@ -95,7 +95,7 @@ public class OnlineXmlSettingsParserTest {
private void configureURLHandler() {
URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
- URLHandler httpHandler = URLHandlerRegistry.getHttp();
+ TimeoutConstrainedURLHandler httpHandler = URLHandlerRegistry.getHttp();
dispatcher.setDownloader("http", httpHandler);
dispatcher.setDownloader("https", httpHandler);
URLHandlerRegistry.setDefault(dispatcher);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/test/java/org/apache/ivy/plugins/parser/m2/MavenVersionRangeParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/MavenVersionRangeParserTest.java b/test/java/org/apache/ivy/plugins/parser/m2/MavenVersionRangeParserTest.java
index 1ac141a..ed610b7 100644
--- a/test/java/org/apache/ivy/plugins/parser/m2/MavenVersionRangeParserTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/m2/MavenVersionRangeParserTest.java
@@ -31,7 +31,7 @@ public class MavenVersionRangeParserTest {
* Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when the range
* and the value being compared are the same exact values
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testExactValue() throws Exception {
@@ -44,7 +44,7 @@ public class MavenVersionRangeParserTest {
* Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when a range of the form
* {@code (,1.0]} is used to compare against some value.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testLessThanEqualBoundRange() throws Exception {
@@ -65,7 +65,7 @@ public class MavenVersionRangeParserTest {
* Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when a range of the form
* {@code (,1.0)} is used to compare against some value.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testLessThanBoundRange() throws Exception {
@@ -86,7 +86,7 @@ public class MavenVersionRangeParserTest {
* Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when a range of the form
* {@code [1.0]} is used to compare against some value.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testEqualsBoundRange() throws Exception {
@@ -99,7 +99,7 @@ public class MavenVersionRangeParserTest {
* Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when a range of the form
* {@code [1.0,)} is used to compare against some value.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testGreaterThanEqualBoundRange() throws Exception {
@@ -121,7 +121,7 @@ public class MavenVersionRangeParserTest {
* Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when a range of the form
* {@code (1.0,)} is used to compare against some value.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testGreaterThanBoundRange() throws Exception {
@@ -141,7 +141,7 @@ public class MavenVersionRangeParserTest {
* Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when a range of the form
* {@code (,1.0],[1.2,)} is used to compare against some value.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testMultiRange() throws Exception {
@@ -162,7 +162,7 @@ public class MavenVersionRangeParserTest {
* Tests the {@link MavenVersionRangeParser#rangeAccepts(String, String)} works correctly when a range of the form
* {@code (,1.1),(1.1,)} is used to compare against some value.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testMultiRangeSpecificValue() throws Exception {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
index 92b25b5..656b154 100644
--- a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
@@ -1149,7 +1149,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
* Tests that the {@code properties} setup in the Maven {@code profiles} that are conditionally activated,
* become available to the module being parsed and such properties can be used as references within the pom
*
- * @throws Exception
+ * @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-1577">IVY-1577</a> for more details
*/
@Test
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java b/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
index 2acdda9..33644dc 100644
--- a/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
+++ b/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import org.apache.ivy.core.settings.TimeoutConstraint;
import org.apache.ivy.util.CopyProgressListener;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java b/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java
index 0c0e2cc..502eb6f 100644
--- a/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java
+++ b/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java
@@ -102,7 +102,7 @@ public class HttpclientURLHandlerTest {
URLInfo info = handler.getURLInfo(new URL(DEFAULT_M2_ROOT
+ "commons-lang/commons-lang/[1.0,3.0[/commons-lang-[1.0,3.0[.pom"), defaultTimeoutConstraint);
- assertEquals(URLHandler.UNAVAILABLE, info);
+ assertEquals(TimeoutConstrainedURLHandler.UNAVAILABLE, info);
}
@Test
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/5a2af8da/test/java/org/apache/ivy/util/url/IvyAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/url/IvyAuthenticatorTest.java b/test/java/org/apache/ivy/util/url/IvyAuthenticatorTest.java
index b27d6a0..4512b22 100644
--- a/test/java/org/apache/ivy/util/url/IvyAuthenticatorTest.java
+++ b/test/java/org/apache/ivy/util/url/IvyAuthenticatorTest.java
@@ -18,7 +18,6 @@
package org.apache.ivy.util.url;
-import org.apache.ivy.TestHelper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;