summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-03-03 08:50:45 (EST)
committerChristian Campo2008-03-03 08:50:45 (EST)
commit0524a502a60d85a4bda89e448fd1f7b660c3cf66 (patch)
treebc0dc2daa7c73db880401fd55f7e4e26831ed114
parentc903e094d30231a8bf4a0f8db22aa2f5bb9f028e (diff)
downloadorg.eclipse.riena-0524a502a60d85a4bda89e448fd1f7b660c3cf66.zip
org.eclipse.riena-0524a502a60d85a4bda89e448fd1f7b660c3cf66.tar.gz
org.eclipse.riena-0524a502a60d85a4bda89e448fd1f7b660c3cf66.tar.bz2
ExtensionUtilty return empty array if there are no extensions, throws Exception if extensionpoint does not exist
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/extension/util/ExtensionUtility.java4
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/util/ExtensionUtilTest.java7
2 files changed, 9 insertions, 2 deletions
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/util/ExtensionUtility.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/util/ExtensionUtility.java
index 9651242..1bf7c1c 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/util/ExtensionUtility.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/util/ExtensionUtility.java
@@ -44,11 +44,11 @@ public class ExtensionUtility {
IExtensionRegistry registry = RegistryFactory.getRegistry();
IExtensionPoint extPoint = registry.getExtensionPoint(extensionPoint);
if (extPoint == null) {
- return null;
+ throw new IllegalArgumentException("extension point " + extensionPoint + " does not exist");
}
IExtension[] cfgExtensions = extPoint.getExtensions();
if (cfgExtensions.length == 0) {
- return null;
+ return (T[]) Array.newInstance(interf, 0);
}
ArrayList<Object> list = new ArrayList<Object>();
for (IExtension cfgExt : cfgExtensions) {
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/util/ExtensionUtilTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/util/ExtensionUtilTest.java
index 731fb41..9a3ccba 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/util/ExtensionUtilTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/util/ExtensionUtilTest.java
@@ -43,4 +43,11 @@ public class ExtensionUtilTest extends RienaTestCase {
}
}
}
+
+ public void testExceptionUtil2() {
+ ITest[] tests = ExtensionUtility.readExtensions("core.test.extpoint2", ITest.class);
+ assertFalse(tests == null);
+ assertTrue(tests instanceof ITest[]);
+ assertTrue(tests.length == 0);
+ }
}