use of com.liferay.portal.kernel.xml.DocumentException in project liferay-ide by liferay.
the class MediaWikiImporter method importPages.
@Override
public void importPages(long userId, WikiNode node, InputStream[] inputStreams, Map<String, String[]> options) throws PortalException {
if ((inputStreams.length < 1) || (inputStreams[0] == null)) {
throw new PortalException("The pages file is mandatory");
}
InputStream pagesInputStream = inputStreams[0];
InputStream usersInputStream = inputStreams[1];
InputStream imagesInputStream = inputStreams[2];
try {
Document document = SAXReaderUtil.read(pagesInputStream);
Map<String, String> usersMap = readUsersFile(usersInputStream);
Element rootElement = document.getRootElement();
List<String> specialNamespaces = readSpecialNamespaces(rootElement);
processSpecialPages(userId, node, rootElement, specialNamespaces);
processRegularPages(userId, node, rootElement, specialNamespaces, usersMap, imagesInputStream, options);
processImages(userId, node, imagesInputStream);
moveFrontPage(userId, node, options);
} catch (DocumentException de) {
throw new ImportFilesException("Invalid XML file provided");
} catch (IOException ioe) {
throw new ImportFilesException("Error reading the files provided");
} catch (PortalException pe) {
throw pe;
} catch (Exception e) {
throw new PortalException(e);
}
}
Aggregations