You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Norman Maurer <no...@apache.org> on 2009/10/29 18:44:09 UTC

Problems with TextLineCodecFactory in SMTPServer

Hi all,

we started to use MINA in the JAMES SMTPServer. Everything works in
most cases, but sometimes I see the following error message:

org.apache.mina.filter.codec.ProtocolDecoderException:
java.nio.charset.MalformedInputException: Input length = 1 (Hexdump:
22 74 6F 70 22 20 68 65 69 67 68 74 3D 22 32 30 22 20 62 67 63 6F 6C
6F 72 3D 22 23 39 39 30 30 30 30 22 3E 26 6E 62 73 70 3B 3C 2F 74 64
3E 0D 0A 3C 2F 74 72 3E 0D 0A 3C 74 72 20 68 65 69 67 68 74 3D 22 32
30 22 3E 20 0D 0A 3C 74 64 20 76 61 6C 69 67 6E 3D 22 74 6F 70 22 20
68 65 69 67 68 74 3D 22 32 30 22 20 62 67 63 6F 6C 6F 72 3D 22 23 39
39 30 30 30 30 22 20 61 6C 69 67 6E 3D 22 63 65 6E 74 65 72 22 3E 20
0D 0A 3C 70 3E 3C 62 3E 3C 66 6F 6E 74 20 63 6F 6C 6F 72 3D 22 23 46
46 46 46 46 46 22 3E 34 20 ED EE FF E1 F0 FF 20 32 30 30 39 20 E3 2E
3C 62 72 3E 3C 62 72 3E 3C 2F 66 6F 6E 74 3E 3C 2F 62 3E 3C 66 6F 6E
74 20 66 61 63 65 3D 22 54 61 68 6F 6D 61 22 20 73 69 7A 65 3D 22 34
22 20 63 6F 6C 6F 72 3D 22 23 46 46 46 46 46 46 22 3E 3C 62 3E 09 0D
0A D7 F2 EE 20 ED F3 E6 ED EE 20 E7 ED E0 F2 FC 20 D7 C0 D1 D2 CD CE
CC D3 20 CF D0 C5 C4 CF D0 C8 CD C8 CC C0 D2 C5 CB DE 3A 20 3C 2F 66
6F 6E 74 3E 0D 0A 3C 70 20 61 6C 69 67 6E 3D 6C 65 66 74 20 3E 3C 66
6F 6E 74 20 66 61 63 65 3D 22 54 61 68 6F 6D 61 22 20 73 69 7A 65 3D
22 32 22 20 63 6F 6C 6F 72 3D 22 23 46 46 46 46 46 46 22 3E 3C 62 3E
3C 62 72 3E 3C 62 72 3E 0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26
6E 62 73 70 3B 26 6E 62 73 70 3B 95 20 C2 EA EB FE F7 E5 ED E8 E5 20
E2 20 E2 FB F0 F3 F7 EA F3 20 EF EE F1 F0 E5 E4 ED E8 EA EE E2 20 F2
EE EB FC EA EE 20 EA EE EC E8 F1 F1 E8 EE ED ED EE E3 EE 20 E2 EE E7
ED E0 E3 F0 E0 E6 E4 E5 ED E8 FF 3A 20 3C 62 72 3E 0D 0A 26 6E 62 73
70 3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B ED EE E2
FB E5 20 E0 F0 E3 F3 EC E5 ED F2 FB 2C 20 EF E8 F1 FC EC E0 20 C3 CD
C0 D3 20 F1 20 E8 FE EB FF 20 32 30 30 39 2E 3C 62 72 3E 3C 62 72 3E
0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62
73 70 3B 95 20 C2 FB E4 E0 F7 E0 20 E4 EE EA 2D F2 EE E2 20 ED E0 20
EF EE EA F3 EF EA F3 20 F2 EE E2 E0 F0 E0 20 28 F3 F1 EB F3 E3 29 20
96 20 ED EE E2 E0 FF 20 EF F0 E0 EA F2 E8 EA E0 20 EF F0 EE E2 E5 F0
EE EA 20 F1 20 EC E0 FF 20 32 30 30 39 2C 20 3C 62 72 3E 3C 62 72 3E
0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62
73 70 3B 95 20 CE F2 F0 E0 E6 E5 ED E8 E5 20 E2 FB F0 F3 F7 EA E8 20
EF EE F1 EB E5 20 EA E0 E6 E4 EE E9 20 EE EF E5 F0 E0 F6 E8 E8 3A 20
EE F2 EA F3 E4 E0 20 E2 E7 FF EB EE F1 FC 20 F2 F0 E5 E1 EE E2 E0 ED
E8 E5 2C 20 3C 62 72 3E 3C 62 72 3E 0D 0A 26 6E 62 73 70 3B 26 6E 62
73 70 3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B 95 20 D8 F2 F0 E0 F4 20
E7 E0 20 ED E5 20 F3 F7 E5 F2 20 F2 EE E2 E0 F0 ED EE 2D EC E0 F2 E5
F0 E8 E0 EB FC ED FB F5 20 F6 E5 ED ED EE F1 F2 E5 E9 20 3C 62 72 3E
0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62
73 70 3B 2D 20 EF EE F7 E5 EC F3 20 EF EE EA E0 20 F0 E5 E4 EA EE 20
EF F0 E8 EC E5 ED FF E5 F2 F1 FF 20 ED E0 20 EF F0 E0 EA F2 E8 EA E5
2C 3C 62 72 3E 0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62 73
70 3B 26 6E 62 73 70 3B EE F2 F1 F3 F2 F1 F2 E2 E8 E5 20 E4 EE EA F3
EC E5 ED F2 EE E2 20 ED E0 20 EF F0 E8 F5 EE E4 20 F2 EE E2 E0 F0 E0
2C 20 3C 62 72 3E 3C 62 72 3E 0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70
3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B 95 20 D1 EE E2 EC E5 F1 F2 ED
E0 FF 20 E4 E5 FF F2 E5 EB FC ED EE F1 F2 FC 20 E3 F0 F3 EF EF FB 20
F7 E0 F1 F2 ED FB F5 20 EF F0 E5 E4 EF F0 E8 ED E8 EC E0 F2 E5 EB E5
E9 3A 20 3C 62 72 3E 0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E
62 73 70 3B 26 6E 62 73 70 3B F7 F2 EE 20 ED E8 20 E2 20 EA EE E5 EC
20 F1 EB F3 F7 E0 E5 20 ED E5 EB FC E7 FF 20 EF EE EA E0 E7 FB E2 E0
F2 FC 2C 20 3C 62 72 3E 0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26
6E 62 73 70 3B 26 6E 62 73 70 3B F0 E0 E1 EE F2 E0 20 EF EE E4 20 EE
E4 ED EE E9 20 F2 EE F0 E3 EE E2 EE E9 20 EC E0 F0 EA EE E9 2C 20 F4
F0 E0 ED F7 E0 E9 E7 E8 ED E3 2E 3C 62 72 3E 3C 62 72 3E 0D 0A 26 6E
62 73 70 3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62 73 70 3B 95
20 D4 CE CF 2F C4 E8 F0 E5 EA F2 EE F0 2F D3 F7 F0 E5 E4 E8 F2 E5 EB
FC 2D 20 E2 20 EE E4 ED EE EC 20 EB E8 F6 E5 3A 20 ED E0 20 F7 F2 EE
20 EE E1 F0 E0 F2 E8 F2 FC 20 E2 ED E8 EC E0 ED E8 E5 2E 3C 62 72 3E
3C 62 72 3E 0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62 73 70
3B 26 6E 62 73 70 3B 95 20 CF EE F0 FF E4 EE EA 20 EF F0 EE E2 E5 F0
EA E8 20 D4 CE CF 2E 20 CA E0 EA 20 EC EE E6 ED EE 20 EE E1 E6 E0 EB
EE E2 E0 F2 FC 20 E0 EA F2 20 EF F0 EE E2 E5 F0 EA E8 2E 20 3C 62 72
3E 3C 62 72 3E 0D 0A 26 6E 62 73 70 3B 26 6E 62 73 70 3B 26 6E 62)
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:235)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:433)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:801)
        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:433)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:425)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:603)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:563)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:552)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:56)
        at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:891)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
        at java.nio.charset.CoderResult.throwException(CoderResult.java:260)
        at org.apache.mina.core.buffer.AbstractIoBuffer.getString(AbstractIoBuffer.java:1442)
        at org.apache.mina.filter.codec.textline.TextLineDecoder.decodeAuto(TextLineDecoder.java:207)
        at org.apache.mina.filter.codec.textline.TextLineDecoder.decode(TextLineDecoder.java:137)
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:225)
        ... 15 more


