cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1179846 - in /cxf/trunk/rt/frontend/jaxrs/src: main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java
Date Thu, 06 Oct 2011 20:51:38 GMT
Author: sergeyb
Date: Thu Oct  6 20:51:38 2011
New Revision: 1179846

URL: http://svn.apache.org/viewvc?rev=1179846&view=rev
Log:
[CXF-3847] Fixing ResponseBuilderImpl status validation

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java?rev=1179846&r1=1179845&r2=1179846&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImpl.java
Thu Oct  6 20:51:38 2011
@@ -64,7 +64,7 @@ public final class ResponseBuilderImpl e
     }
 
     public ResponseBuilder status(int s) {
-        if (status < 100 || status > 599) {
+        if (s < 100 || s > 599) {
             throw new IllegalArgumentException("Illegal status value : " + s);
         }
         status = s;

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java?rev=1179846&r1=1179845&r2=1179846&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java
Thu Oct  6 20:51:38 2011
@@ -40,6 +40,24 @@ import org.junit.Test;
 
 public class ResponseBuilderImplTest extends Assert {
 
+    @Test
+    public void testValidStatus() {
+        assertEquals(100, Response.status(100).build().getStatus());
+        assertEquals(101, Response.status(101).build().getStatus());
+        assertEquals(200, Response.status(200).build().getStatus());
+        assertEquals(599, Response.status(599).build().getStatus());
+        assertEquals(598, Response.status(598).build().getStatus());
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void testIllegalsStatus1() {
+        Response.status(99).build();
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void testIllegalsStatus2() {
+        Response.status(600).build();
+    }
      
     @Test
     public void testAbsoluteLocation() {



Mime
View raw message