List of usage examples for org.apache.commons.fileupload MultipartStream.MalformedStreamException toString
public String toString()
From source file:com.intuit.tank.http.multipart.MultiPartRequest.java
@Override public void setBody(String bodyEncoded) { String s = new String(Base64.decodeBase64(bodyEncoded)); String boundary = StringUtils.substringBefore(s, "\r\n").substring(2); super.setBody(s); try {/* www.j a v a 2s . com*/ // s = getBody(); @SuppressWarnings("deprecation") MultipartStream multipartStream = new MultipartStream( new ByteArrayInputStream(Base64.decodeBase64(bodyEncoded)), boundary.getBytes()); boolean nextPart = multipartStream.skipPreamble(); while (nextPart) { String header = multipartStream.readHeaders(); // process headers // create some output stream ByteArrayOutputStream bos = new ByteArrayOutputStream(); multipartStream.readBodyData(bos); PartHolder p = new PartHolder(bos.toByteArray(), header); parameters.add(p); nextPart = multipartStream.readBoundary(); } } catch (MultipartStream.MalformedStreamException e) { LOG.error(e.toString(), e); // the stream failed to follow required syntax } catch (IOException e) { LOG.error(e.toString(), e); // a read or write error occurred } }