Issue Details (XML | Word | Printable)

Key: CACTUS-123
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vincent Massol
Reporter: Maxwell Grender-Jones
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Cactus

Failure to write to the response having set the Status -> NullPointer

Created: 01/Jun/04 05:14 PM   Updated: 19/Jun/04 03:12 PM
Return to search
Component/s: Framework
Affects Version/s: 1.6.1
Fix Version/s: 1.7

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works nocontent.patch 2004-06-17 10:53 AM Maxwell Grender-Jones 0.8 kB
Environment: Run under maven cactus plugin (1.6.1, on 1.0rc3) , on a gentoo machine. Java 1.4.2.04, Tomcat 4.1.30

Resolution Date: 19/Jun/04 03:12 PM


 Description  « Hide
In the example below, a NullPointerException is thrown within Cactus before the endNoContentMethod is reached. However, the 'SomeContent' test passes without incident.

Testcase: testNoContent took 0.301 sec
    [cactus] Caused an ERROR
    [cactus] null
    [cactus] java.lang.NullPointerException
    [cactus] at org.apache.cactus.internal.client.connector.http.AutoReadHttpURLConnection.copy(AutoReadHttpURLConnection.java:187)

import org.apache.cactus.WebRequest;
import org.apache.cactus.WebResponse;
import org.apache.cactus.ServletTestCase;

import javax.servlet.http.HttpServletResponse;

import java.io.IOException;


public class CactusTest extends ServletTestCase
{
public void testNoContent()
{
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
}

public void endNoContent(WebResponse webResponse)
{
assertEquals(webResponse.getStatusCode(), 204);
}

public void testSomeContent() throws IOException
{
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
response.getWriter().println();
}

public void endSomeContent(WebResponse webResponse)
{
assertEquals(webResponse.getStatusCode(), 204);
}

}

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.