[
https://issues.apache.org/jira/browse/STR-3224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
M. Manna updated STR-3224:
--------------------------
Affects Version/s: (was: 1.2.9)
1.1.0
> DiskFile getInputStream() implementation returns ByteInputStream or
> FileInputStream
> -----------------------------------------------------------------------------------
>
> Key: STR-3224
> URL: https://issues.apache.org/jira/browse/STR-3224
> Project: Struts 1
> Issue Type: Bug
> Affects Versions: 1.1.0
> Environment: Windows OS
> Reporter: M. Manna
> Priority: Critical
>
> i have posted the question original on SO. Here is the link:
> [https://stackoverflow.com/questions/47347194/struts-diskfile-getinputstream-returns-bytearrayinputstream-and-filearrayinput?noredirect=1#comment81646937_47347194]
> The summary is that this "Switchover" behaviour should be documented
> somewhere if it returns ByteArrayInputStream or FileInputStream based on file
> size.
> The files for my case was class files (byte code files). and my code is given
> below
> {code:java}
> /**
> ** Get Uploaded file from Struts Multipart form upload
> ** org.apache.struts.upload.FormFile
> **/
> FormFile file = form.getTheFile();
> /**
> ** Since we never had any issue, we didn't explicitly check using
> ** instanceof, but even then it's confusing. We do know that
> ** ByteArrayInputStream has mark supported. And it works upto
> ** 256KB file size on Windows OS.
> **/
> InputStream markStream = file.getInputStream(); // Doc says it sends
> "FileInputStream"
> try {
>
> // Do something with the markStream object
> markStream.reset(); // for ByteArrayInputStream mark is supported
>
> // Do something else with markStream
> } catch (IOException ioe) {
>
> ioe.printStackTrace();
>
> } finally {
>
> markStream.close(); // no effect for certain types
>
> }
> {code}
> Our issue is that this behaviour, even if expected, should be well
> documented. If we have missed this somewhere in Oracle JDK docs or in ASF
> docs, please could you point us there?
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)