Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 98675 invoked from network); 8 Mar 2006 17:52:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Mar 2006 17:52:28 -0000 Received: (qmail 15801 invoked by uid 500); 8 Mar 2006 17:52:25 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 15772 invoked by uid 500); 8 Mar 2006 17:52:25 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 15761 invoked by uid 99); 8 Mar 2006 17:52:25 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Mar 2006 09:52:25 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 08 Mar 2006 09:52:24 -0800 Received: (qmail 98225 invoked by uid 65534); 8 Mar 2006 17:52:01 -0000 Message-ID: <20060308175154.98187.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r384283 - in /geronimo/specs/trunk/geronimo-spec-javamail/src/main/java: javax/mail/Message.java javax/mail/Service.java org/apache/geronimo/mail/util/SessionUtil.java Date: Wed, 08 Mar 2006 17:51:45 -0000 To: scm@geronimo.apache.org From: jlaskowski@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jlaskowski Date: Wed Mar 8 09:51:44 2006 New Revision: 384283 URL: http://svn.apache.org/viewcvs?rev=384283&view=rev Log: GERONIMO-1707 java.mail.Message is not initializing the session information with the Folder constructors Modified: geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Message.java geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Service.java geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/SessionUtil.java Modified: geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Message.java URL: http://svn.apache.org/viewcvs/geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Message.java?rev=384283&r1=384282&r2=384283&view=diff ============================================================================== --- geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Message.java (original) +++ geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Message.java Wed Mar 8 09:51:44 2006 @@ -98,6 +98,8 @@ protected Message(Folder folder, int msgnum) { this.folder = folder; this.msgnum = msgnum; + // make sure we copy the session information from the folder. + this.session = folder.getStore().getSession(); } /** Modified: geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Service.java URL: http://svn.apache.org/viewcvs/geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Service.java?rev=384283&r1=384282&r2=384283&view=diff ============================================================================== --- geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Service.java (original) +++ geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/javax/mail/Service.java Wed Mar 8 09:51:44 2006 @@ -359,4 +359,15 @@ connectionListeners.clear(); super.finalize(); } + + + /** + * Package scope utility method to allow Message instances + * access to the Service's session. + * + * @return The Session the service is associated with. + */ + Session getSession() { + return session; + } } Modified: geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/SessionUtil.java URL: http://svn.apache.org/viewcvs/geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/SessionUtil.java?rev=384283&r1=384282&r2=384283&view=diff ============================================================================== --- geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/SessionUtil.java (original) +++ geronimo/specs/trunk/geronimo-spec-javamail/src/main/java/org/apache/geronimo/mail/util/SessionUtil.java Wed Mar 8 09:51:44 2006 @@ -32,13 +32,33 @@ * * @param session The attached session. * @param name The name of the property. + * + * @return The property value (returns null if the property has not been set). + */ + static public String getProperty(Session session, String name) { + // occasionally, we get called with a null session if an object is not attached to + // a session. In that case, treat this like an unknown parameter. + if (session == null) { + return null; + } + + return session.getProperty(name); + } + + + /** + * Get a property associated with this mail session. Returns + * the provided default if it doesn't exist. + * + * @param session The attached session. + * @param name The name of the property. * @param defaultValue * The default value to return if the property doesn't exist. * * @return The property value (returns defaultValue if the property has not been set). */ static public String getProperty(Session session, String name, String defaultValue) { - String result = session.getProperty(name); + String result = getProperty(session, name); if (result == null) { return defaultValue; } @@ -57,7 +77,7 @@ * other value (including null). */ static public boolean isPropertyTrue(Session session, String name) { - String property = session.getProperty(name); + String property = getProperty(session, name); if (property != null) { return property.equals("true"); } @@ -75,7 +95,7 @@ * other value (including null). */ static public boolean isPropertyFalse(Session session, String name) { - String property = session.getProperty(name); + String property = getProperty(session, name); if (property != null) { return property.equals("false"); } @@ -94,7 +114,7 @@ * @return The property value converted to an int. */ static public int getIntProperty(Session session, String name, int defaultValue) { - String result = session.getProperty(name); + String result = getProperty(session, name); if (result != null) { try { // convert into an int value. @@ -119,7 +139,7 @@ * @return The property value converted to a boolean. */ static public boolean getBooleanProperty(Session session, String name, boolean defaultValue) { - String result = session.getProperty(name); + String result = getProperty(session, name); if (result != null) { return Boolean.valueOf(result).booleanValue(); }