Re: Problems with TextLineCodecFactory in SMTPServer

2009-10-29 Thread Niklas Gustavsson
On Thu, Oct 29, 2009 at 6:44 PM, Norman Maurer nor...@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

2009-10-29 Thread Emmanuel Lecharny

Hi Norman

if I decypher the buffer, it contains :

t o ph e i g h t =  2 0b g c o l
o r =  # 9 9 0 0 0 0n 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 0b g c o l o r =  # 9
9 0 0 0 0a 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 as i z e =  4
   c o l o r =  # F F F F F Fb  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 as i z e =
 2c o l o r =  # F F F F F Fb 
 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 2Cb 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 2Cb 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 E9b 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
2Cb 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 2Cb 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 2Eb 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