I'm not sure if its a bug or if its just some "random data" send to port 25.

Any idea whats going on ?

We using MINA-2.0.0-M6.

Thx,
Norman

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


Re: Problems with TextLineCodecFactory in SMTPServer

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Thu, Oct 29, 2009 at 7:09 PM, Norman Maurer <no...@apache.org> wrote:
> ProtocolCodecFilter codecFactory = new ProtocolCodecFilter(new
> TextLineCodecFactory(Charset.forName("US-ASCII")));
>
> That should be "safe" for the SMTPProtocol. So maybe some "SPAM-Bot"
> is just not getting it right and send an "invalid" formatted message.

The stuff you're getting sent is not ASCII :-)

/niklas

Re: Problems with TextLineCodecFactory in SMTPServer

Posted by Norman Maurer <no...@apache.org>.
Hi Niclas,

we use :

ProtocolCodecFilter codecFactory = new ProtocolCodecFilter(new
TextLineCodecFactory(Charset.forName("US-ASCII")));

That should be "safe" for the SMTPProtocol. So maybe some "SPAM-Bot"
is just not getting it right and send an "invalid" formatted message.

Bye,
Norman


2009/10/29 Niklas Gustavsson <ni...@protocol7.com>:
> On Thu, Oct 29, 2009 at 6:44 PM, Norman Maurer <no...@apache.org> wrote:
>> we started to use MINA in the JAMES SMTPServer. Everything works in
>> most cases, but sometimes I see the following error message:
>
> [snip hexdump]
>
> Contains some HTML, which I guess might be part of a multipart mail.
> What charset are you using in your decoder? The exception comes from
> the charset your using not being able to decode all the characters in
> the message.
>
> In the case of FtpServer we choose to catch these exceptions and
> return an error to the client saying that it was an invalid request.
>
> /niklas
>

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


