List of usage examples for org.apache.commons.io.filefilter IOFileFilter toString
public String toString()
From source file:com.oxiane.maven.xqueryMerger.Merger.java
@Override public void execute() throws MojoExecutionException { Path sourceRootPath = inputSources.toPath(); Path destinationRootPath = outputDirectory.toPath(); IOFileFilter filter = buildFilter(); Iterator<File> it = FileUtils.iterateFiles(inputSources, filter, FileFilterUtils.directoryFileFilter()); if (!it.hasNext()) { getLog().warn("No file found matching " + filter.toString() + " in " + inputSources.getAbsolutePath()); }//ww w .j a v a2s.c om while (it.hasNext()) { File sourceFile = it.next(); Path fileSourcePath = sourceFile.toPath(); Path relativePath = sourceRootPath.relativize(fileSourcePath); getLog().debug("[Merger] found source: " + fileSourcePath.toString()); getLog().debug("[Merger] relative path is " + relativePath.toString()); StreamSource source = new StreamSource(sourceFile); XQueryMerger merger = new XQueryMerger(source); merger.setMainQuery(); File destinationFile = destinationRootPath.resolve(relativePath).toFile(); getLog().debug("[Merger] destination will be " + destinationFile.getAbsolutePath()); try { String result = merger.merge(); destinationFile.getParentFile().mkdirs(); OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(destinationFile), merger.getEncoding()); osw.write(result); osw.flush(); osw.close(); getLog().debug("[Merger] " + relativePath.toString() + " merged into " + destinationFile.getAbsolutePath()); } catch (ParsingException ex) { getLog().error(ex.getMessage()); throw new MojoExecutionException("Merge of " + sourceFile.getAbsolutePath() + " fails", ex); } catch (FileNotFoundException ex) { getLog().error(ex.getMessage()); throw new MojoExecutionException( "Unable to create destination " + destinationFile.getAbsolutePath(), ex); } catch (IOException ex) { getLog().error(ex.getMessage()); throw new MojoExecutionException("While writing " + destinationFile.getAbsolutePath(), ex); } } }