-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: bridge-impl-4.1.0, showcase-3.0.1
-
Fix Version/s: bridge-impl-4.1.1, showcase-3.0.2
-
Component/s: JSF Showcase, Liferay Faces Bridge Impl / Demos / Tests
-
Labels:None
The UploadedFilePart class appears in several demo portlets. The getBytes() method has a loop that looks like the following:
UploadedFilePart.java
@Override public byte[] getBytes() throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); InputStream inputStream = getWrapped().getInputStream(); byte[] byteBuffer = new byte[1024]; int bytesRead = inputStream.read(byteBuffer); while (bytesRead != -1) { byteArrayOutputStream.write(byteBuffer); bytesRead = inputStream.read(byteBuffer); } byteArrayOutputStream.flush(); return byteArrayOutputStream.toByteArray(); }
The problem is that the exact range of bytes read (0 to bytesRead) into the byte[] byteBuffer is not written to the byteArrayOutputStream.