Re: Problems with TextLineCodecFactory in SMTPServer

Posted by Norman Maurer <no...@apache.org>.
Hi Niclas,

we use :

ProtocolCodecFilter codecFactory = new ProtocolCodecFilter(new
TextLineCodecFactory(Charset.forName("US-ASCII")));

That should be "safe" for the SMTPProtocol. So maybe some "SPAM-Bot"
is just not getting it right and send an "invalid" formatted message.

Bye,
Norman


2009/10/29 Niklas Gustavsson <ni...@protocol7.com>:
> On Thu, Oct 29, 2009 at 6:44 PM, Norman Maurer <no...@apache.org> wrote:
>> we started to use MINA in the JAMES SMTPServer. Everything works in
>> most cases, but sometimes I see the following error message:
>
> [snip hexdump]
>
> Contains some HTML, which I guess might be part of a multipart mail.
> What charset are you using in your decoder? The exception comes from
> the charset your using not being able to decode all the characters in
> the message.
>
> In the case of FtpServer we choose to catch these exceptions and
> return an error to the client saying that it was an invalid request.
>
> /niklas
>

Re: Problems with TextLineCodecFactory in SMTPServer

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Thu, Oct 29, 2009 at 6:44 PM, Norman Maurer <no...@apache.org> wrote:
> we started to use MINA in the JAMES SMTPServer. Everything works in
> most cases, but sometimes I see the following error message:

[snip hexdump]

Contains some HTML, which I guess might be part of a multipart mail.
What charset are you using in your decoder? The exception comes from
the charset your using not being able to decode all the characters in
the message.

In the case of FtpServer we choose to catch these exceptions and
return an error to the client saying that it was an invalid request.

/niklas

Re: Problems with TextLineCodecFactory in SMTPServer

Posted by Emmanuel Lecharny <el...@apache.org>.
Norman Maurer wrote:
> Hi Emmanuel,
>
> you said:
>
> * you forgot to release the buffer once processed.
>
> So using the TextLineProtocolFactory why would I need to "release" the
> buffer ? I thought this get done already..
>   
Hmm, you are right.

I may have confused the length (1) of the badly encoded data with the 
buffer length.


What puzzle me is that we don't get the exact position the TextLine 
decoder is starting to decode something. The way it's suppose to work is 
that the decoder is called when the delimiter is met (\n), and then pass 
the buffer to the decoder. Here, the first lines of text seems to be 
correct ASCII, and we have to go past a few of them before getting 
non-ascii bytes...

IMO, the exception message must be improved...

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: Problems with TextLineCodecFactory in SMTPServer

