Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Connector.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Connector.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Connector.java	(revision 2591)
@@ -21,5 +21,4 @@
 package net.fckeditor.connector;
 
-
 import java.io.InputStream;
 import java.util.List;
@@ -30,35 +29,42 @@
 import net.fckeditor.connector.exception.FolderAlreadyExistsException;
 import net.fckeditor.connector.exception.InvalidCurrentFolderException;
-import net.fckeditor.connector.exception.InvalidFolderNameException;
-import net.fckeditor.connector.exception.SecurityIssueException;
+import net.fckeditor.connector.exception.InvalidNewFolderNameException;
 import net.fckeditor.connector.exception.UnknownException;
+import net.fckeditor.connector.exception.WriteException;
 import net.fckeditor.handlers.ResourceType;
 
 /**
  * Interface for all Connectors.<br>
- * The Connector will be initialized by the {@link Dispatcher}. If an error is happened there are well-defined
- * exceptions which could be thrown. So the {@link Dispatcher} can react according to it.
- * <br><br>
- * Keep in mind that the {@link Dispatcher} verifies the request and redirects the relevant parameters
- * to the different methods of the connector and forwards the response to {@link ConnectorServlet}.
- * Therefore you don't need to check the basic parameters 'type' and 'currentFolder' against <code>null</code>.
+ * The Connector will be initialized by the {@link Dispatcher}. If an error is
+ * happened there are well-defined exceptions which could be thrown. So the
+ * {@link Dispatcher} can react according to it. <br>
+ * <br>
+ * Keep in mind that the {@link Dispatcher} verifies the request and redirects
+ * the relevant parameters to the different methods of the connector and
+ * forwards the response to {@link ConnectorServlet}. Therefore you don't need
+ * to check the basic parameters 'type' and 'currentFolder' against
+ * <code>null</code>.
  * 
  * @version $Id$
  */
 public interface Connector {
-	
+
 	/**
-	 * This key is to address a file's name in {@link #getFiles(ResourceType, String)} map.
+	 * This key is to address a file's name in
+	 * {@link #getFiles(ResourceType, String)} map.
 	 */
-	public final static String KEY_NAME  = "name";
+	public final static String KEY_NAME = "name";
 	/**
-	 * This key is to address a file's size in {@link #getFiles(ResourceType, String)} map.
+	 * This key is to address a file's size in
+	 * {@link #getFiles(ResourceType, String)} map.
 	 */
 	public final static String KEY_SIZE = "size";
-	
+
 	/**
-	 * Initializes the connector. This method will be called on the start of the webapp.
+	 * Initializes the connector. This method will be called on the start of the
+	 * webapp.
 	 * 
-	 * @param servletContext eg. to get the real path of a file for example.
+	 * @param servletContext
+	 *            eg. to get the real path of a file for example.
 	 */
 	public void init(final ServletContext servletContext);
@@ -66,6 +72,6 @@
 	/**
 	 * Returns a list of file attributes. which are inside the abstract path
-	 * <code>/[type-folder]/[currentFolder]</code>.
-	 * Filename, file size (in bytes).
+	 * <code>/[type-folder]/[currentFolder]</code>. Filename, file size (in
+	 * bytes).
 	 * 
 	 * @param type
@@ -76,7 +82,8 @@
 	 * @throws UnknownException
 	 */
-	public List<Map<String, Object>> getFiles(final ResourceType type, final String currentFolder)
-		throws InvalidCurrentFolderException, SecurityIssueException, UnknownException;
-	
+	public List<Map<String, Object>> getFiles(final ResourceType type,
+			final String currentFolder) throws InvalidCurrentFolderException,
+			SecurityException;
+
 	/**
 	 * Returns a list of folders which are inside the abstract path
@@ -90,7 +97,8 @@
 	 * @throws UnknownException
 	 */
-	public List<String> getFolders(final ResourceType type, final String currentFolder)
-		throws InvalidCurrentFolderException, SecurityIssueException, UnknownException;
-		
+	public List<String> getFolders(final ResourceType type,
+			final String currentFolder) throws InvalidCurrentFolderException,
+			SecurityException;
+
 	/**
 	 * Creates a new folder inside inside the abstract path
@@ -99,16 +107,20 @@
 	 * @param type
 	 * @param currentFolder
-	 * @param newFolder Name of the new folder to create.
+	 * @param newFolder
+	 *            Name of the new folder to create.
 	 * @throws InvalidCurrentFolderException
 	 * @throws SecurityIssueException
-	 * @throws InvalidFolderNameException
+	 * @throws InvalidNewFolderNameException
 	 * @throws FolderAlreadyExistsException
 	 */
-	public void createFolder(final ResourceType type, final String currentFolder, final String newFolder) 
-		throws InvalidCurrentFolderException, SecurityIssueException, InvalidFolderNameException, FolderAlreadyExistsException;
+	public void createFolder(final ResourceType type,
+			final String currentFolder, final String newFolder)
+			throws InvalidCurrentFolderException, SecurityException,
+			InvalidNewFolderNameException, FolderAlreadyExistsException;
 
 	/**
-	 * Uploads a new file into the abstract path <code>/[type-folder]/[currentFolder]</code>. If there is 
-	 * already a file with the same name, the new one has to be renamed.<br/>
+	 * Uploads a new file into the abstract path
+	 * <code>/[type-folder]/[currentFolder]</code>. If there is already a file
+	 * with the same name, the new one has to be renamed.<br/>
 	 * FileUpload and QuickUpload will be handled the same way since QuickUpload
 	 * is just a specialization of FileUpload.
@@ -117,11 +129,16 @@
 	 * @param currentFolder
 	 * @param fileName
-	 * @param inputStream Content of the file.
+	 * @param inputStream
+	 *            Content of the file.
 	 * @return <code>fileName</code> or the name of the renamed file.
 	 * @throws InvalidCurrentFolderException
-	 * @throws SecurityIssueException
+	 * @throws WriteException
+	 * @throws SecurityException
 	 */
-	public String fileUpload(final ResourceType type, final String currentFolder, final String fileName, final InputStream inputStream)
-		throws InvalidCurrentFolderException, SecurityIssueException;
+	public String fileUpload(final ResourceType type,
+			final String currentFolder, final String fileName,
+			final InputStream inputStream)
+			throws InvalidCurrentFolderException, SecurityException,
+			WriteException;
 
 }
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Dispatcher.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Dispatcher.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Dispatcher.java	(revision 2591)
@@ -31,7 +31,7 @@
 import net.fckeditor.connector.exception.FolderAlreadyExistsException;
 import net.fckeditor.connector.exception.InvalidCurrentFolderException;
