Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2008-12-18 16:43:32 -0500
committerpelder2008-12-18 16:43:32 -0500
commit39f2e9857387aabd5f9d945c17cf520ba23160aa (patch)
treeb3f9c83c9cb2c1c286f09cd0e414e72fd338e331
parent2d47f4d108fc30c6c79164e6b06443b96c39816b (diff)
downloadorg.eclipse.jet-39f2e9857387aabd5f9d945c17cf520ba23160aa.tar.gz
org.eclipse.jet-39f2e9857387aabd5f9d945c17cf520ba23160aa.tar.xz
org.eclipse.jet-39f2e9857387aabd5f9d945c17cf520ba23160aa.zip
[259313] JET throws IllegalArgumentException when a non-existant resource is specified in a launch configuraiton
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java2
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties1
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java32
3 files changed, 29 insertions, 6 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java
index d4b34da..8820ad2 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.java
@@ -272,6 +272,8 @@ public class JET2Messages extends NLS
public static String JET2Platform_TransformNotFound;
+ public static String JET2TransformationDelegate_MissingAttribute;
+
public static String SetTag_CoundNotSet;
public static String XPath_NoValueForAttribute;
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties
index 9e5110c..2858482 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/l10n/JET2Messages.properties
@@ -74,6 +74,7 @@ JET2Compiler_PrefixAlreadyAssigned=The namespace prefix "{0}" is already associa
JET2Platform_CouldNotParseString=Could not parse String input as XML
JET2Platform_ErrorMarkingProject=Exception marking project with runtime errors
JET2Bundle_CouldNotInstantiateLoader=Could not instantiate JET template loader
+JET2TransformationDelegate_MissingAttribute=The attribute ''{0}'' is not specified in the launch configuration ''{1}''
PluginDeployedTemplateBundleSupplier_BadExtensionElement=Malformed {0} element in {1} extension in plugin.xml
PluginReferencedTemplateBundleDescriptor_Retrieving=Retrieving JET Transformation Bundle: {0}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java
index 129af53..0d8f890 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java
@@ -21,12 +21,19 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.jet.JET2Platform;
+import org.eclipse.jet.internal.l10n.JET2Messages;
import org.eclipse.jet.internal.runtime.RuntimeLoggerContextExtender;
import org.eclipse.jet.transform.JETLaunchConstants;
+import org.eclipse.osgi.util.NLS;
/**
@@ -61,12 +68,21 @@ public class JET2TransformationDelegate implements ILaunchConfigurationDelegate
private IResource getSource(ILaunchConfiguration configuration) throws CoreException
{
- String sourcePath = configuration.getAttribute(JETLaunchConstants.SOURCE, (String)null);
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
- IResource resource = wsRoot.findMember(sourcePath);
- if (resource == null)
+ final String sourcePath = configuration.getAttribute(JETLaunchConstants.SOURCE, (String)null);
+ if (sourcePath == null)
{
- throw new IllegalArgumentException();
+ IStatus status = new Status(IStatus.ERROR,JET2Platform.PLUGIN_ID,
+ NLS.bind(JET2Messages.JET2TransformationDelegate_MissingAttribute,
+ JETLaunchConstants.SOURCE,
+ configuration.getName()));
+ throw new CoreException(status);
+ }
+ final IPath path = new Path(sourcePath);
+ final IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource = wsRoot.findMember(path);
+ if(resource == null) {
+ // assume its a file, at least that way, JET will issue an error message
+ resource = path.segmentCount() == 1 ? (IResource)wsRoot.getProject(path.segment(0)) : (IResource)wsRoot.getFile(path);
}
return resource;
}
@@ -76,7 +92,11 @@ public class JET2TransformationDelegate implements ILaunchConfigurationDelegate
String id = configuration.getAttribute(JETLaunchConstants.ID, (String)null);
if (id == null)
{
- throw new IllegalArgumentException();
+ IStatus status = new Status(IStatus.ERROR,JET2Platform.PLUGIN_ID,
+ NLS.bind(JET2Messages.JET2TransformationDelegate_MissingAttribute,
+ JETLaunchConstants.ID,
+ configuration.getName()));
+ throw new CoreException(status);
}
return id;
}

Back to the top