Posted by Norman Maurer <no...@apache.org>.
Hi Emmanuel,

you said:

* you forgot to release the buffer once processed.

So using the TextLineProtocolFactory why would I need to "release" the
buffer ? I thought this get done already..

Thx again,
Norman


2009/10/29 Emmanuel Lecharny <el...@apache.org>:
> Hi Norman
>
> if I decypher the buffer, it contains :
>
> "t o p "   h e i g h t = " 2 0 "   b g c o l
> o r = " # 9 9 0 0 0 0 " > & n b s p ; < / t d
>> 0D 0A < / t r > 0D 0A < t r   h e i g h t = " 2
> 0 " >   0D 0A < t d   v a l i g n = " t o p " h e i g h t = " 2 0 "   b g c
> o l o r = " # 9
> 9 0 0 0 0 "   a l i g n = " c e n t e r " > 0D 0A < p > < b > < f o n t   c
> o l o r = " # F
> F F F F F " > 4   ED EE FF E1 F0 FF   2 0 0 9   E3 2E
> < b r > < b r > < / f o n t > < / b > < f o n
> t   f a c e = " T a h o m a "   s i z e = " 4
> "   c o l o r = " # F F F F F F " > < b > 09 0D
> 0A D7 F2 EE   ED F3 E6 ED EE   E7 ED E0 F2 FC   D7 C0 D1 D2 CD CE
> CC D3   CF D0 C5 C4 CF D0 C8 CD C8 CC C0 D2 C5 CB DE :   < / f
> o n t > 0D 0A < p   a l i g n = l e f t   > < f
> o n t   f a c e = " T a h o m a "   s i z e =
> " 2 "   c o l o r = " # F F F F F F " > < b >
> < b r > < b r > 0D 0A & n b s p ; & n b s p ; &
> n b s p ; & n b s p ; 95   C2 EA EB FE F7 E5 ED E8 E5 E2   E2 FB F0 F3 F7 EA
> F3   EF EE F1 F0 E5 E4 ED E8 EA EE E2   F2
> EE EB FC EA EE   EA EE EC E8 F1 F1 E8 EE ED ED EE E3 EE   E2 EE E7
> ED E0 E3 F0 E0 E6 E4 E5 ED E8 FF :   < b r > 0D 0A & n b s
> p ; & n b s p ; & n b s p ; & n b s p ; ED EE E2
> FB E5   E0 F0 E3 F3 EC E5 ED F2 FB 2C   EF E8 F1 FC EC E0   C3 CD
> C0 D3   F1   E8 FE EB FF   2 0 0 9 2E < b r > < b r >
> 0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
> s p ; 95   C2 FB E4 E0 F7 E0   E4 EE EA 2D F2 EE E2   ED E0 EF EE EA F3 EF
> EA F3   F2 EE E2 E0 F0 E0   28 F3 F1 EB F3 E3 29 96   ED EE E2 E0 FF   EF F0
> E0 EA F2 E8 EA E0   EF F0 EE E2 E5 F0
> EE EA   F1   EC E0 FF   2 0 0 9 2C   < b r > < b r >
> 0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
> s p ; 95   CE F2 F0 E0 E6 E5 ED E8 E5   E2 FB F0 F3 F7 EA E8 EF EE F1 EB E5
>   EA E0 E6 E4 EE E9   EE EF E5 F0 E0 F6 E8 E8 : EE F2 EA F3 E4 E0   E2 E7 FF
> EB EE F1 FC   F2 F0 E5 E1 EE E2 E0 ED
> E8 E5 2C   < b r > < b r > 0D 0A & n b s p ; & n b
> s p ; & n b s p ; & n b s p ; 95   D8 F2 F0 E0 F4 E7 E0   ED E5   F3 F7 E5
> F2   F2 EE E2 E0 F0 ED EE 2D EC E0 F2 E5
> F0 E8 E0 EB FC ED FB F5   F6 E5 ED ED EE F1 F2 E5 E9   < b r >
> 0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
> s p ; 2D   EF EE F7 E5 EC F3   EF EE EA E0   F0 E5 E4 EA EE EF F0 E8 EC E5
> ED FF E5 F2 F1 FF   ED E0   EF F0 E0 EA F2 E8 EA E5
> 2C < b r > 0D 0A & n b s p ; & n b s p ; & n b s
> p ; & n b s p ; EE F2 F1 F3 F2 F1 F2 E2 E8 E5   E4 EE EA F3
> EC E5 ED F2 EE E2   ED E0   EF F0 E8 F5 EE E4   F2 EE E2 E0 F0 E0
> 2C   < b r > < b r > 0D 0A & n b s p ; & n b s p
> ; & n b s p ; & n b s p ; 95   D1 EE E2 EC E5 F1 F2 ED
> E0 FF   E4 E5 FF F2 E5 EB FC ED EE F1 F2 FC   E3 F0 F3 EF EF FB F7 E0 F1 F2
> ED FB F5   EF F0 E5 E4 EF F0 E8 ED E8 EC E0 F2 E5 EB E5
> E9 :   < b r > 0D 0A & n b s p ; & n b s p ; & n
> b s p ; & n b s p ; F7 F2 EE   ED E8   E2   EA EE E5 EC
>  F1 EB F3 F7 E0 E5   ED E5 EB FC E7 FF   EF EE EA E0 E7 FB E2 E0
> F2 FC 2C   < b r > 0D 0A & n b s p ; & n b s p ; &
> n b s p ; & n b s p ; F0 E0 E1 EE F2 E0   EF EE E4   EE
> E4 ED EE E9   F2 EE F0 E3 EE E2 EE E9   EC E0 F0 EA EE E9 2C   F4
> F0 E0 ED F7 E0 E9 E7 E8 ED E3 2E < b r > < b r > 0D 0A & n
> b s p ; & n b s p ; & n b s p ; & n b s p ; 95
>  D4 CE CF / C4 E8 F0 E5 EA F2 EE F0 / D3 F7 F0 E5 E4 E8 F2 E5 EB
> FC 2D   E2   EE E4 ED EE EC   EB E8 F6 E5 :   ED E0   F7 F2 EE
>  EE E1 F0 E0 F2 E8 F2 FC   E2 ED E8 EC E0 ED E8 E5 2E < b r >
> < b r > 0D 0A & n b s p ; & n b s p ; & n b s p
> ; & n b s p ; 95   CF EE F0 FF E4 EE EA   EF F0 EE E2 E5 F0
> EA E8   D4 CE CF 2E   CA E0 EA   EC EE E6 ED EE   EE E1 E6 E0 EB
> EE E2 E0 F2 FC   E0 EA F2   EF F0 EE E2 E5 F0 EA E8 2E   < b r
>> < b r > 0D 0A & n b s p ; & n b s p ; & n b
>
>
> There are two options :
> - you received trash
> - you forgot to release the buffer once processed.
>
> In fact, the real problem is that MINA tries to decode the buffer as if it
> were a String (UTF-8) and found a sequence it can't decode as it's not
> valid. For instance, any of the bytes > 80 won't be considered as valid
> UTF-8 if they don't start with a Cx, Dx, Ex or Fx, and even then they have
> to be followed by other bytes.
>
> As the buffer length is supposed to be 1, depending on where the decoding
> starts in this buffer, it's very likely you get this exception.
>
> Hope it helps...
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>

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