-import net.fckeditor.connector.exception.InvalidFolderNameException;
-import net.fckeditor.connector.exception.SecurityIssueException;
+import net.fckeditor.connector.exception.InvalidNewFolderNameException;
 import net.fckeditor.connector.exception.UnknownException;
+import net.fckeditor.connector.exception.WriteException;
 import net.fckeditor.handlers.CommandHandler;
 import net.fckeditor.handlers.ConnectorHandler;
@@ -48,4 +48,5 @@
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
@@ -64,4 +65,5 @@
  * @version $Id$
  */
+// TODO maybe rename to ConnectorDispatcher?
 public class Dispatcher {
 	private static final Logger logger = LoggerFactory
@@ -114,5 +116,6 @@
 		else {
 			
-			ResourceType type = context.getDefaultResourceType();
+			// in contrast to doPost the referrer has to send an explicit type
+			ResourceType type = context.getResourceType();
 			CommandHandler command = context.getCommand();
 			
@@ -125,5 +128,4 @@
 					&& !RequestCycleHandler.isEnabledForFolderCreation(request))
 				getResponse = GetResponse.getErrorFolderCreationDisabled();
-			
 			else {
 				// make the connector calls, catch its exceptions and generate
@@ -131,15 +133,20 @@
 				try {
 					if (command.equals(CommandHandler.CREATE_FOLDER)) {
-						String newFolderStr = UtilsFile
-								.sanitizeFolderName(request
-										.getParameter("NewFolderName"));
-						if (Utils.isEmpty(newFolderStr))
+						String newFolderNameStr = request
+								.getParameter("NewFolderName");
+						logger.debug("Parameter NewFolderName: {}",
+								newFolderNameStr);				
+						String sanitizedNewFolderNameStr = UtilsFile
+								.sanitizeFolderName(newFolderNameStr);
+						if (Utils.isEmpty(sanitizedNewFolderNameStr))
 							getResponse = GetResponse
 									.getErrorInvalidFolderName();
 						else {
-							logger.debug("Parameter NewFolderName: {}",
-									newFolderStr);
+							logger.debug(
+									"Parameter NewFolderName (sanitized): {}",
+									sanitizedNewFolderNameStr);
 							connector.createFolder(type, context
-									.getCurrentFolderStr(), newFolderStr);
+									.getCurrentFolderStr(),
+									sanitizedNewFolderNameStr);
 							getResponse = GetResponse.getOK();
 						}
@@ -151,13 +158,12 @@
 						String responseUrl = context.buildUrl(ConnectorHandler
 								.getUserFilesPath());
-						getResponse = getFoldersAndFiles(command, type, context
+						getResponse = getFoldersAndOrFiles(command, type, context
 								.getCurrentFolderStr(), responseUrl);
-					} else
-						getResponse = GetResponse.getErrorUnknown();
+					}
 				} catch (InvalidCurrentFolderException e) {
 					getResponse = GetResponse.getErrorInvalidCurrentFolder();
-				} catch (SecurityIssueException e) {
+				} catch (SecurityException e) {
 					getResponse = GetResponse.getErrorSecurity();
-				} catch (InvalidFolderNameException e) {
+				} catch (InvalidNewFolderNameException e) {
 					getResponse = GetResponse.getErrorInvalidFolderName();
 				} catch (FolderAlreadyExistsException e) {
@@ -176,8 +182,10 @@
 	
 	/**
-	 * Helper to make the right {@link Connector}-calls for <code>GetFolders</code> and
-	 * <code>GetFoldersAndFiles</code>.
-	 * 
-	 * @param command should be only {@link CommandHandler#GET_FOLDERS} or {@link CommandHandler#GET_FOLDERS_AND_FILES}!!
+	 * Helper to make the right {@link Connector}-calls for
+	 * <code>GetFolders</code> and <code>GetFoldersAndFiles</code>.
+	 * 
+	 * @param command
+	 *            should be only {@link CommandHandler#GET_FOLDERS} or
+	 *            {@link CommandHandler#GET_FOLDERS_AND_FILES}!!
 	 * @param type
 	 * @param currentFolderStr
@@ -188,23 +196,28 @@
 	 * @throws UnknownException
 	 */
-	private GetResponse getFoldersAndFiles(final CommandHandler command, final ResourceType type, final String currentFolderStr, final String responseUrl)
-			throws InvalidCurrentFolderException, SecurityIssueException, UnknownException {
-		GetResponse getResponse = new GetResponse(command, type, currentFolderStr, responseUrl);
+	private GetResponse getFoldersAndOrFiles(final CommandHandler command,
+			final ResourceType type, final String currentFolderStr,
+			final String responseUrl) throws InvalidCurrentFolderException,
+			SecurityException {
+		GetResponse getResponse = new GetResponse(command, type,
+				currentFolderStr, responseUrl);
 		getResponse.setFolders(connector.getFolders(type, currentFolderStr));
-		if (command.equals(CommandHandler.GET_FOLDERS_AND_FILES)) 
+		if (command.equals(CommandHandler.GET_FOLDERS_AND_FILES))
 			getResponse.setFiles(connector.getFiles(type, currentFolderStr));
 		return getResponse;
 	}
-	
+
 	/**
 	 * Manage the <code>POST</code> requests (<code>FileUpload</code>).<br />
 	 * 
 	 * The method accepts commands sent in the following format:<br />
-	 * <code>connector?Command=&lt;FileUpload&gt;&Type=&lt;ResourceType&gt;&CurrentFolder=&lt;FolderPath&gt;</code>
+	 * <code>connector?Command=&lt;(File|Quick)Upload&gt;&Type=&lt;ResourceType&gt;&CurrentFolder=&lt;FolderPath&gt;</code>
 	 * with the file in the <code>POST</code> body.<br />
-	 * <br>
-	 * The Connector stores an uploaded file (renames a file if another exists with the
-	 * same name) and then returns the JavaScript callback.
-	 * @throws IOException 
+	 * <br />
+	 * The Connector stores an uploaded file (renames a file if another exists
+	 * with the same name) and then returns the JavaScript callback.
+	 * 
+	 * @throws IOException
+	 *             if some unpredictable write error happens
 	 */
 	public void doPost(final HttpServletRequest request,
@@ -276,5 +289,4 @@
 						logger.debug("Parameter NewFile (renamed): {}",
 								newFileName);
-						
 					}
 				}
@@ -282,8 +294,12 @@
 			} catch (InvalidCurrentFolderException e) {
 				uploadResponse = UploadResponse.getErrorInvalidCurrentFolder();
-			} catch (SecurityIssueException e) {
+			} catch (SecurityException e) {
 				uploadResponse = UploadResponse.getErrorSecurity();
+			} catch (WriteException e) {
+				uploadResponse = UploadResponse.getErrorUnknown();
+			} catch (FileUploadException e) {
+				uploadResponse = UploadResponse.getErrorUnknown();
 			} catch (Exception e) {
-				uploadResponse = UploadResponse.getErrorSecurity();
+				uploadResponse = UploadResponse.getErrorUnknown();
 			}
 		}
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/FolderAlreadyExistsException.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/FolderAlreadyExistsException.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/FolderAlreadyExistsException.java	(revision 2591)
@@ -32,3 +32,6 @@
  */
 public class FolderAlreadyExistsException extends Exception {
+
+	private static final long serialVersionUID = 2526172654962583635L;
+
 }
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/InvalidCurrentFolderException.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/InvalidCurrentFolderException.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/InvalidCurrentFolderException.java	(revision 2591)
@@ -33,3 +33,6 @@
  */
 public class InvalidCurrentFolderException extends Exception {
+
+	private static final long serialVersionUID = 8569316682489606369L;
+
 }
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/InvalidFolderNameException.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/InvalidFolderNameException.java	(revision 2590)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- * 
- * == BEGIN LICENSE ==
- * 
- * Licensed under the terms of any of the following licenses at your
- * choice:
- * 
- *  - GNU General Public License Version 2 or later (the "GPL")
- *    http://www.gnu.org/licenses/gpl.html
- * 
- *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- *    http://www.gnu.org/licenses/lgpl.html
- * 
- *  - Mozilla Public License Version 1.1 or later (the "MPL")
- *    http://www.mozilla.org/MPL/MPL-1.1.html
- * 
- * == END LICENSE ==
- */
-package net.fckeditor.connector.exception;
-
-import net.fckeditor.connector.Connector;
-import net.fckeditor.connector.Dispatcher;
-
-/**
- * Signals that a {@link Connector} method tried to create a folder and it fails. <br>
- * <br> 
- * These is an exception to signal the {@link Dispatcher} what was going wrong.
- *
- * @version $Id$
- */
-public class InvalidFolderNameException extends Exception {
-}
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/InvalidNewFolderNameException.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/InvalidNewFolderNameException.java	(revision 2591)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/InvalidNewFolderNameException.java	(revision 2591)
@@ -0,0 +1,37 @@
+/*
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net
+ * Copyright (C) 2003-2008 Frederico Caldeira Knabben
+ * 
+ * == BEGIN LICENSE ==
+ * 
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ * 
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ * 
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ * 
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ * 
+ * == END LICENSE ==
+ */
+package net.fckeditor.connector.exception;
+
+import net.fckeditor.connector.Connector;
+import net.fckeditor.connector.Dispatcher;
+
+/**
+ * Signals that a {@link Connector} method tried to create a folder and it fails. <br>
+ * <br> 
+ * These is an exception to signal the {@link Dispatcher} what was going wrong.
+ *
+ * @version $Id$
+ */
+public class InvalidNewFolderNameException extends Exception {
+
+	private static final long serialVersionUID = 85317665011505135L;
+
+}
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/SecurityIssueException.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/SecurityIssueException.java	(revision 2590)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- * 
- * == BEGIN LICENSE ==
- * 
- * Licensed under the terms of any of the following licenses at your
- * choice:
- * 
- *  - GNU General Public License Version 2 or later (the "GPL")
- *    http://www.gnu.org/licenses/gpl.html
- * 
- *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- *    http://www.gnu.org/licenses/lgpl.html
- * 
- *  - Mozilla Public License Version 1.1 or later (the "MPL")
- *    http://www.mozilla.org/MPL/MPL-1.1.html
- * 
- * == END LICENSE ==
- */
-package net.fckeditor.connector.exception;
-
-import net.fckeditor.connector.Connector;
-import net.fckeditor.connector.Dispatcher;
-
-/**
- * Thrown to indicate a security violation in a {@link Connector}.<br>
- * <br> 
- * These is an exception to signal the {@link Dispatcher} what was going wrong. 
- *
- * @version $Id$
- */
-public class SecurityIssueException extends Exception {
-}
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/UnknownException.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/UnknownException.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/UnknownException.java	(revision 2591)
@@ -31,3 +31,6 @@
  */
 public class UnknownException extends Exception {
+
+	private static final long serialVersionUID = 3177409237059428857L;
+
 }
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/WriteException.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/WriteException.java	(revision 2591)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/exception/WriteException.java	(revision 2591)
@@ -0,0 +1,35 @@
+/*
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net
+ * Copyright (C) 2003-2008 Frederico Caldeira Knabben
+ * 
+ * == BEGIN LICENSE ==
+ * 
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ * 
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ * 
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ * 
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ * 
+ * == END LICENSE ==
+ */
+package net.fckeditor.connector.exception;
+
+import net.fckeditor.connector.Dispatcher;
+
+/**
+ * Thrown to indicate that during file write action an error has occured.
+ * These is an exception to signal the {@link Dispatcher} what was going wrong.
+ *
+ * @version $Id$
+ */
+public class WriteException extends Exception {
+
+	private static final long serialVersionUID = 7742121738185371543L;
+
+}
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/SimpleFileSystemConnector.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/SimpleFileSystemConnector.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/SimpleFileSystemConnector.java	(revision 2591)
@@ -21,5 +21,4 @@
 package net.fckeditor.connector.impl;
 
