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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user