{
name = pName;
fieldName = pFieldName;
contentType = pContentType;
formField = pFormField;
final ItemInputStream itemStream = multi.newInputStream();
InputStream istream = itemStream;
if (fileSizeMax != -1)
{
if (pContentLength != -1 && pContentLength > fileSizeMax)
{
FileUploadException e = new FileSizeLimitExceededException("The field " +
fieldName + " exceeds its maximum permitted " + " size of " +
fileSizeMax + " characters.", pContentLength, fileSizeMax);
throw new FileUploadIOException(e);
}
istream = new LimitedInputStream(istream, fileSizeMax)
{
@Override
protected void raiseError(long pSizeMax, long pCount) throws IOException
{
itemStream.close(true);
FileUploadException e = new FileSizeLimitExceededException(
"The field " + fieldName + " exceeds its maximum permitted " +
" size of " + pSizeMax + " characters.", pCount, pSizeMax);
throw new FileUploadIOException(e);
}