Re: Problems with TextLineCodecFactory in SMTPServer

Posted by Norman Maurer <no...@apache.org>.
Hi Emmanuel,

you said:

* you forgot to release the buffer once processed.

So using the TextLineProtocolFactory why would I need to "release" the
buffer ? I thought this get done already..

Thx again,
Norman


2009/10/29 Emmanuel Lecharny <el...@apache.org>:
> Hi Norman
>
> if I decypher the buffer, it contains :
>
> "t o p "   h e i g h t = " 2 0 "   b g c o l
> o r = " # 9 9 0 0 0 0 " > & n b s p ; < / t d
>> 0D 0A < / t r > 0D 0A < t r   h e i g h t = " 2
> 0 " >   0D 0A < t d   v a l i g n = " t o p " h e i g h t = " 2 0 "   b g c
> o l o r = " # 9
> 9 0 0 0 0 "   a l i g n = " c e n t e r " > 0D 0A < p > < b > < f o n t   c
> o l o r = " # F
> F F F F F " > 4   ED EE FF E1 F0 FF   2 0 0 9   E3 2E
> < b r > < b r > < / f o n t > < / b > < f o n
> t   f a c e = " T a h o m a "   s i z e = " 4
> "   c o l o r = " # F F F F F F " > < b > 09 0D
> 0A D7 F2 EE   ED F3 E6 ED EE   E7 ED E0 F2 FC   D7 C0 D1 D2 CD CE
> CC D3   CF D0 C5 C4 CF D0 C8 CD C8 CC C0 D2 C5 CB DE :   < / f
> o n t > 0D 0A < p   a l i g n = l e f t   > < f
> o n t   f a c e = " T a h o m a "   s i z e =
> " 2 "   c o l o r = " # F F F F F F " > < b >
> < b r > < b r > 0D 0A & n b s p ; & n b s p ; &
> n b s p ; & n b s p ; 95   C2 EA EB FE F7 E5 ED E8 E5 E2   E2 FB F0 F3 F7 EA
> F3   EF EE F1 F0 E5 E4 ED E8 EA EE E2   F2
> EE EB FC EA EE   EA EE EC E8 F1 F1 E8 EE ED ED EE E3 EE   E2 EE E7
> ED E0 E3 F0 E0 E6 E4 E5 ED E8 FF :   < b r > 0D 0A & n b s
> p ; & n b s p ; & n b s p ; & n b s p ; ED EE E2
> FB E5   E0 F0 E3 F3 EC E5 ED F2 FB 2C   EF E8 F1 FC EC E0   C3 CD
> C0 D3   F1   E8 FE EB FF   2 0 0 9 2E < b r > < b r >
> 0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
> s p ; 95   C2 FB E4 E0 F7 E0   E4 EE EA 2D F2 EE E2   ED E0 EF EE EA F3 EF
> EA F3   F2 EE E2 E0 F0 E0   28 F3 F1 EB F3 E3 29 96   ED EE E2 E0 FF   EF F0
> E0 EA F2 E8 EA E0   EF F0 EE E2 E5 F0
> EE EA   F1   EC E0 FF   2 0 0 9 2C   < b r > < b r >
> 0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
> s p ; 95   CE F2 F0 E0 E6 E5 ED E8 E5   E2 FB F0 F3 F7 EA E8 EF EE F1 EB E5
>   EA E0 E6 E4 EE E9   EE EF E5 F0 E0 F6 E8 E8 : EE F2 EA F3 E4 E0   E2 E7 FF
> EB EE F1 FC   F2 F0 E5 E1 EE E2 E0 ED
> E8 E5 2C   < b r > < b r > 0D 0A & n b s p ; & n b
> s p ; & n b s p ; & n b s p ; 95   D8 F2 F0 E0 F4 E7 E0   ED E5   F3 F7 E5
> F2   F2 EE E2 E0 F0 ED EE 2D EC E0 F2 E5
> F0 E8 E0 EB FC ED FB F5   F6 E5 ED ED EE F1 F2 E5 E9   < b r >
> 0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
> s p ; 2D   EF EE F7 E5 EC F3   EF EE EA E0   F0 E5 E4 EA EE EF F0 E8 EC E5
> ED FF E5 F2 F1 FF   ED E0   EF F0 E0 EA F2 E8 EA E5
> 2C < b r > 0D 0A & n b s p ; & n b s p ; & n b s
> p ; & n b s p ; EE F2 F1 F3 F2 F1 F2 E2 E8 E5   E4 EE EA F3
> EC E5 ED F2 EE E2   ED E0   EF F0 E8 F5 EE E4   F2 EE E2 E0 F0 E0
> 2C   < b r > < b r > 0D 0A & n b s p ; & n b s p
> ; & n b s p ; & n b s p ; 95   D1 EE E2 EC E5 F1 F2 ED
> E0 FF   E4 E5 FF F2 E5 EB FC ED EE F1 F2 FC   E3 F0 F3 EF EF FB F7 E0 F1 F2
> ED FB F5   EF F0 E5 E4 EF F0 E8 ED E8 EC E0 F2 E5 EB E5
> E9 :   < b r > 0D 0A & n b s p ; & n b s p ; & n
> b s p ; & n b s p ; F7 F2 EE   ED E8   E2   EA EE E5 EC
>  F1 EB F3 F7 E0 E5   ED E5 EB FC E7 FF   EF EE EA E0 E7 FB E2 E0
> F2 FC 2C   < b r > 0D 0A & n b s p ; & n b s p ; &
> n b s p ; & n b s p ; F0 E0 E1 EE F2 E0   EF EE E4   EE
> E4 ED EE E9   F2 EE F0 E3 EE E2 EE E9   EC E0 F0 EA EE E9 2C   F4
> F0 E0 ED F7 E0 E9 E7 E8 ED E3 2E < b r > < b r > 0D 0A & n
> b s p ; & n b s p ; & n b s p ; & n b s p ; 95
>  D4 CE CF / C4 E8 F0 E5 EA F2 EE F0 / D3 F7 F0 E5 E4 E8 F2 E5 EB
> FC 2D   E2   EE E4 ED EE EC   EB E8 F6 E5 :   ED E0   F7 F2 EE
>  EE E1 F0 E0 F2 E8 F2 FC   E2 ED E8 EC E0 ED E8 E5 2E < b r >
> < b r > 0D 0A & n b s p ; & n b s p ; & n b s p
> ; & n b s p ; 95   CF EE F0 FF E4 EE EA   EF F0 EE E2 E5 F0
> EA E8   D4 CE CF 2E   CA E0 EA   EC EE E6 ED EE   EE E1 E6 E0 EB
> EE E2 E0 F2 FC   E0 EA F2   EF F0 EE E2 E5 F0 EA E8 2E   < b r
>> < b r > 0D 0A & n b s p ; & n b s p ; & n b
>
>
> There are two options :
> - you received trash
> - you forgot to release the buffer once processed.
>
> In fact, the real problem is that MINA tries to decode the buffer as if it
> were a String (UTF-8) and found a sequence it can't decode as it's not
> valid. For instance, any of the bytes > 80 won't be considered as valid
> UTF-8 if they don't start with a Cx, Dx, Ex or Fx, and even then they have
> to be followed by other bytes.
>
> As the buffer length is supposed to be 1, depending on where the decoding
> starts in this buffer, it's very likely you get this exception.
>
> Hope it helps...
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>

