Example usage for org.springframework.transaction TransactionSystemException getMessage

List of usage examples for org.springframework.transaction TransactionSystemException getMessage

Introduction

In this page you can find the example usage for org.springframework.transaction TransactionSystemException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:org.duracloud.mill.audit.AuditLogWritingProcessor.java

@Override
protected void executeImpl() throws TaskExecutionFailedException {

    try {// w  w w.j av a  2s  .c  o m
        String account = task.getAccount();
        String storeId = task.getStoreId();
        String spaceId = task.getSpaceId();
        String contentId = task.getContentId();
        String action = task.getAction();
        Map<String, String> props = task.getContentProperties();
        String acls = task.getSpaceACLs();
        Date timestamp = new Date(Long.valueOf(task.getDateTime()));

        auditLogStore.write(account, storeId, spaceId, contentId, task.getContentChecksum(),
                task.getContentMimetype(), task.getContentSize(), task.getUserId(), action,
                props != null ? AuditLogStoreUtil.serialize(props) : null, acls, task.getSourceSpaceId(),
                task.getSourceContentId(), timestamp);

        log.debug("audit task successfully processed: {}", task);
    } catch (TransactionSystemException e) {
        log.error("failed to write item  ( account={} storeId={} spaceId={} contentId={} timestamp={} ) "
                + "to the database due to a transactional error. Likely cause: duplicate entry. Details: {}. Ignoring...",
                task.getAccount(), task.getStoreId(), task.getSpaceId(), task.getContentId(),
                new Date(Long.valueOf(task.getDateTime())), e.getMessage());
    } catch (Exception e) {
        String message = "Failed to execute " + task + ": " + e.getMessage();
        log.debug(message, e);
        throw new TaskExecutionFailedException(message, e);
    }
}