james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject cvs commit: jakarta-james/src/java/org/apache/james/core MailHeaders.java MimeMessageWrapper.java
Date Tue, 11 Sep 2001 04:32:12 GMT
serge       01/09/10 21:32:12

  Modified:    src/java/org/apache/james/core MimeMessageWrapper.java
  Added:       src/java/org/apache/james/core MailHeaders.java
  Log:
  Moving MailHeaders from org.apache.james.core package.
  
  Revision  Changes    Path
  1.2       +3 -1      jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java
  
  Index: MimeMessageWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MimeMessageWrapper.java	2001/08/06 03:40:07	1.1
  +++ MimeMessageWrapper.java	2001/09/11 04:32:12	1.2
  @@ -6,7 +6,6 @@
   import javax.activation.*;
   import javax.mail.*;
   import javax.mail.internet.*;
  -import org.apache.james.MailHeaders;
   
   public class MimeMessageWrapper extends MimeMessage {
   
  @@ -374,6 +373,9 @@
       public int getLineCount() throws MessagingException {
           if (message == null) {
               loadMessage();
  +        }
  +        if (content == null) {
  +            return -1;
           }
           int size = content.length; // size of byte array
           int lineCount = 0;
  
  
  
  1.1                  jakarta-james/src/java/org/apache/james/core/MailHeaders.java
  
  Index: MailHeaders.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.james.core;
  
  import java.io.*;
  import java.text.*;
  import java.util.*;
  import javax.mail.internet.*;
  import javax.mail.MessagingException;
  
  /**
   * This interface defines a container for mail headers. Each header must use
   * MIME format: <pre>name: value</pre>.
   *
   * @author Federico Barbieri <scoobie@systemy.it>
   */
  public class MailHeaders extends InternetHeaders implements Serializable, Cloneable {
  
      public MailHeaders() throws MessagingException {
          super();
      }
  
      public MailHeaders(InputStream in) throws MessagingException {
          super(in);
      }
  
      public void writeTo(PrintStream writer) {
          for (Enumeration e = super.getAllHeaderLines(); e.hasMoreElements(); ) {
              writer.println((String) e.nextElement());
          }
          writer.println("");
      }
  
      public void writeTo(OutputStream out) {
          writeTo(new PrintStream(out));
      }
  
      public byte[] toByteArray() {
          ByteArrayOutputStream headersBytes = new ByteArrayOutputStream();
          writeTo(headersBytes);
          return headersBytes.toByteArray();
      }
  
      public boolean isSet(String name) {
          String[] value = super.getHeader(name);
          return (value != null && value.length != 0);
      }
  
      public boolean isValid() {
              // Check if MimeMessage contains REQUIRED headers fields as specified in RFC
822.
          return (isSet("Date") && isSet("To") && isSet("From"));
      }
  }
  
  
  

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


Mime
View raw message