src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEMessage.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -29,10 +29,11 @@
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.nio.ByteBuffer;
 import java.util.*;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
  * Represents MIME message. MIME message parsing is done lazily using a
  * pull parser.

@@ -102,21 +103,21 @@
      *
      * @param index sequential order of the part. starts with zero.
      * @return attachemnt part
      */
     public MIMEPart getPart(int index) {
-        LOGGER.fine("index="+index);
+        LOGGER.log(Level.FINE, "index={0}", index);
         MIMEPart part = (index < partsList.size()) ? partsList.get(index) : null;
         if (parsed && part == null) {
             throw new MIMEParsingException("There is no "+index+" attachment part ");
         }
         if (part == null) {
             // Parsing will done lazily and will be driven by reading the part
             part = new MIMEPart(this);
             partsList.add(index, part);
         }
-        LOGGER.fine("Got attachment at index="+index+" attachment="+part);
+        LOGGER.log(Level.FINE, "Got attachment at index={0} attachment={1}", new Object[]{index, part});
         return part;
     }
 
     /**
      * Creates a lazy attachment for a given Content-ID. It doesn't validate

@@ -126,21 +127,21 @@
      *
      * @param contentId Content-ID of the part, expects Content-ID without <, >
      * @return attachemnt part
      */
     public MIMEPart getPart(String contentId) {
-        LOGGER.fine("Content-ID="+contentId);
+        LOGGER.log(Level.FINE, "Content-ID={0}", contentId);
         MIMEPart part = getDecodedCidPart(contentId);
         if (parsed && part == null) {
             throw new MIMEParsingException("There is no attachment part with Content-ID = "+contentId);
         }
         if (part == null) {
             // Parsing is done lazily and is driven by reading the part
             part = new MIMEPart(this, contentId);
             partsMap.put(contentId, part);
         }
-        LOGGER.fine("Got attachment for Content-ID="+contentId+" attachment="+part);
+        LOGGER.log(Level.FINE, "Got attachment for Content-ID={0} attachment={1}", new Object[]{contentId, part});
         return part;
     }
 
     // this is required for Indigo interop, it writes content-id without escaping
     private MIMEPart getDecodedCidPart(String cid) {

@@ -160,11 +161,11 @@
 
 
     /**
      * Parses the whole MIME message eagerly
      */
-    public void parseAll() {
+    public final void parseAll() {
         while(makeProgress()) {
             // Nothing to do
         }
     }
 

@@ -182,19 +183,19 @@
 
         MIMEEvent event = it.next();
 
         switch(event.getEventType()) {
             case START_MESSAGE :
-                LOGGER.fine("MIMEEvent="+MIMEEvent.EVENT_TYPE.START_MESSAGE);
+                LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_MESSAGE);
                 break;
 
             case START_PART :
-                LOGGER.fine("MIMEEvent="+MIMEEvent.EVENT_TYPE.START_PART);
+                LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_PART);
                 break;
 
             case HEADERS :
-                LOGGER.fine("MIMEEvent="+MIMEEvent.EVENT_TYPE.HEADERS);
+                LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.HEADERS);
                 MIMEEvent.Headers headers = (MIMEEvent.Headers)event;
                 InternetHeaders ih = headers.getHeaders();
                 List<String> cids = ih.getHeader("content-id");
                 String cid = (cids != null) ? cids.get(0) : currentIndex+"";
                 if (cid.length() > 2 && cid.charAt(0)=='<') {

@@ -217,24 +218,24 @@
                 }
                 currentPart.setHeaders(ih);
                 break;
 
             case CONTENT :
-                LOGGER.finer("MIMEEvent="+MIMEEvent.EVENT_TYPE.CONTENT);
+                LOGGER.log(Level.FINER, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.CONTENT);
                 MIMEEvent.Content content = (MIMEEvent.Content)event;
                 ByteBuffer buf = content.getData();
                 currentPart.addBody(buf);
                 break;
 
             case END_PART :
-                LOGGER.fine("MIMEEvent="+MIMEEvent.EVENT_TYPE.END_PART);
+                LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_PART);
                 currentPart.doneParsing();
                 ++currentIndex;
                 break;
 
             case END_MESSAGE :
-                LOGGER.fine("MIMEEvent="+MIMEEvent.EVENT_TYPE.END_MESSAGE);
+                LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_MESSAGE);
                 parsed = true;
                 try {
                     in.close();
                 } catch(IOException ioe) {
                     throw new MIMEParsingException(ioe);