james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From man...@apache.org
Subject svn commit: r882215 - in /james/hupa/trunk: client/src/main/java/org/apache/hupa/client/mvp/ server/src/main/java/org/apache/hupa/server/handler/ server/src/main/java/org/apache/hupa/server/mock/ server/src/main/java/org/apache/hupa/server/servlet/ ser...
Date Thu, 19 Nov 2009 17:36:13 GMT
Author: manolo
Date: Thu Nov 19 17:36:12 2009
New Revision: 882215

URL: http://svn.apache.org/viewvc?rev=882215&view=rev
Log:
substitute tabs by spaces

Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/FetchFoldersHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/DownloadAttachmentServlet.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/HupaDispatchServlet.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/DemoModeTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbstractHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/servlet/DownloadAttachmentServletTest.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/SConsts.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFoldersResult.java

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java Thu Nov 19 17:36:12 2009
@@ -119,10 +119,10 @@
     
     @Inject
     public IMAPMessageListView(final PagingScrollTableRowDragController controller, final MessageTableModel mTableModel, final HupaConstants constants, final HupaMessages messages, final HupaImageBundle imageBundle) {
-    	this.messages = messages;
-    	this.imageBundle = imageBundle;
-    	
-    	deleteMailButton = new EnableButton(constants.deleteMailButton());
+        this.messages = messages;
+        this.imageBundle = imageBundle;
+        
+        deleteMailButton = new EnableButton(constants.deleteMailButton());
         newMailButton = new Button(constants.newMailButton());
         deleteAllMailButton = new Button(constants.deleteAll());
         markSeenButton = new EnableButton(constants.markSeen());
@@ -135,11 +135,11 @@
         this.cTableModel = new CachedTableModel<Message>(mTableModel);
         cTableModel.setRowCount(MutableTableModel.UNKNOWN_ROW_COUNT);
         mTableModel.addRowCountChangeHandler(new RowCountChangeHandler() {
-			
-			public void onRowCountChange(RowCountChangeEvent event) {
-				cTableModel.setRowCount(event.getNewRowCount());
-			}
-		});
+            
+            public void onRowCountChange(RowCountChangeEvent event) {
+                cTableModel.setRowCount(event.getNewRowCount());
+            }
+        });
         VerticalPanel vPanel = new VerticalPanel();
         mailTable = new DragRefetchPagingScrollTable<Message>(
                 cTableModel, dataTable, new FixedWidthFlexTable(),

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java Thu Nov 19 17:36:12 2009
@@ -51,56 +51,56 @@
  */
 public class MessageTableModel extends MutableTableModel<Message> {
 
-	private EventBus eventBus;
-	private DispatchAsync dispatcher;
-	private User user;
-	private IMAPFolder folder;
-	private String searchValue;
-
-	@Inject
-	public MessageTableModel(EventBus eventBus, DispatchAsync dispatcher){
-		
-		this.eventBus = eventBus;
-		this.dispatcher = dispatcher;
-
-		// bind some Events 
-		eventBus.addHandler(LoadMessagesEvent.TYPE, new LoadMessagesEventHandler() {
-			
-			public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent) {
-				user = loadMessagesEvent.getUser();
-				folder = loadMessagesEvent.getFolder();
-				searchValue = loadMessagesEvent.getSearchValue();
-			}
-		});
-		eventBus.addHandler(FolderSelectionEvent.TYPE, new FolderSelectionEventHandler() {
-			
-			public void onFolderSelectionEvent(FolderSelectionEvent event) {
-				user = event.getUser();
-				folder = event.getFolder();
-				searchValue = null;
-			}
-		});
-		eventBus.addHandler(LoginEvent.TYPE, new LoginEventHandler() {
-			
-			public void onLogin(LoginEvent event) {
-				user = event.getUser();
-				folder = new IMAPFolder(user.getSettings().getInboxFolderName());
-				searchValue = null;
-			}
-		});
-		eventBus.addHandler(LogoutEvent.TYPE, new LogoutEventHandler() {
-			
-			public void onLogout(LogoutEvent logoutEvent) {
-				user = null;
-				folder = null;
-				searchValue = null;
-			}
-		});
-		
-		
-	}
+    private EventBus eventBus;
+    private DispatchAsync dispatcher;
+    private User user;
+    private IMAPFolder folder;
+    private String searchValue;
 
-	@Override 
+    @Inject
+    public MessageTableModel(EventBus eventBus, DispatchAsync dispatcher){
+        
+        this.eventBus = eventBus;
+        this.dispatcher = dispatcher;
+
+        // bind some Events 
+        eventBus.addHandler(LoadMessagesEvent.TYPE, new LoadMessagesEventHandler() {
+            
+            public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent) {
+                user = loadMessagesEvent.getUser();
+                folder = loadMessagesEvent.getFolder();
+                searchValue = loadMessagesEvent.getSearchValue();
+            }
+        });
+        eventBus.addHandler(FolderSelectionEvent.TYPE, new FolderSelectionEventHandler() {
+            
+            public void onFolderSelectionEvent(FolderSelectionEvent event) {
+                user = event.getUser();
+                folder = event.getFolder();
+                searchValue = null;
+            }
+        });
+        eventBus.addHandler(LoginEvent.TYPE, new LoginEventHandler() {
+            
+            public void onLogin(LoginEvent event) {
+                user = event.getUser();
+                folder = new IMAPFolder(user.getSettings().getInboxFolderName());
+                searchValue = null;
+            }
+        });
+        eventBus.addHandler(LogoutEvent.TYPE, new LogoutEventHandler() {
+            
+            public void onLogout(LogoutEvent logoutEvent) {
+                user = null;
+                folder = null;
+                searchValue = null;
+            }
+        });
+        
+        
+    }
+
+    @Override 
     public void requestRows(
             final Request request,
             final com.google.gwt.gen2.table.client.TableModel.Callback<Message> callback) {
@@ -119,10 +119,10 @@
         
         dispatcher.execute(new FetchMessages(folder, request.getStartRow(), request.getNumRows(), searchValue),new HupaCallback<FetchMessagesResult>(dispatcher, eventBus) {
             public void callback(final FetchMessagesResult result) {
-            	// Update folder information before notifying presenter
-            	folder.setMessageCount(result.getRealCount());
-            	folder.setUnseenMessageCount(result.getRealUnreadCount());
-            	// Notify presenter to update folder tree view
+                // Update folder information before notifying presenter
+                folder.setMessageCount(result.getRealCount());
+                folder.setUnseenMessageCount(result.getRealUnreadCount());
+                // Notify presenter to update folder tree view
                 eventBus.fireEvent(new MessagesReceivedEvent(folder, result.getMessages()));
                 TableModelHelper.Response<Message> response = new TableModelHelper.Response<Message>() {
                     @Override

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java Thu Nov 19 17:36:12 2009
@@ -61,7 +61,7 @@
         User user = getUser();
         IMAPFolder folder = action.getFolder();
         if (folder == null) {
-        	folder = new IMAPFolder(user.getSettings().getInboxFolderName());
+            folder = new IMAPFolder(user.getSettings().getInboxFolderName());
         }
         com.sun.mail.imap.IMAPFolder f = null;
         try {
@@ -88,7 +88,7 @@
             return new FetchMessagesResult(convert(offset, f, messages),start, offset,exists,f.getUnreadMessageCount());
             
         } catch (Exception e) {
-        	e.printStackTrace();
+            e.printStackTrace();
             logger.error("Error while fetching headers for user " + user.getName() + " in folder " + folder,e);
             throw new ActionException(
                     "Error while fetching headers for user " + user.getName() + " in folder " + folder);

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/FetchFoldersHandler.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/FetchFoldersHandler.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/FetchFoldersHandler.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/FetchFoldersHandler.java Thu Nov 19 17:36:12 2009
@@ -97,7 +97,7 @@
      */
     private IMAPFolder createFolder(Folder folder) {
 
-    	String fullName = folder.getFullName();
+        String fullName = folder.getFullName();
         String delimiter;
         IMAPFolder iFolder = null;
         
@@ -106,7 +106,7 @@
             iFolder = new IMAPFolder(fullName);
             iFolder.setDelimiter(delimiter);
             if("[Gmail]".equals(folder.getFullName()))
-            	return iFolder;
+                return iFolder;
             iFolder.setMessageCount(folder.getMessageCount());
             iFolder.setSubscribed(folder.isSubscribed());
             iFolder.setUnseenMessageCount(folder.getUnreadMessageCount());

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java Thu Nov 19 17:36:12 2009
@@ -122,30 +122,30 @@
         }
     }
 
-	protected MessageDetails mimeToDetails(MimeMessage message, String folderName, long uid)
+    protected MessageDetails mimeToDetails(MimeMessage message, String folderName, long uid)
             throws IOException, MessagingException,
             UnsupportedEncodingException {
-	    MessageDetails mDetails = new MessageDetails();
+        MessageDetails mDetails = new MessageDetails();
 
-	    
-	    Object con = message.getContent();
+        
+        Object con = message.getContent();
 
-	    StringBuffer sbPlain = new StringBuffer();
-	    ArrayList<MessageAttachment> attachmentList = new ArrayList<MessageAttachment>();
+        StringBuffer sbPlain = new StringBuffer();
+        ArrayList<MessageAttachment> attachmentList = new ArrayList<MessageAttachment>();
 
-	    
-	    boolean isHTML = handleParts(message, con, sbPlain, attachmentList);
+        
+        boolean isHTML = handleParts(message, con, sbPlain, attachmentList);
 
         if (isHTML) {
-        	mDetails.setText(filterHtmlDocument(sbPlain.toString(), folderName, uid));
+            mDetails.setText(filterHtmlDocument(sbPlain.toString(), folderName, uid));
         } else {
-        	mDetails.setText(txtDocumentToHtml(sbPlain.toString(), folderName, uid));
+            mDetails.setText(txtDocumentToHtml(sbPlain.toString(), folderName, uid));
         }
 
-	    mDetails.setMessageAttachments(attachmentList);
+        mDetails.setMessageAttachments(attachmentList);
 
-	    mDetails.setRawHeader(message.getAllHeaders().toString());
-	    return mDetails;
+        mDetails.setRawHeader(message.getAllHeaders().toString());
+        return mDetails;
     }
 
     /**
@@ -163,7 +163,7 @@
             ArrayList<MessageAttachment> attachmentList)
             throws UnsupportedEncodingException, MessagingException,
             IOException {
-    	boolean isHTML = false;
+        boolean isHTML = false;
         if (con instanceof String) {
             if (message.getContentType().startsWith("text/html")) {
                 isHTML = true;
@@ -213,7 +213,7 @@
 
                 }
                 if (text != null)
-                	sbPlain.append(text);
+                    sbPlain.append(text);
             }
 
         }

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java Thu Nov 19 17:36:12 2009
@@ -45,24 +45,24 @@
 public class MockIMAPFolder extends IMAPFolder {
 
     public static final char SEPARATOR = '.';
-	public static final String DEMO_MODE_SENT_FOLDER = "Demo-Sent";
-	public static final String DEMO_MODE_TRASH_FOLDER = "Demo-Trash";
-	public static final String DEMO_MODE_INBOX_FOLDER = "Demo-Inbox";
-	public static final String DEMO_MODE_DEFAULT_FOLDER = "";
-	public static final String DEMO_MODE_MESSAGES_LOCATION = "mime/";
+    public static final String DEMO_MODE_SENT_FOLDER = "Demo-Sent";
+    public static final String DEMO_MODE_TRASH_FOLDER = "Demo-Trash";
+    public static final String DEMO_MODE_INBOX_FOLDER = "Demo-Inbox";
+    public static final String DEMO_MODE_DEFAULT_FOLDER = "";
+    public static final String DEMO_MODE_MESSAGES_LOCATION = "mime/";
 
-	public List<Message> messages = new ArrayList<Message>();
+    public List<Message> messages = new ArrayList<Message>();
     private boolean closed;
     private boolean exists;
     
     public final static Settings mockSettings = new Settings() {
-		private static final long serialVersionUID = -6650449479903482066L;
-		{
-			setInboxFolderName(MockIMAPFolder.DEMO_MODE_INBOX_FOLDER);
-			setSentFolderName(MockIMAPFolder.DEMO_MODE_SENT_FOLDER);
-			setTrashFolderName(MockIMAPFolder.DEMO_MODE_TRASH_FOLDER);
-		}
-	};
+        private static final long serialVersionUID = -6650449479903482066L;
+        {
+            setInboxFolderName(MockIMAPFolder.DEMO_MODE_INBOX_FOLDER);
+            setSentFolderName(MockIMAPFolder.DEMO_MODE_SENT_FOLDER);
+            setTrashFolderName(MockIMAPFolder.DEMO_MODE_TRASH_FOLDER);
+        }
+    };
 
     public MockIMAPFolder(String fullName, IMAPStore store) {
         super(fullName, (DEMO_MODE_DEFAULT_FOLDER.equals(fullName) ? '\0' : SEPARATOR), store);
@@ -78,7 +78,7 @@
     
     @Override
     public void appendMessages(Message[] msgs) throws MessagingException {
-    	addMessages(msgs);
+        addMessages(msgs);
     }
 
     @Override
@@ -102,18 +102,18 @@
     }
     
     public void loadDemoMessages(Session session) {
-    	for(int i=0;;i++) {
-        	URL url = Thread.currentThread().getContextClassLoader().getResource(DEMO_MODE_MESSAGES_LOCATION + i + ".msg");
-        	if (url == null) break;
-    		try {
-	            FileInputStream is = new FileInputStream(url.getFile());
-	            addMessages(new Message[]{new MimeMessage(session, is)});
+        for(int i=0;;i++) {
+            URL url = Thread.currentThread().getContextClassLoader().getResource(DEMO_MODE_MESSAGES_LOCATION + i + ".msg");
+            if (url == null) break;
+            try {
+                FileInputStream is = new FileInputStream(url.getFile());
+                addMessages(new Message[]{new MimeMessage(session, is)});
             } catch (MessagingException e) {
-	            e.printStackTrace();
+                e.printStackTrace();
             } catch (FileNotFoundException e) {
-	            e.printStackTrace();
+                e.printStackTrace();
             }
-    	}
+        }
     }
 
     @Override
@@ -354,11 +354,11 @@
 
     @Override
     public synchronized int getUnreadMessageCount() throws MessagingException {
-    	int ret = getMessageCount();
-    	for (Message msg: messages) {
-    		if (msg.getFlags().contains(Flag.SEEN))
-    			ret --;
-    	}
+        int ret = getMessageCount();
+        for (Message msg: messages) {
+            if (msg.getFlags().contains(Flag.SEEN))
+                ret --;
+        }
         return ret;
     }
 

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java Thu Nov 19 17:36:12 2009
@@ -64,7 +64,7 @@
                 new MockIMAPFolder(MockIMAPFolder.DEMO_MODE_TRASH_FOLDER, this).create(Folder.HOLDS_FOLDERS | Folder.HOLDS_MESSAGES);
                 ((MockIMAPFolder)getFolder(MockIMAPFolder.DEMO_MODE_INBOX_FOLDER)).loadDemoMessages(session);
             } catch (Exception e) {
-            	e.printStackTrace();
+                e.printStackTrace();
             }
         }
     }
@@ -111,25 +111,25 @@
     }
     
     public List<MockIMAPFolder> getChilds(MockIMAPFolder folder) {
-		List<MockIMAPFolder> childs = new ArrayList<MockIMAPFolder>();
-		if (MockIMAPFolder.DEMO_MODE_DEFAULT_FOLDER.equals(folder.getFullName())) {
-			for(MockIMAPFolder f: folders) {
-				if (! MockIMAPFolder.DEMO_MODE_DEFAULT_FOLDER.equals(f.getFullName()))
-					childs.add(f);
-			}
-			return folders;
-		} else {
-			for (int i = 0; i < folders.size(); i++) {
-				MockIMAPFolder f = folders.get(i);
-				if (f.getFullName().startsWith(
-				        folder.getFullName() + MockIMAPFolder.SEPARATOR)) {
-					childs.add(f);
-					
-				}
-			}
-		}
-		return childs;
-	}
+        List<MockIMAPFolder> childs = new ArrayList<MockIMAPFolder>();
+        if (MockIMAPFolder.DEMO_MODE_DEFAULT_FOLDER.equals(folder.getFullName())) {
+            for(MockIMAPFolder f: folders) {
+                if (! MockIMAPFolder.DEMO_MODE_DEFAULT_FOLDER.equals(f.getFullName()))
+                    childs.add(f);
+            }
+            return folders;
+        } else {
+            for (int i = 0; i < folders.size(); i++) {
+                MockIMAPFolder f = folders.get(i);
+                if (f.getFullName().startsWith(
+                        folder.getFullName() + MockIMAPFolder.SEPARATOR)) {
+                    childs.add(f);
+                    
+                }
+            }
+        }
+        return childs;
+    }
     
     public void setValidLogins(Map<String,String> validLogins) {
         this.validLogins = validLogins;
@@ -153,7 +153,7 @@
 
     @Override
     public synchronized Folder getDefaultFolder() throws MessagingException {
-    	return getFolder(MockIMAPFolder.DEMO_MODE_DEFAULT_FOLDER);
+        return getFolder(MockIMAPFolder.DEMO_MODE_DEFAULT_FOLDER);
     }
 
     @Override
@@ -189,7 +189,7 @@
         if (myPort != null && myPort.intValue() == port) {
             connect(username,password);
         } else {
-        	throw new MessagingException("Can't connect to host");
+            throw new MessagingException("Can't connect to host");
         }
     }
 

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/DownloadAttachmentServlet.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/DownloadAttachmentServlet.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/DownloadAttachmentServlet.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/DownloadAttachmentServlet.java Thu Nov 19 17:36:12 2009
@@ -75,11 +75,11 @@
     @Override
     protected void doGet(HttpServletRequest request,
             HttpServletResponse response) throws ServletException, IOException {
-    	
-    	User user = (User) request.getSession().getAttribute("user");
-    	if (user == null)
-    		throw new ServletException("Invalid session");
-    	
+        
+        User user = (User) request.getSession().getAttribute("user");
+        if (user == null)
+            throw new ServletException("Invalid session");
+        
         String message_uuid = request.getParameter(SConsts.PARAM_UID);
         String attachmentName = request.getParameter(SConsts.PARAM_NAME);
         String folderName = request.getParameter(SConsts.PARAM_FOLDER);
@@ -100,7 +100,7 @@
             Object content = m.getContent();
             Part part  = handleMultiPart(content, attachmentName);
             if (part.getContentType()!=null)
-            	response.setContentType(part.getContentType());
+                response.setContentType(part.getContentType());
             else
                 response.setContentType("application/download");
             
@@ -174,23 +174,23 @@
                 if (bodyPart.isMimeType("multipart/*")) {
                     Part p = handleMultiPart(bodyPart.getContent(), attachmentName);
                     if (p != null)
-                    	return p;
+                        return p;
                 } else {
-                	if (contentId != null) {
-                    	for (String id: contentId) {
-                    		id = id.replaceAll("^.*<(.+)>.*$", "$1");
-                    		if (attachmentName.equals(id))
-                    			return bodyPart;
-                    	}
+                    if (contentId != null) {
+                        for (String id: contentId) {
+                            id = id.replaceAll("^.*<(.+)>.*$", "$1");
+                            if (attachmentName.equals(id))
+                                return bodyPart;
+                        }
                     } 
-                	if (fileName != null){
+                    if (fileName != null){
                         if (attachmentName.equalsIgnoreCase(MimeUtility.decodeText(fileName))) 
                             return bodyPart;
                     }
                 } 
             }
         } else {
-        	System.out.println("Unknown content: " + content.getClass().getName());
+            System.out.println("Unknown content: " + content.getClass().getName());
         }
         return null;
     }

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/HupaDispatchServlet.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/HupaDispatchServlet.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/HupaDispatchServlet.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/HupaDispatchServlet.java Thu Nov 19 17:36:12 2009
@@ -36,32 +36,32 @@
  */
 @Singleton
 public class HupaDispatchServlet extends DispatchServiceServlet {
-	
-	private Log logger;
-	
-	@Inject
+    
+    private Log logger;
+    
+    @Inject
     public HupaDispatchServlet( Dispatch dispatch, Log logger) {
-    	super(dispatch);
-    	this.logger = logger;
+        super(dispatch);
+        this.logger = logger;
     }
 
     
     @Override
     public Result execute( Action<?> action ) throws ActionException {
-    	try {
-        	logger.info("HupaDispatchServlet: executing: " + action.getClass().getName().replaceAll("^.*\\.",""));
-        	return super.execute(action);
+        try {
+            logger.info("HupaDispatchServlet: executing: " + action.getClass().getName().replaceAll("^.*\\.",""));
+            return super.execute(action);
         } catch (ActionException e) {
-        	logger.error("HupaDispatchServlet returns an ActionException:" + e.getMessage());
-        	e.printStackTrace();
-        	throw e;
+            logger.error("HupaDispatchServlet returns an ActionException:" + e.getMessage());
+            e.printStackTrace();
+            throw e;
         } catch (Exception e) {
-        	e.printStackTrace();
-        	logger.error("HupaDispatchServlet unexpected Exception:" + e.getMessage());
-        	return null;
+            e.printStackTrace();
+            logger.error("HupaDispatchServlet unexpected Exception:" + e.getMessage());
+            return null;
         }
     }
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
 }

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/MessageSourceServlet.java Thu Nov 19 17:36:12 2009
@@ -85,7 +85,7 @@
                 f.close(false);
             }
         } catch (Exception e) {
-        	String msg = "Unable to get raw content of msg for user " + user + " in folder " + folderName + " with uid " + message_uuid;
+            String msg = "Unable to get raw content of msg for user " + user + " in folder " + folderName + " with uid " + message_uuid;
             logger.error(msg, e);
             throw new ServletException(msg);
         }

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/DemoModeTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/DemoModeTest.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/DemoModeTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/DemoModeTest.java Thu Nov 19 17:36:12 2009
@@ -24,10 +24,10 @@
 
 public class DemoModeTest extends AbstractHandlerTest {
 
-	private LoginUser demoUser = new LoginUser("demo", "demo");
-	
-	private InMemoryIMAPStoreCache memoryStore = new InMemoryIMAPStoreCache(logger, InMemoryIMAPStoreCache.DEMO_MODE, 143, false, 1, 300000, provider);
-	
+    private LoginUser demoUser = new LoginUser("demo", "demo");
+    
+    private InMemoryIMAPStoreCache memoryStore = new InMemoryIMAPStoreCache(logger, InMemoryIMAPStoreCache.DEMO_MODE, 143, false, 1, 300000, provider);
+    
     private LoginUserHandler loginUserHandler = new LoginUserHandler(memoryStore, logger, httpSessionProvider, settingsProvider);
     
     private FetchFoldersHandler fetchFoldersHandler = new FetchFoldersHandler(memoryStore, logger, httpSessionProvider);
@@ -35,7 +35,7 @@
     private FetchMessagesHandler fetchMessagesHandler = new FetchMessagesHandler(memoryStore, logger, httpSessionProvider);
 
     public void testDemoLoginUser() {
-    	LoginUser badUser = new LoginUser("baduser", "whatever");
+        LoginUser badUser = new LoginUser("baduser", "whatever");
         try {
             loginUserHandler.execute(demoUser, null);
         } catch (ActionException e) {
@@ -61,21 +61,21 @@
     }
 
     public void testReadMessageFile() throws Exception {
-    	URL url = Thread.currentThread().getContextClassLoader().getResource(MockIMAPFolder.DEMO_MODE_MESSAGES_LOCATION + "0.msg");
-    	assertNotNull("There aren't message files for demo mode, check that the files mime/\\d.msg are in your classpath", url);
+        URL url = Thread.currentThread().getContextClassLoader().getResource(MockIMAPFolder.DEMO_MODE_MESSAGES_LOCATION + "0.msg");
+        assertNotNull("There aren't message files for demo mode, check that the files mime/\\d.msg are in your classpath", url);
     }
     
     public void testLoadMessageFiles() throws Exception {
-    	MockIMAPStore store = new MockIMAPStore(session);
-    	MockIMAPFolder folder = new MockIMAPFolder("WHATEVER", store);
-    	folder.create(Folder.HOLDS_MESSAGES);
-    	folder.loadDemoMessages(session);
-    	assertTrue(folder.getMessages().length > 0);
-    	
-    	for (Message m: folder.getMessages()) {
-    		assertEquals(m, folder.getMessageByUID(folder.getUID(m)));
-    	}
-    	
+        MockIMAPStore store = new MockIMAPStore(session);
+        MockIMAPFolder folder = new MockIMAPFolder("WHATEVER", store);
+        folder.create(Folder.HOLDS_MESSAGES);
+        folder.loadDemoMessages(session);
+        assertTrue(folder.getMessages().length > 0);
+        
+        for (Message m: folder.getMessages()) {
+            assertEquals(m, folder.getMessageByUID(folder.getUID(m)));
+        }
+        
     }
 
     public void testDemoFetchMessages() throws Exception {
@@ -83,10 +83,10 @@
             User user = loginUserHandler.execute(demoUser, null).getUser();
             fetchFoldersHandler.execute(new FetchFolders(), null);
             IMAPFolder folder = new IMAPFolder(user.getSettings().getInboxFolderName());
-        	FetchMessagesResult result = fetchMessagesHandler.execute(new FetchMessages(folder, 0, 10, null), null);
-        	assertEquals(8, result.getRealCount());
-        	assertEquals(8, result.getMessages().size());
-        	assertEquals(8, result.getRealUnreadCount());
+            FetchMessagesResult result = fetchMessagesHandler.execute(new FetchMessages(folder, 0, 10, null), null);
+            assertEquals(8, result.getRealCount());
+            assertEquals(8, result.getMessages().size());
+            assertEquals(8, result.getRealUnreadCount());
         } catch (ActionException e) {
             e.printStackTrace();
             fail("Shouldn't throw an exception");

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbstractHandlerTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbstractHandlerTest.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbstractHandlerTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbstractHandlerTest.java Thu Nov 19 17:36:12 2009
@@ -42,19 +42,19 @@
 import com.google.inject.Provider;
 
 public abstract class AbstractHandlerTest extends TestCase{
-	
+    
     public final static String VALID_ID ="VALID_ID";
     
     protected Log logger = new MockLog();
     
     User user = createUser();
     
-	protected Session session = Session.getInstance(new Properties());
-	protected Provider<Session> provider = new Provider<Session> () {
-		public Session get() {
-			return session;
+    protected Session session = Session.getInstance(new Properties());
+    protected Provider<Session> provider = new Provider<Session> () {
+        public Session get() {
+            return session;
         }
-	};
+    };
 
     protected HttpSession httpSession = new MockHttpSession(VALID_ID);
     protected Provider<HttpSession> httpSessionProvider = new Provider<HttpSession>() {
@@ -64,11 +64,11 @@
         
     };
     
-	protected Provider<Settings> settingsProvider = new Provider<Settings> () {
-		public Settings get() {
-			return MockIMAPFolder.mockSettings;
+    protected Provider<Settings> settingsProvider = new Provider<Settings> () {
+        public Settings get() {
+            return MockIMAPFolder.mockSettings;
         }
-	};
+    };
     
     protected MockIMAPStoreCache storeCache = new MockIMAPStoreCache( new Provider<Session>() {
         public Session get() {
@@ -94,12 +94,12 @@
         return user;
     }
     
-	protected MimeMessage loadMessage(String msgFile) throws Exception {
-		msgFile = MockIMAPFolder.DEMO_MODE_MESSAGES_LOCATION + msgFile;
-	    URL url = Thread.currentThread().getContextClassLoader().getResource(msgFile);
-    	assertNotNull("Check that the file " + msgFile + " is in the classpath", url);
+    protected MimeMessage loadMessage(String msgFile) throws Exception {
+        msgFile = MockIMAPFolder.DEMO_MODE_MESSAGES_LOCATION + msgFile;
+        URL url = Thread.currentThread().getContextClassLoader().getResource(msgFile);
+        assertNotNull("Check that the file " + msgFile + " is in the classpath", url);
     
-    	FileInputStream is = new FileInputStream(url.getFile());
+        FileInputStream is = new FileInputStream(url.getFile());
         return new MimeMessage(session, is);
     }
 

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java Thu Nov 19 17:36:12 2009
@@ -36,84 +36,84 @@
 
 public class FetchMessagesHandlerTest extends AbstractHandlerTest{
 
-	FetchMessagesHandler handler = new FetchMessagesHandler(storeCache, logger, httpSessionProvider);
-	
+    FetchMessagesHandler handler = new FetchMessagesHandler(storeCache, logger, httpSessionProvider);
+    
     public void setUp() {
-    	super.setUp();
+        super.setUp();
         httpSession.setAttribute("user", user);
     }
     
     public void testConvert() throws Exception {
-    	
+        
         MockIMAPStore store = (MockIMAPStore) storeCache.get(user);
         MockIMAPFolder f = (MockIMAPFolder)store.getFolder("WHATEVER"); 
         f.create(Folder.HOLDS_MESSAGES);
         
-    	ByteArrayInputStream is = new ByteArrayInputStream("From: a@foo.com\nTo: b@foo.com\nSubject: something\n\ndata".getBytes());
-    	MimeMessage m1 = new MimeMessage(session, is);
-    	is = new ByteArrayInputStream("From: =?ISO-8859-1?Q?Manolo_Pe=F1a?= <penya@foo.com>\nTo: b@foo.com\nSubject: something\n\ndata".getBytes());
-    	MimeMessage m2 = new MimeMessage(session, is);
-    	is = new ByteArrayInputStream("From: a@foo.com\nTo: b@foo.com\nSubject: =?ISO-8859-1?Q?Monta=F1a?=\n\ndata".getBytes());
-    	MimeMessage m3 = new MimeMessage(session, is);
-    	
-    	ArrayList<org.apache.hupa.shared.data.Message> msgs = handler.convert(2, f, new Message[]{m1, m2, m3});
-    	assertEquals(2, msgs.size());
-    	
-    	msgs = handler.convert(10, f, new Message[]{m1, m2, m3});
-    	assertEquals(3, msgs.size());
-
-    	msgs = handler.convert(10, f, new Message[]{m2});
-    	assertEquals("Manolo Pe\u00F1a <penya@foo.com>",  msgs.get(0).getFrom());
-    	
-    	msgs = handler.convert(10, f, new Message[]{m3});
-    	assertEquals("Monta\u00F1a",  msgs.get(0).getSubject());
+        ByteArrayInputStream is = new ByteArrayInputStream("From: a@foo.com\nTo: b@foo.com\nSubject: something\n\ndata".getBytes());
+        MimeMessage m1 = new MimeMessage(session, is);
+        is = new ByteArrayInputStream("From: =?ISO-8859-1?Q?Manolo_Pe=F1a?= <penya@foo.com>\nTo: b@foo.com\nSubject: something\n\ndata".getBytes());
+        MimeMessage m2 = new MimeMessage(session, is);
+        is = new ByteArrayInputStream("From: a@foo.com\nTo: b@foo.com\nSubject: =?ISO-8859-1?Q?Monta=F1a?=\n\ndata".getBytes());
+        MimeMessage m3 = new MimeMessage(session, is);
+        
+        ArrayList<org.apache.hupa.shared.data.Message> msgs = handler.convert(2, f, new Message[]{m1, m2, m3});
+        assertEquals(2, msgs.size());
+        
+        msgs = handler.convert(10, f, new Message[]{m1, m2, m3});
+        assertEquals(3, msgs.size());
+
+        msgs = handler.convert(10, f, new Message[]{m2});
+        assertEquals("Manolo Pe\u00F1a <penya@foo.com>",  msgs.get(0).getFrom());
+        
+        msgs = handler.convert(10, f, new Message[]{m3});
+        assertEquals("Monta\u00F1a",  msgs.get(0).getSubject());
     }
 
     public void testFetchMessages() throws Exception {
 
-    	MockIMAPStore store = (MockIMAPStore) storeCache.get(user);
+        MockIMAPStore store = (MockIMAPStore) storeCache.get(user);
         MockIMAPFolder serverfolder = (MockIMAPFolder)store.getFolder("WHATEVER"); 
         serverfolder.create(Folder.HOLDS_MESSAGES);
         
         IMAPFolder clientfolder = new IMAPFolder("WHATEVER");
-    	FetchMessagesResult result = handler.execute(new FetchMessages(clientfolder, 0, 10, "*"), null);
-    	assertEquals(0, result.getRealCount());
-    	
-    	ByteArrayInputStream is = new ByteArrayInputStream("From: a@foo.com\nTo: b@foo.com\nSubject: something\n\ndata".getBytes());
-    	MimeMessage msg = new MimeMessage(session, is);
-    	serverfolder.addMessages(new Message[]{msg});
-    	
-    	result = handler.execute(new FetchMessages(clientfolder, 0, 10, "*"), null);
-    	assertEquals(1, result.getRealCount());
-    	assertEquals(1, result.getMessages().size());
-    	
-    	result = handler.execute(new FetchMessages(clientfolder, 0, 10, null), null);
-    	assertEquals(1, result.getRealCount());
-    	assertEquals(1, result.getMessages().size());
-
-    	is = new ByteArrayInputStream("From: a@foo.com\nTo: b@foo.com\nSubject: something\n\ndata".getBytes());
-    	msg = new MimeMessage(session, is);
-    	serverfolder.appendMessages(new Message[]{msg});
-    	
-    	result = handler.execute(new FetchMessages(clientfolder, 0, 10, "*"), null);
-    	assertEquals(2, result.getRealCount());
-    	assertEquals(2, result.getMessages().size());
-    	
-    	result = handler.execute(new FetchMessages(clientfolder, 0, 10, null), null);
-    	assertEquals(2, serverfolder.getMessageCount());
-    	assertEquals(2, serverfolder.getUnreadMessageCount());
-    	assertEquals(2, result.getRealCount());
-    	assertEquals(2, result.getMessages().size());
-    	assertEquals(2, result.getMessages().size());
-    	
-    	msg.setFlags(new Flags(Flag.SEEN), true);
-    	assertEquals(1, serverfolder.getUnreadMessageCount());
-    	
-    	serverfolder.appendMessages(new Message[]{msg});
-    	result = handler.execute(new FetchMessages(clientfolder, 0, 10, "*"), null);
-    	assertEquals(3, result.getRealCount());
-    	assertEquals(1, result.getRealUnreadCount());
-    	
+        FetchMessagesResult result = handler.execute(new FetchMessages(clientfolder, 0, 10, "*"), null);
+        assertEquals(0, result.getRealCount());
+        
+        ByteArrayInputStream is = new ByteArrayInputStream("From: a@foo.com\nTo: b@foo.com\nSubject: something\n\ndata".getBytes());
+        MimeMessage msg = new MimeMessage(session, is);
+        serverfolder.addMessages(new Message[]{msg});
+        
+        result = handler.execute(new FetchMessages(clientfolder, 0, 10, "*"), null);
+        assertEquals(1, result.getRealCount());
+        assertEquals(1, result.getMessages().size());
+        
+        result = handler.execute(new FetchMessages(clientfolder, 0, 10, null), null);
+        assertEquals(1, result.getRealCount());
+        assertEquals(1, result.getMessages().size());
+
+        is = new ByteArrayInputStream("From: a@foo.com\nTo: b@foo.com\nSubject: something\n\ndata".getBytes());
+        msg = new MimeMessage(session, is);
+        serverfolder.appendMessages(new Message[]{msg});
+        
+        result = handler.execute(new FetchMessages(clientfolder, 0, 10, "*"), null);
+        assertEquals(2, result.getRealCount());
+        assertEquals(2, result.getMessages().size());
+        
+        result = handler.execute(new FetchMessages(clientfolder, 0, 10, null), null);
+        assertEquals(2, serverfolder.getMessageCount());
+        assertEquals(2, serverfolder.getUnreadMessageCount());
+        assertEquals(2, result.getRealCount());
+        assertEquals(2, result.getMessages().size());
+        assertEquals(2, result.getMessages().size());
+        
+        msg.setFlags(new Flags(Flag.SEEN), true);
+        assertEquals(1, serverfolder.getUnreadMessageCount());
+        
+        serverfolder.appendMessages(new Message[]{msg});
+        result = handler.execute(new FetchMessages(clientfolder, 0, 10, "*"), null);
+        assertEquals(3, result.getRealCount());
+        assertEquals(1, result.getRealUnreadCount());
+        
     }
     
 }

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java Thu Nov 19 17:36:12 2009
@@ -30,10 +30,10 @@
 import org.apache.hupa.shared.data.MessageDetails;
 
 public class GetMessageDetailsHandlerTest extends AbstractHandlerTest {
-	
-	GetMessageDetailsHandler handler = new GetMessageDetailsHandler(storeCache, logger, httpSessionProvider);
+    
+    GetMessageDetailsHandler handler = new GetMessageDetailsHandler(storeCache, logger, httpSessionProvider);
 
-	public void testRegexHtml() {
+    public void testRegexHtml() {
         String txt, res;
         txt = "<!'https://www.aaa.1:#@%/;$()~_?+-=\\.&<br/>";
         res = handler.replaceAll(txt, GetMessageDetailsHandler.regex_http, "");
@@ -130,67 +130,67 @@
         assertEquals("<div class='hupa-email-content'>\nwhatever\n</div>\n", html);
     }
     
-	public void testTextDocumentToHtml() throws Exception {
+    public void testTextDocumentToHtml() throws Exception {
+
+        String msg = "...\nhttp://www.example.com/path/action.do;s=1;a=2?p=abcd\n...";
+        String res = handler.txtDocumentToHtml(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+        assertTrue(res.contains("onClick=\"openLink('http://"));
+        
+        msg = "...\nnobody@subdomain.the-domain.org\n...";
+        res = handler.txtDocumentToHtml(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+        assertTrue(res.contains("onClick=\"mailTo('nobody@"));
+        
+        res = handler.txtDocumentToHtml("", "aFolder", 9999l);
+        assertTrue(res.length()==0);
+        
+    }
+
+    public void testFilterHtmlDocument() throws Exception {
+
+        String msg = "<div>...\nhttp://whatever\n...</div>";
+        String res = handler.txtDocumentToHtml(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+        assertTrue(res.contains("onClick=\"openLink('http://whatever"));
+        
+        msg = "...\n<a\nhref=https://www.example.com/path/action.do;s=1;a=2?p=abcd\n...";
+        res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+        assertTrue(res.contains("onClick=\"openLink('https://"));
+
+        msg = "...\n<a\nhref=mailTo:nobody@subdomain.the-domain.org\n...";
+        res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+        assertTrue(res.contains("onClick=\"mailTo('nobody@"));
 
-		String msg = "...\nhttp://www.example.com/path/action.do;s=1;a=2?p=abcd\n...";
-    	String res = handler.txtDocumentToHtml(msg, "aFolder", 9999l);
-    	assertNotSame(msg, res);
-    	assertTrue(res.contains("onClick=\"openLink('http://"));
-    	
-    	msg = "...\nnobody@subdomain.the-domain.org\n...";
-    	res = handler.txtDocumentToHtml(msg, "aFolder", 9999l);
-    	assertNotSame(msg, res);
-    	assertTrue(res.contains("onClick=\"mailTo('nobody@"));
-    	
-    	res = handler.txtDocumentToHtml("", "aFolder", 9999l);
-    	assertTrue(res.length()==0);
-    	
-    }
-
-	public void testFilterHtmlDocument() throws Exception {
-
-		String msg = "<div>...\nhttp://whatever\n...</div>";
-    	String res = handler.txtDocumentToHtml(msg, "aFolder", 9999l);
-    	assertNotSame(msg, res);
-    	assertTrue(res.contains("onClick=\"openLink('http://whatever"));
-		
-		msg = "...\n<a\nhref=https://www.example.com/path/action.do;s=1;a=2?p=abcd\n...";
-		res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
-		assertNotSame(msg, res);
-		assertTrue(res.contains("onClick=\"openLink('https://"));
-
-		msg = "...\n<a\nhref=mailTo:nobody@subdomain.the-domain.org\n...";
-		res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
-		assertNotSame(msg, res);
-		assertTrue(res.contains("onClick=\"mailTo('nobody@"));
-
-		msg = "...\n...<img   \n   src=\"cid:1.1934304663@web28309.mail.ukl.yahoo.com\" width=200\n....";
-		res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
-		assertNotSame(msg, res);
-		assertEquals("<div class='hupa-email-content'>\n...\n...<img   \n   src=\"" + 
-				SConsts.HUPA + SConsts.SERVLET_DOWNLOAD + "?" 
-				+ SConsts.PARAM_FOLDER + "=aFolder&" 
-				+ SConsts.PARAM_UID + "=9999&"
-		        + SConsts.PARAM_NAME + "=1.1934304663@web28309.mail.ukl.yahoo.com\" width=200\n....\n</div>\n", res);
-		
-		msg = "\n\n.... <Script \ntype=\"whatever\"\n>\nalert('hello');\n</script > ---\n\n";
-		res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
-		assertNotSame(msg, res);
-
-		msg = "\n\n.... <a \nid=\"whatever\"\nonclick=\"alert('hello');\"\n</a > ---\n\n";
-		res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
-		assertNotSame(msg, res);
-
-		msg = "\n\n.... <style \ntype=\"whatever\"\n>\n.a{};\n</Style > ---\n\n";
-		res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
-		assertNotSame(msg, res);
-		
+        msg = "...\n...<img   \n   src=\"cid:1.1934304663@web28309.mail.ukl.yahoo.com\" width=200\n....";
+        res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+        assertEquals("<div class='hupa-email-content'>\n...\n...<img   \n   src=\"" + 
+                SConsts.HUPA + SConsts.SERVLET_DOWNLOAD + "?" 
+                + SConsts.PARAM_FOLDER + "=aFolder&" 
+                + SConsts.PARAM_UID + "=9999&"
+                + SConsts.PARAM_NAME + "=1.1934304663@web28309.mail.ukl.yahoo.com\" width=200\n....\n</div>\n", res);
+        
+        msg = "\n\n.... <Script \ntype=\"whatever\"\n>\nalert('hello');\n</script > ---\n\n";
+        res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+
+        msg = "\n\n.... <a \nid=\"whatever\"\nonclick=\"alert('hello');\"\n</a > ---\n\n";
+        res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+
+        msg = "\n\n.... <style \ntype=\"whatever\"\n>\n.a{};\n</Style > ---\n\n";
+        res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
+        assertNotSame(msg, res);
+        
         res = handler.filterHtmlDocument("", "aFolder", 9999l);
-	    assertTrue(res.length()==0);
+        assertTrue(res.length()==0);
 
-	}
+    }
 
-	public void testRegexEmailsInsideTagAttributes() {
+    public void testRegexEmailsInsideTagAttributes() {
         String msg, res;
         msg = ".. <a href=\"http://whatever?param1=whatever&email= dock@example.com&param3\">..</a> ..";
         res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
@@ -213,76 +213,76 @@
         
     }
 
-	private MessageDetails loadMessageDetails(String msgFile) throws Exception {
+    private MessageDetails loadMessageDetails(String msgFile) throws Exception {
         return handler.mimeToDetails(loadMessage(msgFile), "theFolder", 9999l);
     }
-	
+    
     public void testMessageDetails_textPlain() throws Exception {
-    	MessageDetails details = loadMessageDetails("0.msg");
-    	assertTrue(details.getText().contains("demo message"));
+        MessageDetails details = loadMessageDetails("0.msg");
+        assertTrue(details.getText().contains("demo message"));
     }
 
     public void testMessageDetails_multiparMixed() throws Exception {
-    	MessageDetails details = loadMessageDetails("1.msg");
-    	assertEquals(1, details.getMessageAttachments().size());
+        MessageDetails details = loadMessageDetails("1.msg");
+        assertEquals(1, details.getMessageAttachments().size());
         assertTrue(details.getText().contains("Regards"));
     }
 
     public void testMessageDetails_multiparAlternative() throws Exception {
-    	MessageDetails details = loadMessageDetails("2.msg");
-    	assertEquals(0, details.getMessageAttachments().size());
-    	assertTrue(details.getText().length() > 0);
+        MessageDetails details = loadMessageDetails("2.msg");
+        assertEquals(0, details.getMessageAttachments().size());
+        assertTrue(details.getText().length() > 0);
     }
 
     public void testMessageDetails_charsetIso() throws Exception {
-    	MimeMessage message = loadMessage("3.msg");
-    	String from = message.getFrom()[0].toString();
-    	assertTrue(from.contains("\u00AE"));
-    	
-    	MessageDetails details = loadMessageDetails("3.msg");
-    	assertEquals(0, details.getMessageAttachments().size());
-    	assertTrue(details.getText().length() > 0);
+        MimeMessage message = loadMessage("3.msg");
+        String from = message.getFrom()[0].toString();
+        assertTrue(from.contains("\u00AE"));
+        
+        MessageDetails details = loadMessageDetails("3.msg");
+        assertEquals(0, details.getMessageAttachments().size());
+        assertTrue(details.getText().length() > 0);
     }
 
     public void testMessageDetails_textHtml() throws Exception {
-    	MessageDetails details = loadMessageDetails("4.msg");
-    	assertTrue(details.getText().length() > 0);
+        MessageDetails details = loadMessageDetails("4.msg");
+        assertTrue(details.getText().length() > 0);
     }
     
     public void testMessageDetails_multiparMixed_multipartAlternative() throws Exception {
-    	MessageDetails details = loadMessageDetails("6.msg");
-    	assertEquals(1, details.getMessageAttachments().size());
-    	assertTrue(details.getText().length() > 0);
+        MessageDetails details = loadMessageDetails("6.msg");
+        assertEquals(1, details.getMessageAttachments().size());
+        assertTrue(details.getText().length() > 0);
     }
     
 
     public void testMessageDetails_html_with_inline_images() throws Exception {
-    	
-    	MockIMAPStore store = (MockIMAPStore) storeCache.get(user);
+        
+        MockIMAPStore store = (MockIMAPStore) storeCache.get(user);
         MockIMAPFolder serverfolder = (MockIMAPFolder)store.getFolder("WHATEVER"); 
         serverfolder.create(Folder.HOLDS_MESSAGES);
         
-    	MimeMessage msg = loadMessage("7.msg");
-    	serverfolder.addMessages(new Message[]{msg});
+        MimeMessage msg = loadMessage("7.msg");
+        serverfolder.addMessages(new Message[]{msg});
 
         IMAPFolder clientfolder = new IMAPFolder("WHATEVER");
         MessageDetails details = handler.exposeMessage(user, clientfolder, 0);
         assertTrue(details.getText().contains("img src=\"" + 
-        		SConsts.HUPA + SConsts.SERVLET_DOWNLOAD + "?" +
-        		SConsts.PARAM_FOLDER + "=WHATEVER&" + 
-        		SConsts.PARAM_UID + "=0&" + 
-        		SConsts.PARAM_NAME + "=1.1934304663@web28309.mail.ukl.yahoo.com\""));
-    	
+                SConsts.HUPA + SConsts.SERVLET_DOWNLOAD + "?" +
+                SConsts.PARAM_FOLDER + "=WHATEVER&" + 
+                SConsts.PARAM_UID + "=0&" + 
+                SConsts.PARAM_NAME + "=1.1934304663@web28309.mail.ukl.yahoo.com\""));
+        
     }
 
     public void testMessageDetails_links() throws Exception {
-    	MessageDetails details = loadMessageDetails("2.msg");
+        MessageDetails details = loadMessageDetails("2.msg");
 
-    	String html = handler.filterHtmlDocument(details.getText(), "foldername", 111l);
-    	assertFalse(html.contains("<script>"));
-    	assertFalse(html.contains("<style>"));
-    	assertTrue(html.contains("<a onClick=\"openLink('http://code.google.com/intl/es/webtoolkit/');return false;\" href=\"http://code.google.com/intl/es/webtoolkit/\""));
-    	assertTrue(html.contains("<a onClick=\"mailTo('donald@example.com');return false;\" href=\"mailto:donald@example.com\""));
+        String html = handler.filterHtmlDocument(details.getText(), "foldername", 111l);
+        assertFalse(html.contains("<script>"));
+        assertFalse(html.contains("<style>"));
+        assertTrue(html.contains("<a onClick=\"openLink('http://code.google.com/intl/es/webtoolkit/');return false;\" href=\"http://code.google.com/intl/es/webtoolkit/\""));
+        assertTrue(html.contains("<a onClick=\"mailTo('donald@example.com');return false;\" href=\"mailto:donald@example.com\""));
     }
 
 }

Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/servlet/DownloadAttachmentServletTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/servlet/DownloadAttachmentServletTest.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/servlet/DownloadAttachmentServletTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/servlet/DownloadAttachmentServletTest.java Thu Nov 19 17:36:12 2009
@@ -7,18 +7,18 @@
 
 public class DownloadAttachmentServletTest extends AbstractHandlerTest {
 
-	public void testDownloadAttachmentByName() throws Exception {
-		MimeMessage message = loadMessage("7.msg");
-		Part part = DownloadAttachmentServlet.handleMultiPart(message
-		        .getContent(), "Image.4FB480B138F7456382ABBD1EE7B0748A");
-		assertNotNull(part);
-	}
-	
-	public void testDownloadAttachmentByContentId() throws Exception {
-		MimeMessage message = loadMessage("7.msg");
-		Part part = DownloadAttachmentServlet.handleMultiPart(message
-		        .getContent(), "1.1934304663@web28309.mail.ukl.yahoo.com");
-		assertNotNull(part);
-	}
+    public void testDownloadAttachmentByName() throws Exception {
+        MimeMessage message = loadMessage("7.msg");
+        Part part = DownloadAttachmentServlet.handleMultiPart(message
+                .getContent(), "Image.4FB480B138F7456382ABBD1EE7B0748A");
+        assertNotNull(part);
+    }
+    
+    public void testDownloadAttachmentByContentId() throws Exception {
+        MimeMessage message = loadMessage("7.msg");
+        Part part = DownloadAttachmentServlet.handleMultiPart(message
+                .getContent(), "1.1934304663@web28309.mail.ukl.yahoo.com");
+        assertNotNull(part);
+    }
 
 }

Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/SConsts.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/SConsts.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/SConsts.java (original)
+++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/SConsts.java Thu Nov 19 17:36:12 2009
@@ -1,15 +1,15 @@
 package org.apache.hupa.shared;
 
 public class SConsts {
-	public static final String HUPA = "hupa/";
-	public static final String SERVLET_DISPATCH = "dispatch";
-	public static final String SERVLET_DOWNLOAD = "downloadAttachmentServlet";
-	public static final String SERVLET_UPLOAD = "uploadAttachmentServlet";
-	public static final String SERVLET_SOURCE = "messageSourceServlet";
+    public static final String HUPA = "hupa/";
+    public static final String SERVLET_DISPATCH = "dispatch";
+    public static final String SERVLET_DOWNLOAD = "downloadAttachmentServlet";
+    public static final String SERVLET_UPLOAD = "uploadAttachmentServlet";
+    public static final String SERVLET_SOURCE = "messageSourceServlet";
 
-	
-	public static final String PARAM_NAME = "name";
-	public static final String PARAM_FOLDER = "folder";
-	public static final String PARAM_UID = "uid";
+    
+    public static final String PARAM_NAME = "name";
+    public static final String PARAM_FOLDER = "folder";
+    public static final String PARAM_UID = "uid";
 
 }
\ No newline at end of file

Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFoldersResult.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFoldersResult.java?rev=882215&r1=882214&r2=882215&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFoldersResult.java (original)
+++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFoldersResult.java Thu Nov 19 17:36:12 2009
@@ -47,10 +47,10 @@
     }
     
     public String toString() {
-    	String ret = "";
-    	for (IMAPFolder f: folders) {
-    		ret += f.getFullName() + " ";
-    	}
-    	return ret;
+        String ret = "";
+        for (IMAPFolder f: folders) {
+            ret += f.getFullName() + " ";
+        }
+        return ret;
     }
 }



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


Mime
View raw message