Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2015-03-21 12:52:58 -0400
committerRyan Brooks2015-03-25 14:11:42 -0400
commit43e90688d8afdd5d863c8efa95e24c978904f942 (patch)
tree7e3c1c67c718353399169e3c6b4020867c8fb92c /plugins/org.eclipse.osee.framework.resource.management/src
parentae6a2a9d99a88390178eaede55d42d2a8840e9d0 (diff)
downloadorg.eclipse.osee-43e90688d8afdd5d863c8efa95e24c978904f942.tar.gz
org.eclipse.osee-43e90688d8afdd5d863c8efa95e24c978904f942.tar.xz
org.eclipse.osee-43e90688d8afdd5d863c8efa95e24c978904f942.zip
refinement: Improve error message for no locator found
Diffstat (limited to 'plugins/org.eclipse.osee.framework.resource.management/src')
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java30
1 files changed, 9 insertions, 21 deletions
diff --git a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java
index f760a398fe..15d449a632 100644
--- a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java
+++ b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java
@@ -10,13 +10,13 @@
*******************************************************************************/
package org.eclipse.osee.framework.resource.management.internal;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import org.eclipse.osee.framework.core.exception.OseeNotFoundException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.framework.resource.management.IResourceListener;
@@ -24,7 +24,6 @@ import org.eclipse.osee.framework.resource.management.IResourceLocator;
import org.eclipse.osee.framework.resource.management.IResourceLocatorProvider;
import org.eclipse.osee.framework.resource.management.IResourceManager;
import org.eclipse.osee.framework.resource.management.IResourceProvider;
-import org.eclipse.osee.framework.resource.management.exception.MalformedLocatorException;
/**
* @author Roberto E. Escobar
@@ -88,18 +87,14 @@ public class ResourceManager implements IResourceManager {
}
private IResourceProvider getProvider(IResourceLocator locator) throws OseeCoreException {
- IResourceProvider toReturn = null;
for (IResourceProvider provider : resourceProviders) {
- if (provider.isValid(locator) != false) {
- toReturn = provider;
- break;
+ if (provider.isValid(locator)) {
+ return provider;
}
}
- if (toReturn == null) {
- throw new OseeNotFoundException("Invalid Locator: [%s]", locator);
- }
- return toReturn;
+ throw new OseeNotFoundException("No resource provider found for Locator: [%s]. Searched providers: [%s]",
+ locator, Arrays.deepToString(resourceProviders.toArray()));
}
public boolean addResourceProvider(IResourceProvider resourceProvider) {
@@ -174,20 +169,13 @@ public class ResourceManager implements IResourceManager {
}
private IResourceLocatorProvider getProvider(String protocol) throws OseeCoreException {
- if (resourceLocatorProviders.isEmpty()) {
- throw new OseeStateException("Resource locator providers are not available");
- }
- IResourceLocatorProvider toReturn = null;
for (IResourceLocatorProvider provider : resourceLocatorProviders) {
if (provider.isValid(protocol)) {
- toReturn = provider;
- break;
+ return provider;
}
}
- if (toReturn == null) {
- throw new MalformedLocatorException("Error finding locator for [%s] in [%s]", protocol,
- resourceLocatorProviders);
- }
- return toReturn;
+
+ throw new OseeNotFoundException("No locator proivder found for [%s]. Searched providers: [%s]", protocol,
+ Arrays.deepToString(resourceLocatorProviders.toArray()));
}
}

Back to the top