From: Maria Odea B. Ching Date: Thu, 22 May 2008 10:18:03 +0000 (+0000) Subject: [MRM-694] X-Git-Tag: archiva-r676265~117 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e68187283844d45f9985649b73015e7608a6a75c;p=archiva.git [MRM-694] -return 405 instead of 400 for write request to repo groups git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@659071 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletRepositoryGroupTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletRepositoryGroupTest.java index 201ac9342..72684fd01 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletRepositoryGroupTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletRepositoryGroupTest.java @@ -205,7 +205,7 @@ public class RepositoryServletRepositoryGroupTest WebRequest request = new PutMethodWebRequest( putUrl, is, "text/plain" ); WebResponse response = sc.getResponse( request ); - assertResponseBadRequest( response ); + assertResponseMethodNotAllowed( response ); } public void testBrowseRepositoryGroup() @@ -218,10 +218,10 @@ public class RepositoryServletRepositoryGroupTest assertEquals( "Should have been an 401 response code.", HttpServletResponse.SC_UNAUTHORIZED, response.getResponseCode() ); } - protected void assertResponseBadRequest( WebResponse response ) + protected void assertResponseMethodNotAllowed( WebResponse response ) { assertNotNull( "Should have recieved a response", response ); - assertEquals( "Should have been an 400/Bad Request response code.", HttpServletResponse.SC_BAD_REQUEST, response.getResponseCode() ); + assertEquals( "Should have been an 405/Method Not Allowed response code.", HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getResponseCode() ); } protected RepositoryGroupConfiguration createRepositoryGroup( String id, List repositories ) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java index 3b4d0b27d..c51f883aa 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java @@ -142,8 +142,8 @@ public class ArchivaDavResourceFactory { if( WebdavMethodUtil.isWriteMethod( request.getMethod() ) ) { - throw new DavException( HttpServletResponse.SC_BAD_REQUEST, "Bad request to repository group <" + - repoGroupConfig.getId() + ">" ); + throw new DavException( HttpServletResponse.SC_METHOD_NOT_ALLOWED, + "Write method not allowed for repository groups." ); } repositories.addAll( repoGroupConfig.getRepositories() );