Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348333

Summary: [debug] IllegalArgumentException from launch configuration w/ no project name
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTDTAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P2    
Version: 0.8   
Target Milestone: 2.0 RC4   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
simple fix none

Description Stephan Herrmann CLA 2011-06-05 11:54:54 EDT
When creating a Java Application launch configuration without a proper
selection, the following exception is thrown due to a missing project name:


java.lang.IllegalArgumentException: Path for project must have only one segment.
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.resources.WorkspaceRoot.getProject(WorkspaceRoot.java:184)
	at org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.OTREBlock.hasOTJProject(OTREBlock.java:116)
	at org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.OTREBlock.initializeFrom(OTREBlock.java:96)
	at org.eclipse.objectteams.otdt.internal.debug.adaptor.launching.JDTDebugUILaunchingAdaptor._OT$JavaJRETab$initializeFrom$initializeFrom(JDTDebugUILaunchingAdaptor.java:70)
	at org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab._OT$initializeFrom$chain(JavaJRETab.java)
	at org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab.initializeFrom(JavaJRETab.java)

Apparently the project name isn't null but "".

This exception is quite annoying because it keeps popping at your face
until a valid project name has been entered or the launch config deleted.
Comment 1 Stephan Herrmann CLA 2011-06-05 12:19:50 EDT
Created attachment 197361 [details]
simple fix

This should fix the issue by also testing Path.isValidSegment(projectName),
which is the declared precondition of getProject(String).
Comment 2 Stephan Herrmann CLA 2011-06-05 12:26:25 EDT
The exception is ugly, the fix is simple, safe and well localized.
Releasing for RC4.
Comment 3 Stephan Herrmann CLA 2011-06-07 09:31:08 EDT
Verified using build 20110607730