Re: Problems with TextLineCodecFactory in SMTPServer

Posted by Emmanuel Lecharny <el...@apache.org>.
Hi Norman

if I decypher the buffer, it contains :

"t o p "   h e i g h t = " 2 0 "   b g c o l
o r = " # 9 9 0 0 0 0 " > & n b s p ; < / t d
 > 0D 0A < / t r > 0D 0A < t r   h e i g h t = " 2
0 " >   0D 0A < t d   v a l i g n = " t o p " 
h e i g h t = " 2 0 "   b g c o l o r = " # 9
9 0 0 0 0 "   a l i g n = " c e n t e r " > 
0D 0A < p > < b > < f o n t   c o l o r = " # F
F F F F F " > 4   ED EE FF E1 F0 FF   2 0 0 9   E3 2E
< b r > < b r > < / f o n t > < / b > < f o n
t   f a c e = " T a h o m a "   s i z e = " 4
"   c o l o r = " # F F F F F F " > < b > 09 0D
0A D7 F2 EE   ED F3 E6 ED EE   E7 ED E0 F2 FC   D7 C0 D1 D2 CD CE
CC D3   CF D0 C5 C4 CF D0 C8 CD C8 CC C0 D2 C5 CB DE :   < / f
o n t > 0D 0A < p   a l i g n = l e f t   > < f
o n t   f a c e = " T a h o m a "   s i z e =
" 2 "   c o l o r = " # F F F F F F " > < b >
< b r > < b r > 0D 0A & n b s p ; & n b s p ; &
n b s p ; & n b s p ; 95   C2 EA EB FE F7 E5 ED E8 E5 
E2   E2 FB F0 F3 F7 EA F3   EF EE F1 F0 E5 E4 ED E8 EA EE E2   F2
EE EB FC EA EE   EA EE EC E8 F1 F1 E8 EE ED ED EE E3 EE   E2 EE E7
ED E0 E3 F0 E0 E6 E4 E5 ED E8 FF :   < b r > 0D 0A & n b s
p ; & n b s p ; & n b s p ; & n b s p ; ED EE E2
FB E5   E0 F0 E3 F3 EC E5 ED F2 FB 2C   EF E8 F1 FC EC E0   C3 CD
C0 D3   F1   E8 FE EB FF   2 0 0 9 2E < b r > < b r >
0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
s p ; 95   C2 FB E4 E0 F7 E0   E4 EE EA 2D F2 EE E2   ED E0 
EF EE EA F3 EF EA F3   F2 EE E2 E0 F0 E0   28 F3 F1 EB F3 E3 29 
96   ED EE E2 E0 FF   EF F0 E0 EA F2 E8 EA E0   EF F0 EE E2 E5 F0
EE EA   F1   EC E0 FF   2 0 0 9 2C   < b r > < b r >
0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
s p ; 95   CE F2 F0 E0 E6 E5 ED E8 E5   E2 FB F0 F3 F7 EA E8 
EF EE F1 EB E5   EA E0 E6 E4 EE E9   EE EF E5 F0 E0 F6 E8 E8 : 
EE F2 EA F3 E4 E0   E2 E7 FF EB EE F1 FC   F2 F0 E5 E1 EE E2 E0 ED
E8 E5 2C   < b r > < b r > 0D 0A & n b s p ; & n b
s p ; & n b s p ; & n b s p ; 95   D8 F2 F0 E0 F4 
E7 E0   ED E5   F3 F7 E5 F2   F2 EE E2 E0 F0 ED EE 2D EC E0 F2 E5
F0 E8 E0 EB FC ED FB F5   F6 E5 ED ED EE F1 F2 E5 E9   < b r >
0D 0A & n b s p ; & n b s p ; & n b s p ; & n b
s p ; 2D   EF EE F7 E5 EC F3   EF EE EA E0   F0 E5 E4 EA EE 
EF F0 E8 EC E5 ED FF E5 F2 F1 FF   ED E0   EF F0 E0 EA F2 E8 EA E5
2C < b r > 0D 0A & n b s p ; & n b s p ; & n b s
p ; & n b s p ; EE F2 F1 F3 F2 F1 F2 E2 E8 E5   E4 EE EA F3
EC E5 ED F2 EE E2   ED E0   EF F0 E8 F5 EE E4   F2 EE E2 E0 F0 E0
2C   < b r > < b r > 0D 0A & n b s p ; & n b s p
; & n b s p ; & n b s p ; 95   D1 EE E2 EC E5 F1 F2 ED
E0 FF   E4 E5 FF F2 E5 EB FC ED EE F1 F2 FC   E3 F0 F3 EF EF FB 
F7 E0 F1 F2 ED FB F5   EF F0 E5 E4 EF F0 E8 ED E8 EC E0 F2 E5 EB E5
E9 :   < b r > 0D 0A & n b s p ; & n b s p ; & n
b s p ; & n b s p ; F7 F2 EE   ED E8   E2   EA EE E5 EC
  F1 EB F3 F7 E0 E5   ED E5 EB FC E7 FF   EF EE EA E0 E7 FB E2 E0