-import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileFilter;
@@ -37,12 +36,10 @@
 import net.fckeditor.connector.exception.FolderAlreadyExistsException;
 import net.fckeditor.connector.exception.InvalidCurrentFolderException;
-import net.fckeditor.connector.exception.InvalidFolderNameException;
-import net.fckeditor.connector.exception.SecurityIssueException;
-import net.fckeditor.connector.exception.UnknownException;
+import net.fckeditor.connector.exception.InvalidNewFolderNameException;
+import net.fckeditor.connector.exception.WriteException;
 import net.fckeditor.handlers.ConnectorHandler;
 import net.fckeditor.handlers.RequestCycleHandler;
 import net.fckeditor.handlers.ResourceType;
 import net.fckeditor.requestcycle.ThreadLocalData;
-import net.fckeditor.tool.Utils;
 import net.fckeditor.tool.UtilsFile;
 
@@ -54,18 +51,25 @@
 
 /**
- * Implementation of the {@link Connector} for the file system. All path are interpreted as sub-directories 
- * of the {@link ConnectorHandler#getUserFilesPath()}.<br>
- * 
- * TODO should we move the static methods into a util-class in package net.fckeditor.connector.impl ???
+ * Implementation of the {@link Connector} for the file system. All path are
+ * interpreted as sub-directories of the
+ * {@link ConnectorHandler#getUserFilesPath()}.<br>
+ * 
+ * TODO should we move the static methods into a util-class in package
+ * net.fckeditor.connector.impl ???
+ * 
  * @version $Id$
  */
 // FIXME the name is inappropriate, it should be ContextFileSystemConnector
 // we should provide another implementation which leads outside of the context
