code: private static synchronized void checkAndCreateUploadDir(final Path uploadDir, final Logger log) throws IOException {
  		if (Files.exists(uploadDir) && Files.isWritable(uploadDir)) {
  			log.info("Using directory {} for file uploads.", uploadDir);
  		} else if (Files.isWritable(Files.createDirectories(uploadDir))) {
  			log.info("Created directory {} for file uploads.", uploadDir);
  		} else {
  			log.warn("Upload directory {} cannot be created or is not writable.", uploadDir);
  			throw new IOException(
  				String.format("Upload directory %s cannot be created or is not writable.",
  					uploadDir));
  		}
  	}
docs: Checks whether the given directory exists and is writable. If it doesn't exist, this method
  will attempt to create it.
  
  @param uploadDir directory to check
  @param log logger used for logging output
  @throws IOException if the directory does not exist and cannot be created, or if the
  directory isn't writable