]> source.dussan.org Git - archiva.git/commitdiff
[MRM-694]
authorMaria Odea B. Ching <oching@apache.org>
Thu, 22 May 2008 10:18:03 +0000 (10:18 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Thu, 22 May 2008 10:18:03 +0000 (10:18 +0000)
-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

archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletRepositoryGroupTest.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java

index 201ac934266bf43d023df76703e603875c1afdf7..72684fd010c7ec209cef26ad3cf0dab8bd1f47db 100644 (file)
@@ -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<String> repositories )
index 3b4d0b27d5a135ede0af02f75b4567d4984bab15..c51f883aae4f37494bc97771bcc372ec9836b57d 100644 (file)
@@ -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() );