Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEsteban Dugueperoux2014-10-27 09:03:12 -0400
committerEsteban Dugueperoux2014-10-27 10:41:35 -0400
commitc86a56c32e8aa67e409c6a6f13e1b910e965aa12 (patch)
treeae0f7587580b7d7428baf77cbab3a00b0d335309
parentcbf0ec5ead5a5acc20b25b3ac70de4a9d5f3af2f (diff)
downloadcdo-c86a56c32e8aa67e409c6a6f13e1b910e965aa12.tar.gz
cdo-c86a56c32e8aa67e409c6a6f13e1b910e965aa12.tar.xz
cdo-c86a56c32e8aa67e409c6a6f13e1b910e965aa12.zip
[448949] Have a specific Exception similar to
org.eclipse.emf.ecore.xmi.PackageNotFoundException Add org.eclipse.emf.cdo.util.PackageNotFoundException to be thrown by CDOSessionImpl.loadPackages(). Change-Id: Iea22434675e8021a1f6ecf3947bb8521085ab9fc Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=448949 Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/PackageNotFoundException.java44
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java4
2 files changed, 46 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/PackageNotFoundException.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/PackageNotFoundException.java
new file mode 100644
index 0000000000..44e673439d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/PackageNotFoundException.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.util;
+
+import org.eclipse.emf.cdo.common.util.CDOException;
+
+import org.eclipse.emf.internal.cdo.messages.Messages;
+
+import org.eclipse.emf.ecore.EPackage.Registry;
+
+import java.text.MessageFormat;
+
+/**
+ * A {@link CDOException} to indicate that an EPackage is not available in the current {@link Registry}
+ *
+ * @author Esteban Dugueperoux
+ * @since 4.4
+ */
+public class PackageNotFoundException extends CDOException
+{
+ private static final long serialVersionUID = 1L;
+
+ private String uri;
+
+ public PackageNotFoundException(String uri)
+ {
+ super(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), uri));
+ this.uri = uri;
+ }
+
+ public String uri()
+ {
+ return uri;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index 804d2f8e5a..ca660a2fe1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -52,7 +52,6 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
import org.eclipse.emf.cdo.common.security.CDOPermission;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.common.util.CDOException;
import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent;
import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
@@ -83,6 +82,7 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.spi.common.revision.PointerCDORevision;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.util.PackageNotFoundException;
import org.eclipse.emf.cdo.view.CDOFetchRuleManager;
import org.eclipse.emf.cdo.view.CDOView;
@@ -563,7 +563,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
{
if (!options().isGeneratedPackageEmulationEnabled())
{
- throw new CDOException(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), packageUnit)); //$NON-NLS-1$
+ throw new PackageNotFoundException(packageUnit.getID());
}
}

Back to the top