You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Rajika Kumarasiri (Created) (JIRA)" <ji...@apache.org> on 2011/09/27 06:55:12 UTC

[jira] [Created] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
-------------------------------------------------------------------------

                 Key: HTTPCORE-278
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
             Project: HttpComponents HttpCore
          Issue Type: Improvement
            Reporter: Rajika Kumarasiri


Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 

At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 

A possible patch will follow. 

Rajika


[0] - java.nio.charset.MalformedInputException: Input length = 1 
        at java.nio.charset.CoderResult.throwException(Unknown Source) 
        at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
        at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
        at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
        at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
        at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
        at java.lang.Thread.run(Unknown Source)  

[1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Posted by "Rajika Kumarasiri (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajika Kumarasiri updated HTTPCORE-278:
---------------------------------------

    Attachment: HTTPCORE-278.patch

A small patch for the issue.
                
> Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-278
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Rajika Kumarasiri
>         Attachments: HTTPCORE-278.patch
>
>
> Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 
> At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 
> A possible patch will follow. 
> Rajika
> [0] - java.nio.charset.MalformedInputException: Input length = 1 
>         at java.nio.charset.CoderResult.throwException(Unknown Source) 
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
>         at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
>         at java.lang.Thread.run(Unknown Source)  
> [1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Posted by "Oleg Kalnichevski (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-278.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2-alpha3

Patch checked in. Many thanks, Rajika, for contributing it.

Oleg
                
> Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-278
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Rajika Kumarasiri
>             Fix For: 4.2-alpha3
>
>         Attachments: HTTPCORE-278.patch, HTTPCORE-278.patch, HTTPCORE-278.patch
>
>
> Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 
> At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 
> A possible patch will follow. 
> Rajika
> [0] - java.nio.charset.MalformedInputException: Input length = 1 
>         at java.nio.charset.CoderResult.throwException(Unknown Source) 
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
>         at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
>         at java.lang.Thread.run(Unknown Source)  
> [1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Posted by "Rajika Kumarasiri (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajika Kumarasiri updated HTTPCORE-278:
---------------------------------------

    Attachment: HTTPCORE-278.patch
    
> Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-278
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Rajika Kumarasiri
>         Attachments: HTTPCORE-278.patch, HTTPCORE-278.patch, HTTPCORE-278.patch
>
>
> Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 
> At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 
> A possible patch will follow. 
> Rajika
> [0] - java.nio.charset.MalformedInputException: Input length = 1 
>         at java.nio.charset.CoderResult.throwException(Unknown Source) 
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
>         at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
>         at java.lang.Thread.run(Unknown Source)  
> [1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Closed] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Posted by "Rajika Kumarasiri (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajika Kumarasiri closed HTTPCORE-278.
--------------------------------------


Issue verified. 

Rajika
                
> Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-278
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Rajika Kumarasiri
>             Fix For: 4.2-alpha3
>
>         Attachments: HTTPCORE-278.patch, HTTPCORE-278.patch, HTTPCORE-278.patch
>
>
> Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 
> At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 
> A possible patch will follow. 
> Rajika
> [0] - java.nio.charset.MalformedInputException: Input length = 1 
>         at java.nio.charset.CoderResult.throwException(Unknown Source) 
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
>         at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
>         at java.lang.Thread.run(Unknown Source)  
> [1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Posted by "Rajika Kumarasiri (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115352#comment-13115352 ] 

Rajika Kumarasiri commented on HTTPCORE-278:
--------------------------------------------

Ok, Oleg. I'll attach a new patch with the changes + test cases. 

Rajika
                
> Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-278
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Rajika Kumarasiri
>         Attachments: HTTPCORE-278.patch, HTTPCORE-278.patch
>
>
> Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 
> At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 
> A possible patch will follow. 
> Rajika
> [0] - java.nio.charset.MalformedInputException: Input length = 1 
>         at java.nio.charset.CoderResult.throwException(Unknown Source) 
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
>         at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
>         at java.lang.Thread.run(Unknown Source)  
> [1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Posted by "Rajika Kumarasiri (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13118902#comment-13118902 ] 

Rajika Kumarasiri commented on HTTPCORE-278:
--------------------------------------------

The updated patch with the changes + test cases for both I/O models. 

Rajika
                
> Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-278
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Rajika Kumarasiri
>         Attachments: HTTPCORE-278.patch, HTTPCORE-278.patch, HTTPCORE-278.patch
>
>
> Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 
> At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 
> A possible patch will follow. 
> Rajika
> [0] - java.nio.charset.MalformedInputException: Input length = 1 
>         at java.nio.charset.CoderResult.throwException(Unknown Source) 
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
>         at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
>         at java.lang.Thread.run(Unknown Source)  
> [1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Posted by "Rajika Kumarasiri (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajika Kumarasiri updated HTTPCORE-278:
---------------------------------------

    Attachment: HTTPCORE-278.patch

An updated version of the patch.
                
> Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-278
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Rajika Kumarasiri
>         Attachments: HTTPCORE-278.patch, HTTPCORE-278.patch
>
>
> Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 
> At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 
> A possible patch will follow. 
> Rajika
> [0] - java.nio.charset.MalformedInputException: Input length = 1 
>         at java.nio.charset.CoderResult.throwException(Unknown Source) 
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
>         at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
>         at java.lang.Thread.run(Unknown Source)  
> [1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCORE-278) Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable

Posted by "Oleg Kalnichevski (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115344#comment-13115344 ] 

Oleg Kalnichevski commented on HTTPCORE-278:
--------------------------------------------

Hi Rajika,

The patch looks good. However, for the completeness and consistency sake it would be nice to make the new parameters apply to the blocking AbstractSessionInputBuffer / AbstractSessionOutputBuffer as well, and to have test cases for both i/o models ;-)

Oleg
                
> Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-278
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-278
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>            Reporter: Rajika Kumarasiri
>         Attachments: HTTPCORE-278.patch, HTTPCORE-278.patch
>
>
> Due to various character encoding complexities such as the system is configured to receive UTF-16 and but receives UTF-8 streams etc.. following exception throws by the httpcore library[0]. 
> At this point the connection will be dropped. But upon receiving this kind of errors we can recover if we configure  CharsetEncoder/CharsetDecoder with a CodingErrorAction [1] where the action can be report (default), ignore and resume or replace and resume the coding logic. I think this choice should be a configuration option in  SessionInputBufferImpl/SessionOutputBufferImpl constructors. 
> A possible patch will follow. 
> Rajika
> [0] - java.nio.charset.MalformedInputException: Input length = 1 
>         at java.nio.charset.CoderResult.throwException(Unknown Source) 
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:189) 
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:169) 
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:154) 
>         at org.apache.http.impl.nio.DefaultClientIOEventDispatch.inputReady(DefaultClientIOEventDispatch.java:148) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:161) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:319) 
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:275) 
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:528) 
>         at java.lang.Thread.run(Unknown Source)  
> [1] - http://download.oracle.com/javase/6/docs/api/java/nio/charset/CodingErrorAction.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org