-// HINT: we should keep this name because it can run without any PathBuilder implementation
+// HINT: we should keep this name because it can run without any PathBuilder
+// implementation
 public class SimpleFileSystemConnector implements Connector {
-	private static final Logger logger = LoggerFactory.getLogger(SimpleFileSystemConnector.class);
+	private static final Logger logger = LoggerFactory
+			.getLogger(SimpleFileSystemConnector.class);
 	private static ServletContext servletContext;
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see net.fckeditor.connector.Connector#init()
 	 */
@@ -73,43 +77,57 @@
 		// create user's default dir
 		SimpleFileSystemConnector.servletContext = servletContext;
-		String realDefaultUserFilesPath = SimpleFileSystemConnector.servletContext.getRealPath(ConnectorHandler.getUserFilesPath());
+		String realDefaultUserFilesPath = SimpleFileSystemConnector.servletContext
+				.getRealPath(ConnectorHandler.getUserFilesPath());
 		File defaultUserFilesDir = new File(realDefaultUserFilesPath);
 		UtilsFile.checkDirAndCreate(defaultUserFilesDir);
 		logger.info("Initialized!");
 	}
-	
-
-	/* (non-Javadoc)
-	 * @see net.fckeditor.connector.Connector#fileUpload(net.fckeditor.handlers.ResourceType, java.lang.String, java.lang.String, java.io.InputStream)
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seenet.fckeditor.connector.Connector#fileUpload(net.fckeditor.handlers.
+	 * ResourceType, java.lang.String, java.lang.String, java.io.InputStream)
 	 */
 	public String fileUpload(final ResourceType type,
 			final String currentFolder, final String fileName,
-			final InputStream inputStream) 
-			throws InvalidCurrentFolderException, SecurityIssueException {
-		String absolutePath = RequestCycleHandler
-				.getUserFilesAbsolutePath(ThreadLocalData.getRequest());
-		File typeDir = getAndCreateResourceTypeDir(absolutePath, type);
-		File currentDir = new File(typeDir, currentFolder);
-		if (!currentDir.exists())
-			throw new InvalidCurrentFolderException(); 
+			final InputStream inputStream) throws SecurityException,
+			InvalidCurrentFolderException, WriteException {
+		String absolutePath = RequestCycleHandler
+				.getUserFilesAbsolutePath(ThreadLocalData.getRequest());
+		File typeDir = getAndCreateResourceTypeDir(absolutePath, type);
+		File currentDir = new File(typeDir, currentFolder);
+		if (!currentDir.exists() || !currentDir.isDirectory())
+			throw new InvalidCurrentFolderException();
 		File newFile = new File(currentDir, fileName);
 		File fileToSave = UtilsFile.getUniqueFile(newFile.getAbsoluteFile());
 		try {
 			IOUtils.copyLarge(inputStream, new FileOutputStream(fileToSave));
+		} catch (SecurityException e) {
+			// not explicitly thrown by anyone but in case that a
+			// SecurityManager is deployed, this could restrict writing on disk
+			throw e;
 		} catch (Exception e) {
-			throw new SecurityIssueException();
+			throw new WriteException();
 		}
 		return fileToSave.getName();
 	}
 
