/** * a utility method to extract XQ exception information from the error stack provided * * @param ex the full error chain * @return XQ exception */ public static XQException getXQException(Throwable ex) { int errorCode = 0; Throwable cause = null; String message = ""; while (ex != null) { if (ex instanceof XQException) { return (XQException) ex; } else if (/*errorCode == 0 &&*/ ex instanceof BagriException) { // deeper is better! message += ex.getMessage() + "; "; errorCode = ((BagriException) ex).getErrorCode(); cause = ex; } ex = ex.getCause(); } XQException xqe = new XQException(message, String.valueOf(errorCode)); xqe.initCause(cause); return xqe; }
public void storeCustomerTest() throws Exception { long txId = 0; try { txId = getTxManagement().beginTransaction(); } catch (BagriException ex) { if (ex.getErrorCode() != BagriException.ecTransNoNested) { throw ex; } } uris.add(createDocumentTest(sampleRoot + getFileName("custacc.xml")).getUri()); if (txId > 0) { getTxManagement().commitTransaction(txId); } }
public void storeOrderTest() throws Exception { long txId = 0; try { txId = getTxManagement().beginTransaction(); } catch (BagriException ex) { if (ex.getErrorCode() != BagriException.ecTransNoNested) { throw ex; } } uris.add(createDocumentTest(sampleRoot + getFileName("order123.xml")).getUri()); uris.add(createDocumentTest(sampleRoot + getFileName("order654.xml")).getUri()); if (txId > 0) { getTxManagement().commitTransaction(txId); } }
public void storeSecurityTest() throws Exception { long txId = 0; try { txId = getTxManagement().beginTransaction(); } catch (BagriException ex) { if (ex.getErrorCode() != BagriException.ecTransNoNested) { throw ex; } } uris.add(createDocumentTest(sampleRoot + getFileName("security1500.xml")).getUri()); uris.add(createDocumentTest(sampleRoot + getFileName("security5621.xml")).getUri()); uris.add(createDocumentTest(sampleRoot + getFileName("security9012.xml")).getUri()); uris.add(createDocumentTest(sampleRoot + getFileName("security29674.xml")).getUri()); if (txId > 0) { getTxManagement().commitTransaction(txId); } }