struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen H <stephen+li...@jiglu.com>
Subject Re: Issue with jakarta-stream multipart parser
Date Tue, 05 Jan 2016 17:05:40 GMT
The error message comes from the IllegalArgumentException thrown by 
java.io.File.createTempFile() - it doesn't feature in the Struts 
distribution at all. Because there's no entry in 
struts-messages.properties for 
struts.messages.upload.error.IllegalArgumentException it gets added to 
the errors as-is I believe.

In JakartaStreamMultiPartRequest.createTemporaryFile() appending an 
extra '_' to the prefix for the case when it has a length of less than 3 
seems to resolve the issue with no side-effects from what I can tell.

Cheers,
Stephen.

On 05/01/2016 16:45, Martin Gainty wrote:
> difficulty locating error message "Prefix string too short"
>
> If I download struts-2.3.4.1 and expand struts2-2.3.4.1 from https://www.apache.org/dist/struts/2.3.24.1/
> struts2-2.3.24.1>grep -S -l "Prefix string too short" *there are no hits?
>
> Please confirm https://www.apache.org/dist/struts/2.3.24.1/ is the struts 2.3.4.1 you
are working with
> Martin
> ______________________________________________
>
>
>
>> To: user@struts.apache.org
>> From: stephen+lists@jiglu.com
>> Subject: Issue with jakarta-stream multipart parser
>> Date: Tue, 5 Jan 2016 15:58:30 +0000
>>
>> I'm having a problem using the jakarta-stream multipart parser when a
>> filename is used that is just a single character long excluding the
>> suffix. This triggers a check in java.io.File.createTempFile that
>> ensures that a supplied prefix must be at least three characters long:
>>
>> java.lang.IllegalArgumentException: Prefix string too short
>> 	at java.io.File.createTempFile(Unknown Source)
>> 	at
>> org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest.createTemporaryFile(JakartaStreamMultiPartRequest.java:436)
>> 	at
>> org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest.processFileItemStreamAsFileField(JakartaStreamMultiPartRequest.java:398)
>> 	at
>> org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest.processUpload(JakartaStreamMultiPartRequest.java:313)
>> 	at
>> org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest.parse(JakartaStreamMultiPartRequest.java:247)
>> 	at
>> org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper.<init>(MultiPartRequestWrapper.java:84)
>>
>> Should JakartaStreamMultiPartRequest.createTemporaryFile() add an extra
>> padding character when the prefix is too short? For now I assume the
>> only way to catch it in an action is by looking for that string in the
>> action errors?
>>
>> This is with 2.3.24.1.
>>
>> Stephen.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>   		 	   		
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message