Coverage report

  %line %branch
com.ozacc.mail.fetch.impl.sk_jp.FirstPlainPartExtractor
0% 
0% 

 1  
 /*
 2  
  * @(#) $Id: FirstPlainPartExtractor.java,v 1.1.2.1 2004/09/29 00:57:59 otsuka Exp $
 3  
  * $Revision: 1.1.2.1 $
 4  
  * Copyright (c) 2000 Shin Kinoshita All Rights Reserved.
 5  
  */
 6  
 package com.ozacc.mail.fetch.impl.sk_jp;
 7  
 
 8  
 import java.io.IOException;
 9  
 import javax.mail.Part;
 10  
 import javax.mail.MessagingException;
 11  
 import javax.mail.internet.ContentType;
 12  
 
 13  
 /**
 14  
  * ºÇ½é¤Ë¸«¤Ä¤±¤¿text/plain¥Ñ¡¼¥È¤ÎËÜʸ¤òÆÀ¤?PartHandler¤Ç¤¹¡£
 15  
  * <P>
 16  
  * </P>
 17  
  * @version $Revision: 1.1.2.1 $ $Date: 2004/09/29 00:57:59 $
 18  
  * @author Shin
 19  
  */
 20  0
 public class FirstPlainPartExtractor implements PartHandler {
 21  
 
 22  0
 	private String text = null;
 23  
 
 24  
 	public boolean processPart(Part part, ContentType context) throws MessagingException,
 25  
 																IOException {
 26  0
 		String type = part.getContentType();
 27  
 		// Bug fixed. Thx > ei
 28  
 		// http://www.sk-jp.com/cgi-bin/treebbs.cgi?kako=1&all=1292&s=1292
 29  0
 		if (!part.isMimeType("text/plain") && type != null && !type.trim().equalsIgnoreCase("text")) {
 30  0
 			return true;
 31  
 		}
 32  0
 		text = (String)MultipartUtility.getContent(part);
 33  0
 		return false;
 34  
 	}
 35  
 
 36  
 	public String getText() {
 37  0
 		return text;
 38  
 	}
 39  
 
 40  
 	public static void main(String[] args) throws Exception {
 41  0
 		javax.mail.internet.MimeMessage msg = new javax.mail.internet.MimeMessage(
 42  0
 				javax.mail.Session.getDefaultInstance(System.getProperties(), null), System.in);
 43  0
 		FirstPlainPartExtractor h = new FirstPlainPartExtractor();
 44  0
 		MultipartUtility.process(msg, h);
 45  
 
 46  0
 		System.out.println("This is the first detected text/plain part.");
 47  0
 		System.out.println(h.getText());
 48  0
 	}
 49  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.