MarshallingView should not close response OutputStream after copying to it

Also throws IllegalStateException instead of ServletException now, consistent with other Spring MVC classes.

Issue: SPR-11411
This commit is contained in:
Juergen Hoeller
2014-02-11 23:41:09 +01:00
parent 7301b58ec9
commit 648245b200
2 changed files with 54 additions and 56 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,11 @@ package org.springframework.web.servlet.view.xml;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.xml.transform.stream.StreamResult;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;
import org.springframework.oxm.Marshaller;
@@ -93,9 +92,9 @@ public class MarshallingViewTests {
try {
view.render(model, request, response);
fail("ServletException expected");
fail("IllegalStateException expected");
}
catch (ServletException ex) {
catch (IllegalStateException ex) {
// expected
}
assertEquals("Invalid content length", 0, response.getContentLength());
@@ -112,9 +111,9 @@ public class MarshallingViewTests {
try {
view.render(model, request, response);
fail("ServletException expected");
fail("IllegalStateException expected");
}
catch (ServletException ex) {
catch (IllegalStateException ex) {
// expected
}
assertEquals("Invalid content length", 0, response.getContentLength());
@@ -135,9 +134,9 @@ public class MarshallingViewTests {
try {
view.render(model, request, response);
fail("ServletException expected");
fail("IllegalStateException expected");
}
catch (ServletException ex) {
catch (IllegalStateException ex) {
// expected
}
}
@@ -174,9 +173,9 @@ public class MarshallingViewTests {
try {
view.render(model, request, response);
fail("ServletException expected");
fail("IllegalStateException expected");
}
catch (ServletException ex) {
catch (IllegalStateException ex) {
// expected
}
}