diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java b/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java index 48528536fd..47f9690638 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java @@ -62,6 +62,7 @@ import javax.swing.plaf.basic.BasicSplitPaneUI; import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreePath; +import org.adempiere.exceptions.DBException; import org.adempiere.plaf.AdempierePLAF; import org.adempiere.plaf.AdempiereTaskPaneUI; import org.compiere.apps.ADialog; @@ -811,7 +812,7 @@ public final class VTreePanel extends CPanel MTreeNode nd = (MTreeNode)tree.getSelectionPath().getLastPathComponent(); if (barDBupdate(true, nd.getNode_ID())) addToBar(nd,getParentToolBar(nd), false); - else if (CLogger.retrieveException().getMessage().indexOf("ORA-00001")!=-1) + else if (DBException.isUniqueContraintError(CLogger.retrieveException())) ADialog.error(0, this, "BookmarkExist", null); } // barAdd diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java index ed31e1e433..277cfcf68a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java @@ -15,10 +15,13 @@ package org.adempiere.webui.dashboard; import java.util.Enumeration; +import org.adempiere.exceptions.DBException; import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.window.FDialog; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; +import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.zkoss.zk.ui.Component; @@ -101,11 +104,11 @@ public class DPFavourites extends DashboardPanel implements EventListener { MTree vTree = new MTree(Env.getCtx(), AD_Tree_ID, false, true, null); MTreeNode m_root = vTree.getRoot(); - Enumeration enTop = m_root.children(); + Enumeration enTop = m_root.children(); while(enTop.hasMoreElements()) { MTreeNode ndTop = (MTreeNode)enTop.nextElement(); - Enumeration en = ndTop.preorderEnumeration(); + Enumeration en = ndTop.preorderEnumeration(); while (en.hasMoreElements()) { MTreeNode nd = (MTreeNode)en.nextElement(); @@ -247,6 +250,9 @@ public class DPFavourites extends DashboardPanel implements EventListener { bxFav.appendChild(btnFavItem); bxFav.removeChild(lblMsg); bxFav.invalidate(); + } else { + if (DBException.isUniqueContraintError(CLogger.retrieveException())) + FDialog.error(0, this, "BookmarkExist", null); } } }