Author: sergiykarpenko
Date: 2011-09-02 04:22:51 -0400 (Fri, 02 Sep 2011)
New Revision: 4830
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
Log:
EXOJCR-1395: DB2 duplicate key exception handling added
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java 2011-09-01
20:23:57 UTC (rev 4829)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java 2011-09-02
08:22:51 UTC (rev 4830)
@@ -208,6 +208,14 @@
throw new JCRInvalidItemStateException(message, item.getIdentifier(),
ItemState.ADDED, e);
}
+ // DB2 violation
+ if
(e.getClass().getName().indexOf("SqlIntegrityConstraintViolationException")
>= 0
+ && errMessage.indexOf("SQLCODE=-803") >= 0)
+ {
+ message += "Item already exists." + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(),
ItemState.ADDED, e);
+ }
+
message += "Error of item add. " + itemInfo;
ownException = new RepositoryException(message, e);
throw ownException;
Show replies by date