-	/* (non-Javadoc)
-	 * @see net.fckeditor.connector.Connector#createFolder(net.fckeditor.handlers.ResourceType, java.lang.String, java.lang.String)
-	 */
-	public void createFolder(final ResourceType type, final String currentFolder, final String newFolder) 
-			throws InvalidCurrentFolderException, SecurityIssueException, InvalidFolderNameException, FolderAlreadyExistsException {
-		String baseDir = ConnectorHandler.getUserFilesPath();
-		File typeDir = getAndCreateResourceTypeDir(baseDir, type);
-		File currentDir = new File(typeDir, currentFolder);
-		if (!currentDir.exists())
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * net.fckeditor.connector.Connector#createFolder(net.fckeditor.handlers
+	 * .ResourceType, java.lang.String, java.lang.String)
+	 */
+	public void createFolder(final ResourceType type,
+			final String currentFolder, final String newFolder)
+			throws InvalidCurrentFolderException, SecurityException,
+			InvalidNewFolderNameException, FolderAlreadyExistsException {
+		String absolutePath = RequestCycleHandler
+				.getUserFilesAbsolutePath(ThreadLocalData.getRequest());
+		File typeDir = getAndCreateResourceTypeDir(absolutePath, type);
+		File currentDir = new File(typeDir, currentFolder);
+		if (!currentDir.exists() || !currentDir.isDirectory())
 			throw new InvalidCurrentFolderException();
 		File newDir = new File(currentDir, newFolder);
@@ -117,20 +135,25 @@
 			throw new FolderAlreadyExistsException();
 		try {
-			if (!newDir.mkdir()) 
-				throw new InvalidFolderNameException();
-		} catch (SecurityException e) {
-			throw new SecurityIssueException();
-		}
-	}
-
-	/* (non-Javadoc)
-	 * @see net.fckeditor.connector.Connector#getFiles(net.fckeditor.handlers.ResourceType, java.lang.String)
-	 */
-	public List<Map<String, Object>> getFiles(ResourceType type, String currentFolder)
-			throws InvalidCurrentFolderException, SecurityIssueException, UnknownException {
-		String baseDir = ConnectorHandler.getUserFilesPath();
-		File typeDir = getAndCreateResourceTypeDir(baseDir, type);
-		File currentDir = new File(typeDir, currentFolder);
-		if (!currentDir.exists())
+			if (!newDir.mkdir())
+				throw new InvalidNewFolderNameException();
+		} catch (SecurityException e) {
+			throw e;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seenet.fckeditor.connector.Connector#getFiles(net.fckeditor.handlers.
+	 * ResourceType, java.lang.String)
+	 */
+	public List<Map<String, Object>> getFiles(ResourceType type,
+			String currentFolder) throws InvalidCurrentFolderException,
+			SecurityException {
+		String absolutePath = RequestCycleHandler
+				.getUserFilesAbsolutePath(ThreadLocalData.getRequest());
+		File typeDir = getAndCreateResourceTypeDir(absolutePath, type);
+		File currentDir = new File(typeDir, currentFolder);
+		if (!currentDir.exists() || !currentDir.isDirectory())
 			throw new InvalidCurrentFolderException();
 
@@ -139,6 +162,7 @@
 		Map<String, Object> fileMap;
 		try {
-			File[] fileList = currentDir.listFiles((FileFilter) FileFileFilter.FILE);
-			files = new ArrayList<Map<String,Object>>(fileList.length);
+			File[] fileList = currentDir
+					.listFiles((FileFilter) FileFileFilter.FILE);
+			files = new ArrayList<Map<String, Object>>(fileList.length);
 			for (File file : fileList) {
 				fileMap = new HashMap<String, Object>(2);
@@ -149,31 +173,34 @@
 			return files;
 		} catch (SecurityException e) {
-			throw new SecurityIssueException();
-		}
-	}
-
-
-	/* (non-Javadoc)
-	 * @see net.fckeditor.connector.Connector#getFolders(net.fckeditor.handlers.ResourceType, java.lang.String)
-	 */
-	public  List<String> getFolders(final ResourceType type, final String currentFolder)
-			throws InvalidCurrentFolderException, SecurityIssueException, UnknownException {
-		String baseDir = ConnectorHandler.getUserFilesPath();
-		File typeDir = getAndCreateResourceTypeDir(baseDir, type);
-		File currentDir = new File(typeDir, currentFolder);
-		if (!currentDir.exists())
-			throw new InvalidCurrentFolderException();
-		if (!currentDir.isDirectory())
-			throw new UnknownException();
+			throw e;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seenet.fckeditor.connector.Connector#getFolders(net.fckeditor.handlers.
+	 * ResourceType, java.lang.String)
+	 */
+	public List<String> getFolders(final ResourceType type,
+			final String currentFolder) throws InvalidCurrentFolderException,
+			SecurityException {
+		String absolutePath = RequestCycleHandler
+				.getUserFilesAbsolutePath(ThreadLocalData.getRequest());
+		File typeDir = getAndCreateResourceTypeDir(absolutePath, type);
+		File currentDir = new File(typeDir, currentFolder);
+		if (!currentDir.exists() || !currentDir.isDirectory())
+			throw new InvalidCurrentFolderException();
+
 		try {
 			String[] fileList = currentDir.list(DirectoryFileFilter.DIRECTORY);
 			return Arrays.asList(fileList);
-		} catch (Exception e) {
-			throw new SecurityIssueException();
-		}
-	}
-
-	
-	private static File getAndCreateResourceTypeDir(final String baseDir, final ResourceType type) {
+		} catch (SecurityException e) {
+			throw e;
+		}
+	}
+
+	private static File getAndCreateResourceTypeDir(final String baseDir,
+			final ResourceType type) throws SecurityException {
 		File dir = new File(servletContext.getRealPath(baseDir), type.getPath());
 		if (!dir.exists())
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/Context.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/Context.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/Context.java	(revision 2591)
@@ -36,4 +36,5 @@
  * @version $Id$
  */
+// TODO is Context an appropriate name?
 public class Context {
 	// This is just a helper class which has no relevance for the logger
@@ -70,4 +71,8 @@
 	public ResourceType getDefaultResourceType() {
 		return ResourceType.getDefaultResourceType(typeStr);
+	}
+	
+	public ResourceType getResourceType() {
+		return ResourceType.getResourceType(typeStr);
 	}
 	
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/impl/ContextPathBuilder.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/impl/ContextPathBuilder.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/impl/ContextPathBuilder.java	(revision 2591)
@@ -24,5 +24,4 @@
 
 import net.fckeditor.handlers.ConnectorHandler;
-import net.fckeditor.requestcycle.ThreadLocalData;
 import net.fckeditor.requestcycle.UserPathBuilder;
 
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/UploadResponse.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/UploadResponse.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/UploadResponse.java	(revision 2591)
@@ -56,4 +56,7 @@
 	/** Error number ERROR */
 	public static final int SC_ERROR = 1;
+	
+	/** Error number UNKNOWN ERROR */
+	public static final int SC_UKNOWN = 110;
 
 	/** Error number RENAMED */
@@ -134,4 +137,8 @@
 	}
 	
+	public static UploadResponse getErrorUnknown() {
+		return new UploadResponse(SC_UKNOWN);
+	}
+	
 	public static UploadResponse getErrorInvalidCommand() {
 		LocalizedPropertiesLoader lpl = LocalizedPropertiesLoader.getInstance(ThreadLocalData.getRequest());
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/UtilsFile.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/UtilsFile.java	(revision 2590)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/UtilsFile.java	(revision 2591)
@@ -146,5 +146,5 @@
 	}
 
-	public static File getUniqueFile(final File file) {
+	public static File getUniqueFile(final File file) throws SecurityException {
 		if (!file.exists())
 			return file;
