hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajika Kumarasiri <raj...@wso2.com>
Subject Making CharsetEncoder/CharsetDecoder CodingErrorAction to be configurable
Date Sat, 24 Sep 2011 06:22:11 GMT
Hello,

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.

I was hoping we can fix this by adding two string constant
'http.malformed.input.action' and 'http.unmappble.input.action'
into CoreProtocolPNames interface so that we can query using
BasicHttpParams. But it seems CoreProtoclPNames is a core interface which we
can't change directly.

Do let me know your comments. Thanks.

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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message