From a42449e3e6da6d4b3f40b39e9df8affac2661482 Mon Sep 17 00:00:00 2001 From: James William Dumay Date: Tue, 20 May 2008 12:33:13 +0000 Subject: [PATCH] MRM-752 - Trim URL in Remote Repositories git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@658219 13f79535-47bb-0310-9956-ffa450edef68 --- .../admin/repositories/AddRemoteRepositoryAction.java | 3 +++ .../admin/repositories/AddRemoteRepositoryActionTest.java | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java index 12b492062..bcf517624 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java @@ -59,6 +59,9 @@ public class AddRemoteRepositoryAction { Configuration configuration = archivaConfiguration.getConfiguration(); + //MRM-752 - url needs trimming + repository.setUrl(repository.getUrl().trim()); + // Save the repository configuration. String result; try diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java index 5089b07a3..8656ebe5a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java @@ -102,11 +102,15 @@ public class AddRemoteRepositoryActionTest action.prepare(); RemoteRepositoryConfiguration repository = action.getRepository(); populateRepository( repository ); + + assertEquals("url ", repository.getUrl()); String status = action.commit(); assertEquals( Action.SUCCESS, status ); assertEquals( Collections.singletonList( repository ), configuration.getRemoteRepositories() ); + + assertEquals("url", repository.getUrl()); archivaConfigurationControl.verify(); } @@ -115,7 +119,7 @@ public class AddRemoteRepositoryActionTest { repository.setId( REPO_ID ); repository.setName( "repo name" ); - repository.setUrl( "url" ); + repository.setUrl( "url " ); repository.setLayout( "default" ); } -- 2.39.5