From: <luc...@us...> - 2009-08-13 10:47:24
|
Revision: 1262 http://openutils.svn.sourceforge.net/openutils/?rev=1262&view=rev Author: lucaboati Date: 2009-08-13 10:47:14 +0000 (Thu, 13 Aug 2009) Log Message: ----------- do not export root node (ex website.xml) Modified Paths: -------------- trunk/openutils-mgnlbootstrapsync/src/main/java/it/openutils/mgnlbootstrapsync/listener/AbstractBootstrapSyncListener.java Modified: trunk/openutils-mgnlbootstrapsync/src/main/java/it/openutils/mgnlbootstrapsync/listener/AbstractBootstrapSyncListener.java =================================================================== --- trunk/openutils-mgnlbootstrapsync/src/main/java/it/openutils/mgnlbootstrapsync/listener/AbstractBootstrapSyncListener.java 2009-08-13 10:46:07 UTC (rev 1261) +++ trunk/openutils-mgnlbootstrapsync/src/main/java/it/openutils/mgnlbootstrapsync/listener/AbstractBootstrapSyncListener.java 2009-08-13 10:47:14 UTC (rev 1262) @@ -189,7 +189,6 @@ { parentHandle = "/"; } - // check if path is under a "compressed" node String pathParentToExport = this.watch.getExportRoots().getRootPath(parentHandle); @@ -281,7 +280,6 @@ { parentHandle = "/"; } - BootstrapAtomicFilter xmlReader = new BootstrapAtomicFilter(XMLReaderFactory .createXMLReader(org.apache.xerces.parsers.SAXParser.class.getName())); @@ -312,34 +310,39 @@ */ protected void exportFile(String fileName, XMLReader reader, HierarchyManager hm, String handle) { - // create necessary parent directories - File folder = new File(Path.getAbsoluteFileSystemPath(watch.getExportPath())); - folder.mkdirs(); + // do not export root (ex. website.xml) + if (StringUtils.isNotBlank(handle) && !StringUtils.equals(handle, "/")) + { + // create necessary parent directories + File folder = new File(Path.getAbsoluteFileSystemPath(watch.getExportPath())); + folder.mkdirs(); - File xmlFile = new File(folder.getAbsoluteFile(), fileName); - FileOutputStream fos = null; - try - { - fos = new FileOutputStream(xmlFile); + File xmlFile = new File(folder.getAbsoluteFile(), fileName); + FileOutputStream fos = null; + try + { + fos = new FileOutputStream(xmlFile); + } + catch (FileNotFoundException e) + { + log.error(e.getMessage(), e); + return; + } + + try + { + executeExport(fos, reader, hm.getWorkspace().getSession(), handle, watch.getRepository()); + } + catch (IOException e) + { + log.error(e.getMessage(), e); + } + finally + { + IOUtils.closeQuietly(fos); + } } - catch (FileNotFoundException e) - { - log.error(e.getMessage(), e); - return; - } - try - { - executeExport(fos, reader, hm.getWorkspace().getSession(), handle, watch.getRepository()); - } - catch (IOException e) - { - log.error(e.getMessage(), e); - } - finally - { - IOUtils.closeQuietly(fos); - } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |