mirror of https://github.com/apache/ant-ivy
Tidy up the code
This commit is contained in:
parent
2510c7bbd1
commit
5a2af8daac
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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'}");
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue