Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2008-12-18 15:35:11 -0500
committerpelder2008-12-18 15:35:11 -0500
commitfb825090f7e0f37489fbb45f0b6e0ada4fb246b3 (patch)
treeb646434f8f84f6ae9db9d7e90cf337fa410cec9a
parent55ad7f5982ad9713670e99cb82c0abae00687fce (diff)
downloadorg.eclipse.jet-fb825090f7e0f37489fbb45f0b6e0ada4fb246b3.tar.gz
org.eclipse.jet-fb825090f7e0f37489fbb45f0b6e0ada4fb246b3.tar.xz
org.eclipse.jet-fb825090f7e0f37489fbb45f0b6e0ada4fb246b3.zip
[259258] 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