use of javax.jcr.lock.LockException in project jackrabbit by apache.
the class SessionImpl method importXML.
/**
* @see javax.jcr.Session#importXML(String, java.io.InputStream, int)
*/
@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, PathNotFoundException, ItemExistsException, ConstraintViolationException, VersionException, InvalidSerializedDataException, LockException, RepositoryException {
// NOTE: checks are performed by 'getImportContentHandler'
ImportHandler handler = (ImportHandler) getImportContentHandler(parentAbsPath, uuidBehavior);
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
SAXParser parser = factory.newSAXParser();
parser.parse(new InputSource(in), handler);
} catch (SAXException se) {
// check for wrapped repository exception
Exception e = se.getException();
if (e != null && e instanceof RepositoryException) {
throw (RepositoryException) e;
} else {
String msg = "failed to parse XML stream";
log.debug(msg);
throw new InvalidSerializedDataException(msg, se);
}
} catch (ParserConfigurationException e) {
throw new RepositoryException("SAX parser configuration error", e);
} finally {
// JCR-2903
in.close();
}
}
Aggregations