You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/06/16 22:59:01 UTC

[jira] [Commented] (FILEUPLOAD-238) Default charset hardcoded in FileItem (must be used Charset.defaultCharset())

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16052480#comment-16052480 ] 

ASF GitHub Bot commented on FILEUPLOAD-238:
-------------------------------------------

GitHub user kinow opened a pull request:

    https://github.com/apache/commons-fileupload/pull/7

    FILEUPLOAD-238: add tests for the portlet package

    Initial tests for the portlet package. I believe there have been updates to the portlet specification(s) that have not been applied to Commons FileUpload yet. Hopefully, having unit tests will help us later when changing the package.
    
    Removed strings like "US-ASCII" using the StandardCharsets class from Java 7.
    
    There was a class FileUploadTestCase that was extended by other tests. But it became problematic as there were tests that would be common to any implementation of FileUpload, while other tests were specific to ServletFileUpload.
    
    This pull request removed the inheritance from the tests, by a Util class (open to other suggestions) with methods for parsing uploads and for tests.
    
    Tests related to ServletFileUpload are now in ServletFileUploadTest, in the .servlet package in the test sources.
    
    Tests related to PortletFileUpload are now in PortletFileUploadTest, in the .portlet package in the test sources.
    
    There are no functional changes in the tests. Coverage remained the same for other classes. For the .portlet package, it went from 0% to 60% in my local working copy.
    
    There are lots of other parts that need better coverage, but at least I think having tests in separated classes will make it slightly easier to add more.
    
    Cheers
    Bruno

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kinow/commons-fileupload FILEUPLOAD-238

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-fileupload/pull/7.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #7
    
----
commit 5adc6aefc39aaa39987e909259ef7f1e6bc38e72
Author: Bruno P. Kinoshita <br...@yahoo.com.br>
Date:   2017-06-11T05:23:07Z

    FILEUPLOAD-238: add tests for the portlet package

----


> Default charset hardcoded in FileItem (must be used Charset.defaultCharset())
> -----------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-238
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-238
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Kislin Grigory
>
> It is no way to set charset in form with mixed text and file input and enctype="multipart/form-data". So request ContextType is null and FileItem.getString() used default charset. 
> But default charset taken not from java Charset.defaultCharset() but hardcoded in DiskFileItem.DEFAULT_CHARSET="ISO-8859-1". So use UTF-8 only possible in own toString.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)