class cast exception
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sandeep_Ipte
Posted On:   Tuesday, May 22, 2001 07:49 AM

Why do I get java.lang.ClassCastException: com.sun.mail.imap.IMAPInputStream when writing contain of the message to browser(i.e via servletoutputStream). This exception is occured when I want to display a message of type "test/plain charset;". For other type, there is no problem.


the code I have write is for writing:


			
try{
// out is variabl of type servletoutputstream
out.println(( (String) message.getContent()));
} catch(Exception ee)
{ee.printStackTrace();}



with regards
sandeep Ipte

Re: class cast exception

Posted By:   John_Zukowski  
Posted On:   Tuesday, May 22, 2001 04:06 PM

Because the content isn't a String. There is no need to cast to a String the content. The toString() method will be called automatically for you....
About | Sitemap | Contact