Consistently applied appropriate ByteArrayOutputStream initial capacities across the codebase

Issue: SPR-11594
(cherry picked from commit dd7f54c)
This commit is contained in:
Juergen Hoeller
2014-03-25 00:35:33 +01:00
parent ab85aa2096
commit dbd5f67498
17 changed files with 101 additions and 97 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 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.
@@ -33,7 +33,7 @@ final class PropertiesToStringConverter implements Converter<Properties, String>
public String convert(Properties source) {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
source.store(os, null);
return os.toString("ISO-8859-1");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 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.
@@ -56,7 +56,7 @@ public class SerializingConverter implements Converter<Object, byte[]> {
* Serializes the source object and returns the byte array result.
*/
public byte[] convert(Object source) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(128);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(256);
try {
this.serializer.serialize(source, byteStream);
return byteStream.toByteArray();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -36,11 +36,11 @@ public class ToStringCreator {
new DefaultToStringStyler(StylerUtils.DEFAULT_VALUE_STYLER);
private StringBuilder buffer = new StringBuilder(512);
private final StringBuilder buffer = new StringBuilder(256);
private ToStringStyler styler;
private final ToStringStyler styler;
private Object object;
private final Object object;
private boolean styledFirstField;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 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.
@@ -39,7 +39,7 @@ public abstract class SerializationUtils {
if (object == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
try {
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(object);

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.
@@ -213,7 +213,7 @@ public class MappingJackson2MessageConverter implements MessageConverter, BeanCl
protected BytesMessage mapToBytesMessage(Object object, Session session, ObjectMapper objectMapper)
throws JMSException, IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
OutputStreamWriter writer = new OutputStreamWriter(bos, this.encoding);
objectMapper.writeValue(writer, object);

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.
@@ -214,7 +214,7 @@ public class MappingJacksonMessageConverter implements MessageConverter, BeanCla
protected BytesMessage mapToBytesMessage(Object object, Session session, ObjectMapper objectMapper)
throws JMSException, IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
OutputStreamWriter writer = new OutputStreamWriter(bos, this.encoding);
objectMapper.writeValue(writer, object);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -228,7 +228,7 @@ public class MarshallingMessageConverter implements MessageConverter, Initializi
protected BytesMessage marshalToBytesMessage(Object object, Session session, Marshaller marshaller)
throws JMSException, IOException, XmlMappingException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
StreamResult streamResult = new StreamResult(bos);
marshaller.marshal(object, streamResult);
BytesMessage message = session.createBytesMessage();

View File

@@ -128,6 +128,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
public void setTargetPackage(String targetPackage) {
this.targetPackage = targetPackage;
}
/**
* Set the optional binding name for this instance.
*/
@@ -333,7 +334,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
private void transformAndMarshal(Object graph, Result result) throws IOException {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
marshalOutputStream(graph, os);
ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
Transformer transformer = this.transformerFactory.newTransformer();
@@ -341,7 +342,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
}
catch (TransformerException ex) {
throw new MarshallingFailureException(
"Could not transform to [" + ClassUtils.getShortName(result.getClass()) + "]");
"Could not transform to [" + ClassUtils.getShortName(result.getClass()) + "]", ex);
}
}
@@ -395,6 +396,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
}
}
// Unsupported Unmarshalling
@Override
@@ -420,7 +422,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
if (encoding != null) {
transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
transformer.transform(source, new StreamResult(os));
ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
return unmarshalInputStream(is);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.mock.http;
import java.io.ByteArrayOutputStream;
@@ -36,7 +37,7 @@ public class MockHttpOutputMessage implements HttpOutputMessage {
private final HttpHeaders headers = new HttpHeaders();
private final ByteArrayOutputStream body = new ByteArrayOutputStream();
private final ByteArrayOutputStream body = new ByteArrayOutputStream(1024);
/**
@@ -74,7 +75,6 @@ public class MockHttpOutputMessage implements HttpOutputMessage {
public String getBodyAsString(Charset charset) {
byte[] bytes = getBodyAsBytes();
try {
// Use
return new String(bytes, charset.name());
}
catch (UnsupportedEncodingException ex) {

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.
@@ -69,7 +69,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
private boolean charset = false;
private final ByteArrayOutputStream content = new ByteArrayOutputStream();
private final ByteArrayOutputStream content = new ByteArrayOutputStream(1024);
private final ServletOutputStream outputStream = new ResponseServletOutputStream(this.content);
@@ -183,8 +183,8 @@ public class MockHttpServletResponse implements HttpServletResponse {
public String getContentAsString() throws UnsupportedEncodingException {
flushBuffer();
return (this.characterEncoding != null) ?
this.content.toString(this.characterEncoding) : this.content.toString();
return (this.characterEncoding != null ?
this.content.toString(this.characterEncoding) : this.content.toString());
}
public void setContentLength(int contentLength) {
@@ -201,8 +201,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
if (contentType != null) {
int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX);
if (charsetIndex != -1) {
String encoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length());
this.characterEncoding = encoding;
this.characterEncoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length());
this.charset = true;
}
updateContentTypeHeader();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 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.
@@ -56,7 +56,7 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
private int bufferSize = 4096;
private final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
private final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024);
private final CacheControl cacheControl = new MockCacheControl();
@@ -126,9 +126,9 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
public PrintWriter getWriter() throws UnsupportedEncodingException {
if (this.writer == null) {
Writer targetWriter = (this.characterEncoding != null
? new OutputStreamWriter(this.outputStream, this.characterEncoding)
: new OutputStreamWriter(this.outputStream));
Writer targetWriter = (this.characterEncoding != null ?
new OutputStreamWriter(this.outputStream, this.characterEncoding) :
new OutputStreamWriter(this.outputStream));
this.writer = new PrintWriter(targetWriter);
}
return this.writer;
@@ -141,9 +141,8 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
public String getContentAsString() throws UnsupportedEncodingException {
flushBuffer();
return (this.characterEncoding != null)
? this.outputStream.toString(this.characterEncoding)
: this.outputStream.toString();
return (this.characterEncoding != null ?
this.outputStream.toString(this.characterEncoding) : this.outputStream.toString());
}
public void setLocale(Locale locale) {
@@ -166,13 +165,11 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
if (this.writer != null) {
this.writer.flush();
}
if (this.outputStream != null) {
try {
this.outputStream.flush();
}
catch (IOException ex) {
throw new IllegalStateException("Could not flush OutputStream: " + ex.getMessage());
}
try {
this.outputStream.flush();
}
catch (IOException ex) {
throw new IllegalStateException("Could not flush OutputStream: " + ex.getMessage());
}
this.committed = true;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 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.
@@ -23,14 +23,16 @@ import java.io.OutputStream;
import org.springframework.http.HttpHeaders;
/**
* Abstract base for {@link ClientHttpRequest} that buffers output in a byte array before sending it over the wire.
* Base implementation of {@link ClientHttpRequest} that buffers output
* in a byte array before sending it over the wire.
*
* @author Arjen Poutsma
* @since 3.0.6
*/
abstract class AbstractBufferingClientHttpRequest extends AbstractClientHttpRequest {
private ByteArrayOutputStream bufferedOutput = new ByteArrayOutputStream();
private ByteArrayOutputStream bufferedOutput = new ByteArrayOutputStream(1024);
@Override
protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException {

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.
@@ -27,9 +27,9 @@ import org.springframework.util.StreamUtils;
/**
* Implementation of {@link HttpMessageConverter} that can read and write byte arrays.
*
* <p>By default, this converter supports all media types ({@code &#42;&#47;&#42;}), and writes with a {@code
* Content-Type} of {@code application/octet-stream}. This can be overridden by setting the {@link
* #setSupportedMediaTypes(java.util.List) supportedMediaTypes} property.
* <p>By default, this converter supports all media types ({@code &#42;&#47;&#42;}), and
* writes with a {@code Content-Type} of {@code application/octet-stream}. This can be
* overridden by setting the {@link #setSupportedMediaTypes supportedMediaTypes} property.
*
* @author Arjen Poutsma
* @since 3.0
@@ -47,9 +47,10 @@ public class ByteArrayHttpMessageConverter extends AbstractHttpMessageConverter<
}
@Override
public byte[] readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException {
public byte[] readInternal(Class<? extends byte[]> clazz, HttpInputMessage inputMessage) throws IOException {
long contentLength = inputMessage.getHeaders().getContentLength();
ByteArrayOutputStream bos = new ByteArrayOutputStream(contentLength >= 0 ? (int) contentLength : StreamUtils.BUFFER_SIZE);
ByteArrayOutputStream bos =
new ByteArrayOutputStream(contentLength >= 0 ? (int) contentLength : StreamUtils.BUFFER_SIZE);
StreamUtils.copy(inputMessage.getBody(), bos);
return bos.toByteArray();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -32,7 +32,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.http.HttpHeaders;
@@ -54,6 +53,7 @@ public class ServletServerHttpRequest implements ServerHttpRequest {
private static final String METHOD_POST = "POST";
private final HttpServletRequest servletRequest;
private HttpHeaders headers;
@@ -64,7 +64,7 @@ public class ServletServerHttpRequest implements ServerHttpRequest {
* @param servletRequest the servlet request
*/
public ServletServerHttpRequest(HttpServletRequest servletRequest) {
Assert.notNull(servletRequest, "'servletRequest' must not be null");
Assert.notNull(servletRequest, "HttpServletRequest must not be null");
this.servletRequest = servletRequest;
}
@@ -144,7 +144,7 @@ public class ServletServerHttpRequest implements ServerHttpRequest {
* to access a parameter thus causing the input stream to be "consumed".
*/
private InputStream getBodyFromServletRequestParameters(HttpServletRequest request) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
Writer writer = new OutputStreamWriter(bos, FORM_CHARSET);
Map<String, String[]> form = request.getParameterMap();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -21,7 +21,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
@@ -53,9 +52,9 @@ import org.springframework.web.util.WebUtils;
* @author Rob Harrop
* @author Juergen Hoeller
* @author Rossen Stoyanchev
* @since 1.2.5
* @see #beforeRequest
* @see #afterRequest
* @since 1.2.5
*/
public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter {
@@ -69,6 +68,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
private static final int DEFAULT_MAX_PAYLOAD_LENGTH = 50;
private boolean includeQueryString = false;
private boolean includeClientInfo = false;
@@ -85,6 +85,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
private String afterMessageSuffix = DEFAULT_AFTER_MESSAGE_SUFFIX;
/**
* Set whether or not the query string should be included in the log message. <p>Should be configured using an
* {@code &lt;init-param&gt;} for parameter name "includeQueryString" in the filter definition in
@@ -177,6 +178,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
this.afterMessageSuffix = afterMessageSuffix;
}
/**
* The default value is "false" so that the filter may log a "before" message
* at the start of request processing and an "after" message at the end from
@@ -188,9 +190,8 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
}
/**
* Forwards the request to the next filter in the chain and delegates down to the subclasses to perform the actual
* request logging both before and after the request is processed.
*
* Forwards the request to the next filter in the chain and delegates down to the subclasses
* to perform the actual request logging both before and after the request is processed.
* @see #beforeRequest
* @see #afterRequest
*/
@@ -221,7 +222,6 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
/**
* Get the message to write to the log before the request.
*
* @see #createMessage
*/
private String getBeforeMessage(HttpServletRequest request) {
@@ -230,7 +230,6 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
/**
* Get the message to write to the log after the request.
*
* @see #createMessage
*/
private String getAfterMessage(HttpServletRequest request) {
@@ -238,10 +237,12 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
}
/**
* Create a log message for the given request, prefix and suffix. <p>If {@code includeQueryString} is
* {@code true} then the inner part of the log message will take the form {@code request_uri?query_string}
* otherwise the message will simply be of the form {@code request_uri}. <p>The final message is composed of the
* inner part as described and the supplied prefix and suffix.
* Create a log message for the given request, prefix and suffix.
* <p>If {@code includeQueryString} is {@code true}, then the inner part
* of the log message will take the form {@code request_uri?query_string};
* otherwise the message will simply be of the form {@code request_uri}.
* <p>The final message is composed of the inner part as described and
* the supplied prefix and suffix.
*/
protected String createMessage(HttpServletRequest request, String prefix, String suffix) {
StringBuilder msg = new StringBuilder();
@@ -285,16 +286,16 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
}
/**
* Concrete subclasses should implement this method to write a log message <i>before</i> the request is processed.
*
* Concrete subclasses should implement this method to write a log message
* <i>before</i> the request is processed.
* @param request current HTTP request
* @param message the message to log
*/
protected abstract void beforeRequest(HttpServletRequest request, String message);
/**
* Concrete subclasses should implement this method to write a log message <i>after</i> the request is processed.
*
* Concrete subclasses should implement this method to write a log message
* <i>after</i> the request is processed.
* @param request current HTTP request
* @param message the message to log
*/
@@ -303,7 +304,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
private static class RequestCachingRequestWrapper extends HttpServletRequestWrapper {
private final ByteArrayOutputStream bos = new ByteArrayOutputStream();
private final ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
private final ServletInputStream inputStream;
@@ -316,19 +317,19 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
@Override
public ServletInputStream getInputStream() throws IOException {
return inputStream;
return this.inputStream;
}
@Override
public String getCharacterEncoding() {
return super.getCharacterEncoding() != null ? super.getCharacterEncoding() :
WebUtils.DEFAULT_CHARACTER_ENCODING;
String enc = super.getCharacterEncoding();
return (enc != null ? enc : WebUtils.DEFAULT_CHARACTER_ENCODING);
}
@Override
public BufferedReader getReader() throws IOException {
if (this.reader == null) {
this.reader = new BufferedReader(new InputStreamReader(inputStream, getCharacterEncoding()));
this.reader = new BufferedReader(new InputStreamReader(this.inputStream, getCharacterEncoding()));
}
return this.reader;
}
@@ -337,17 +338,18 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
return this.bos.toByteArray();
}
private class RequestCachingInputStream extends ServletInputStream {
private final ServletInputStream is;
private RequestCachingInputStream(ServletInputStream is) {
public RequestCachingInputStream(ServletInputStream is) {
this.is = is;
}
@Override
public int read() throws IOException {
int ch = is.read();
int ch = this.is.read();
if (ch != -1) {
bos.write(ch);
}

View File

@@ -34,12 +34,14 @@ import org.springframework.util.StreamUtils;
import org.springframework.web.util.WebUtils;
/**
* {@link javax.servlet.Filter} that generates an {@code ETag} value based on the content on the response.
* This ETag is compared to the {@code If-None-Match} header of the request. If these headers are equal,
* the response content is not sent, but rather a {@code 304 "Not Modified"} status instead.
* {@link javax.servlet.Filter} that generates an {@code ETag} value based on the
* content on the response. This ETag is compared to the {@code If-None-Match}
* header of the request. If these headers are equal, the response content is
* not sent, but rather a {@code 304 "Not Modified"} status instead.
*
* <p>Since the ETag is based on the response content, the response (or {@link org.springframework.web.servlet.View})
* is still rendered. As such, this filter only saves bandwidth, not server performance.
* <p>Since the ETag is based on the response content, the response
* (e.g. a {@link org.springframework.web.servlet.View}) is still rendered.
* As such, this filter only saves bandwidth, not server performance.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
@@ -77,12 +79,11 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
}
private void updateResponse(HttpServletRequest request, HttpServletResponse response) throws IOException {
ShallowEtagResponseWrapper responseWrapper = WebUtils.getNativeResponse(response, ShallowEtagResponseWrapper.class);
ShallowEtagResponseWrapper responseWrapper =
WebUtils.getNativeResponse(response, ShallowEtagResponseWrapper.class);
Assert.notNull(responseWrapper, "ShallowEtagResponseWrapper not found");
response = (HttpServletResponse) responseWrapper.getResponse();
byte[] body = responseWrapper.toByteArray();
int statusCode = responseWrapper.getStatusCode();
@@ -157,7 +158,7 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
*/
private static class ShallowEtagResponseWrapper extends HttpServletResponseWrapper {
private final ByteArrayOutputStream content = new ByteArrayOutputStream();
private final ByteArrayOutputStream content = new ByteArrayOutputStream(1024);
private final ServletOutputStream outputStream = new ResponseServletOutputStream();
@@ -213,22 +214,22 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
return this.writer;
}
@Override
public void resetBuffer() {
this.content.reset();
}
@Override
public void reset() {
super.reset();
resetBuffer();
}
private int getStatusCode() {
return statusCode;
@Override
public void resetBuffer() {
this.content.reset();
}
private byte[] toByteArray() {
public int getStatusCode() {
return this.statusCode;
}
public byte[] toByteArray() {
return this.content.toByteArray();
}

View File

@@ -105,7 +105,7 @@ public class MarshallingView extends AbstractView {
if (toBeMarshalled == null) {
throw new ServletException("Unable to locate object to be marshalled in model: " + model);
}
ByteArrayOutputStream bos = new ByteArrayOutputStream(2048);
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
this.marshaller.marshal(toBeMarshalled, new StreamResult(bos));
setResponseContentType(request, response);