Package org.openrdf.sail.rdbms.exceptions

Source Code of org.openrdf.sail.rdbms.exceptions.RdbmsException

/*
* Copyright Aduna (http://www.aduna-software.com/) (c) 2008.
*
* Licensed under the Aduna BSD-style license.
*/
package org.openrdf.sail.rdbms.exceptions;

import java.sql.BatchUpdateException;
import java.sql.SQLException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.openrdf.store.StoreException;

/**
* SailExcetion from an RDBMS store.
*
* @author James Leigh
*/
public class RdbmsException extends StoreException {

  private static Logger logger = LoggerFactory.getLogger(RdbmsException.class);

  private static final long serialVersionUID = -4004800841908629772L;

  private static SQLException findInterestingCause(SQLException e) {
    if (e instanceof BatchUpdateException) {
      BatchUpdateException b = (BatchUpdateException)e;
      logger.error(b.toString(), b);
      return b.getNextException();
    }
    return e;
  }

  public RdbmsException(SQLException e) {
    super(findInterestingCause(e));
  }

  public RdbmsException(String msg) {
    super(msg);
  }

  public RdbmsException(String msg, Exception e) {
    super(msg, e);
  }

  public RdbmsException(Exception e) {
    super(e);
  }

}
TOP

Related Classes of org.openrdf.sail.rdbms.exceptions.RdbmsException

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.