F2 FC 2C   < b r > 0D 0A & n b s p ; & n b s p ; &
n b s p ; & n b s p ; F0 E0 E1 EE F2 E0   EF EE E4   EE
E4 ED EE E9   F2 EE F0 E3 EE E2 EE E9   EC E0 F0 EA EE E9 2C   F4
F0 E0 ED F7 E0 E9 E7 E8 ED E3 2E < b r > < b r > 0D 0A & n
b s p ; & n b s p ; & n b s p ; & n b s p ; 95
  D4 CE CF / C4 E8 F0 E5 EA F2 EE F0 / D3 F7 F0 E5 E4 E8 F2 E5 EB
FC 2D   E2   EE E4 ED EE EC   EB E8 F6 E5 :   ED E0   F7 F2 EE
  EE E1 F0 E0 F2 E8 F2 FC   E2 ED E8 EC E0 ED E8 E5 2E < b r >
< b r > 0D 0A & n b s p ; & n b s p ; & n b s p
; & n b s p ; 95   CF EE F0 FF E4 EE EA   EF F0 EE E2 E5 F0
EA E8   D4 CE CF 2E   CA E0 EA   EC EE E6 ED EE   EE E1 E6 E0 EB
EE E2 E0 F2 FC   E0 EA F2   EF F0 EE E2 E5 F0 EA E8 2E   < b r
 > < b r > 0D 0A & n b s p ; & n b s p ; & n b


There are two options :
- you received trash
- you forgot to release the buffer once processed.

In fact, the real problem is that MINA tries to decode the buffer as if 
it were a String (UTF-8) and found a sequence it can't decode as it's 
not valid. For instance, any of the bytes > 80 won't be considered as 
valid UTF-8 if they don't start with a Cx, Dx, Ex or Fx, and even then 
they have to be followed by other bytes.

As the buffer length is supposed to be 1, depending on where the 
decoding starts in this buffer, it's very likely you get this exception.

Hope it helps...

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org