Source:
<code>protected void onInit() throws Exception { Assert.notNull(directoryExpression, "Local directory to synchronize to is not set"); ctx = new StandardEvaluationContext(); BeanFactory factory = getBeanFactory(); if(factory != null) { ctx.setBeanResolver(new BeanFactoryResolver(factory)); } String directoryPath = directoryExpression.getValue(ctx,String.class); directory = new File(directoryPath); Assert.isTrue(directory != null && directory.exists() && directory.isDirectory(), <START> "Please provide a valid local directory to synchronize the remote files"); <END> if(s3Operations == null) { s3Operations = new AmazonS3OperationsImpl(credentials); } if(AbstractAmazonS3Operations.class.isAssignableFrom(s3Operations.getClass())) { AbstractAmazonS3Operations abstractOperation = (AbstractAmazonS3Operations)s3Operations; abstractOperation.setTemporaryFileSuffix(temporarySuffix); if(StringUtils.hasText(awsEndpoint)) { abstractOperation.setAwsEndpoint(awsEndpoint); } abstractOperation.afterPropertiesSet(); } InboundLocalFileOperationsImpl fileOperations = new InboundLocalFileOperationsImpl(); fileOperations.setTemporaryFileSuffix(temporarySuffix); fileOperations.addEventListener(this); InboundFileSynchronizationImpl synchronizationImpl = new InboundFileSynchronizationImpl(s3Operations, fileOperations); synchronizationImpl.setSynchronizingBatchSize(maxObjectsPerBatch); if(StringUtils.hasText(fileNameWildcard)) { synchronizationImpl.setFileWildcard(fileNameWildcard); } if(StringUtils.hasText(fileNameRegex)) { synchronizationImpl.setFileNamePattern(fileNameRegex); } synchronizationImpl.setAcceptSubFolders(acceptSubFolders); synchronizationImpl.afterPropertiesSet(); this.synchronizer = synchronizationImpl; filesQueue = new ArrayBlockingQueue<File>(QUEUE_CAPACITY); }</code><technical_language>generic - if invalid directory specified, user **why** directory is invalid. E.g. directory exist, directory points a file etc</technical_language>

Target:
protected void onInit() throws Exception { Assert.notNull(directoryExpression, "Local directory to synchronize to is not set"); ctx = new StandardEvaluationContext(); BeanFactory factory = getBeanFactory(); if(factory != null) { ctx.setBeanResolver(new BeanFactoryResolver(factory)); } String directoryPath = directoryExpression.getValue(ctx,String.class); directory = new File(directoryPath); Assert.notNull(directory, "Please provide a valid local directory to synchronize the remote files"); Assert.isTrue(directory.isDirectory(), String.format("Provided path %s is not a directory", directoryPath)); if(s3Operations == null) { s3Operations = new DefaultAmazonS3Operations(credentials); } if(AbstractAmazonS3Operations.class.isAssignableFrom(s3Operations.getClass())) { AbstractAmazonS3Operations abstractOperation = (AbstractAmazonS3Operations)s3Operations; abstractOperation.setTemporaryFileSuffix(temporarySuffix); if(StringUtils.hasText(awsEndpoint)) { abstractOperation.setAwsEndpoint(awsEndpoint); } abstractOperation.afterPropertiesSet(); } InboundLocalFileOperationsImpl fileOperations = new InboundLocalFileOperationsImpl(); fileOperations.setTemporaryFileSuffix(temporarySuffix); fileOperations.addEventListener(this); InboundFileSynchronizationImpl synchronizationImpl = new InboundFileSynchronizationImpl(s3Operations, fileOperations); synchronizationImpl.setSynchronizingBatchSize(maxObjectsPerBatch); if(StringUtils.hasText(fileNameWildcard)) { synchronizationImpl.setFileWildcard(fileNameWildcard); } if(StringUtils.hasText(fileNameRegex)) { synchronizationImpl.setFileNamePattern(fileNameRegex); } synchronizationImpl.setAcceptSubFolders(acceptSubFolders); synchronizationImpl.afterPropertiesSet(); this.synchronizer = synchronizationImpl; filesQueue = new ArrayBlockingQueue<File>(QUEUE_CAPACITY); }