/* ==================================================================
* Created [2009-4-27 下午11:32:55] by Jon.King
* ==================================================================
* TSS
* ==================================================================
* mailTo:jinpujun@hotmail.com
* Copyright (c) Jon.King, 2009-2012
* ==================================================================
*/
package com.jinhe.tss.core.exception.convert.impl;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.dao.DataIntegrityViolationException;
import com.jinhe.tss.core.exception.BusinessException;
import com.jinhe.tss.core.exception.convert.IExceptionConvertor;
public class LongerNodeNameExceptionConvertor implements IExceptionConvertor {
public Exception execute(Exception be) {
if(null != be && (be instanceof DataIntegrityViolationException || be instanceof ConstraintViolationException )){
if (be.getCause().getMessage().indexOf("ORA-01401") != -1) {
return new BusinessException("复制失败!名称长度超出范围!", be);
}
}
return be;
}
}