From: <san...@us...> - 2007-07-18 20:46:44
|
Revision: 32 http://svn.sourceforge.net/gatormail/?rev=32&view=rev Author: sandymac Date: 2007-07-18 12:55:30 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Fix for create folder issue Modified Paths: -------------- GatorMail/trunk/build.xml GatorMail/trunk/src/Messages.properties GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/ActionsUtil.java GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/CreateFolderAction.java GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/PerformDeleteFolderAction.java Modified: GatorMail/trunk/build.xml =================================================================== --- GatorMail/trunk/build.xml 2007-07-10 18:56:07 UTC (rev 31) +++ GatorMail/trunk/build.xml 2007-07-18 19:55:30 UTC (rev 32) @@ -19,7 +19,7 @@ <property name="gatormail.jdbc.url" value="" description="depricated"/> <property name="gatormail.attachment.path" value="" description="Local path to hold attachments until they are sent."/> - <property name="VERSION" value="1.0.21"/> + <property name="VERSION" value="1.0.22"/> <tstamp/> Modified: GatorMail/trunk/src/Messages.properties =================================================================== --- GatorMail/trunk/src/Messages.properties 2007-07-10 18:56:07 UTC (rev 31) +++ GatorMail/trunk/src/Messages.properties 2007-07-18 19:55:30 UTC (rev 32) @@ -90,6 +90,7 @@ error.attachment.required=No attachment was selected. error.changeSubscription.unsubscribe.inbox=You cannot unsubscribe your INBOX. error.compose.to.required=The To: field cannot be blank. +error.createFolder.newFolder=Error creating new folder with name: {0}. error.createFolder.newFolder.required=Please enter the name of a new folder. error.createFolder.newFolder.toolong=The new folder name is too long. Please keep it to {0} or less characters. error.createFolder.parentFolder.required=Please select the name of the parent folder. Modified: GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/ActionsUtil.java =================================================================== --- GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/ActionsUtil.java 2007-07-10 18:56:07 UTC (rev 31) +++ GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/ActionsUtil.java 2007-07-18 19:55:30 UTC (rev 32) @@ -94,7 +94,7 @@ * @throws InvalidSessionException If the user's session is out of wack for * some reason. */ - public static void checkSession(final HttpServletRequest request) throws SessionExpiredException, InvalidSessionException, NoSuchProviderException { + public static void checkSession(final HttpServletRequest request) throws InvalidSessionException, NoSuchProviderException { final HttpSession session = request.getSession(); // Cheeze hack to let us track how long a request took. @@ -489,7 +489,7 @@ } // is this folder to be restricted from the list? - private static boolean isFolderIncluded(final Folder folder, final boolean includeReserved, HttpSession session) throws MessagingException { + private static boolean isFolderIncluded(final Folder folder, final boolean includeReserved, final HttpSession session) throws MessagingException { return (!(!includeReserved && Util.isReservedFolder(folder.getFullName(), session))); } @@ -705,7 +705,7 @@ /** * Returned folder is always open. */ - protected final static Folder createFolder(final Folder folder) throws MessagingException { + protected static Folder createFolder(final Folder folder) throws MessagingException { logger.debug("creating new folder: " + folder.getFullName()); folder.create(Folder.HOLDS_FOLDERS | Folder.HOLDS_MESSAGES); @@ -724,22 +724,8 @@ * The returned List may be smaller than the passed in array, if * one or more of the Messages is null or expunged. */ - protected final static List buildMessageList(final Message[] messages) throws MessagingException { - // Get the Messages in the folder - final List messageList = new ArrayList(Arrays.asList(messages)); - - // Remove any expunged messages, to prevent a NullPointerException - /* - final ListIterator it = messageList.listIterator(); - while (it.hasNext()) { - final Message message = (Message)it.next(); - if (message == null || message.isExpunged() || message.isSet(Flags.Flag.DELETED)) { - it.remove(); - } - } - */ - - return messageList; + protected static List buildMessageList(final Message[] messages) throws MessagingException { + return new ArrayList(Arrays.asList(messages)); } /** Modified: GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/CreateFolderAction.java =================================================================== --- GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/CreateFolderAction.java 2007-07-10 18:56:07 UTC (rev 31) +++ GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/CreateFolderAction.java 2007-07-18 19:55:30 UTC (rev 32) @@ -31,8 +31,10 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionError; import javax.mail.Folder; +import javax.mail.FolderNotFoundException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @@ -72,10 +74,12 @@ final String parentFolderName = newFolderForm.getFolder(); final String newFolderName = newFolderForm.getNewFolder(); + /* if (!ActionsUtil.isLegalNewFolder(newFolderName, parentFolderName, errors, request)) { saveErrors(request, errors); return mapping.findForward("fail"); } + */ // OK looks good. let's create that folder Folder parentFolder = null; @@ -90,6 +94,10 @@ try { ActionsUtil.flushMailStoreGroupCache(request.getSession()); ActionsUtil.createFolder(newFolder); // creates & opens newFolder + } catch (FolderNotFoundException fnfe) { + errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.createFolder.newFolder", newFolder.getFullName())); + saveErrors(request, errors); + return mapping.findForward("fail"); } finally { Util.releaseFolder(newFolder); // clean up } Modified: GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/PerformDeleteFolderAction.java =================================================================== --- GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/PerformDeleteFolderAction.java 2007-07-10 18:56:07 UTC (rev 31) +++ GatorMail/trunk/src/java/edu/ufl/osg/webmail/actions/PerformDeleteFolderAction.java 2007-07-18 19:55:30 UTC (rev 32) @@ -32,6 +32,7 @@ import org.apache.struts.actions.LookupDispatchAction; import javax.mail.Folder; +import javax.mail.MessagingException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @@ -131,6 +132,12 @@ // folder must be closed for delete folder.close(true); + try { + folder.setSubscribed(false); + } catch (MessagingException e) { + // swallowed + } + // recursive delete is OK - if the user didn't check "deleteChildren" and there // were children, the form validation would have caught that. folder.delete(true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |