Bug 23969 - Launcher should throw JVM exit code to parent process when build fails
Summary: Launcher should throw JVM exit code to parent process when build fails
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.0   Edit
Hardware: Other Windows 2000
: P3 major (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Darin Swanson CLA
QA Contact:
URL:
Whiteboard:
Keywords: core
Depends on:
Blocks:
 
Reported: 2002-09-23 07:01 EDT by Gunnar Wagenknecht CLA
Modified: 2003-02-21 18:36 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2002-09-23 07:01:23 EDT
To have a suitable build it is necessary to execute Eclipse AntRunner from 
within the Eclipse launcher in our build process.

There are two ways to do this.

(1)
<exec executable="/eclipse/eclipse" dir="/eclipse" failonerror="true">
  <arg line="-nosplash -application org.eclipse.ant.core.antRunner [...]"/>
</exec>

(2)
<java classname="org.eclipse.core.launcher.Main" jvm="/eclipse/jre/bin/java" 
fork="true" dir="/eclipse" failonerror="true">
  <arg line="-application org.eclipse.ant.core.antRunner [...]"/>
  <classpath>
    <pathelement path="/eclipse/startup.jar"/>
  </classpath>
</java>

The "failonerror" option is very important to recognice failures in the 
executed build scripts. This doesn't work because the error level (system exit 
code) is zero in both cases.

May be the "org.eclipse.ant.core.antRunner" is involded too but I'm not sure.
Comment 1 Darin Wright CLA 2002-11-15 13:45:59 EST
Needs investigation
Comment 2 Darin Swanson CLA 2002-12-09 10:45:06 EST
Not going to get to in M4
Comment 3 Darin Swanson CLA 2003-02-20 18:23:08 EST
DJ, I am looking into this (finally :-) )and I have a few questions:
where is the source for the classes in startup.jar?
We are throwing an exception out of our "application" yet the system exit code 
indicates success?
Comment 4 Darin Swanson CLA 2003-02-20 18:32:44 EST
It seems to me that InternalBootLoader.run(String, URL, String[], Runnable) has 
a flaw that it will always eat exceptions with the return statement in the 
finally block.
Comment 5 DJ Houghton CLA 2003-02-21 08:56:03 EST
org.eclipse.core.launcher.Main is in the org.eclipse.platform plug-in project.

Check out Main.basicRun. InternalBootloader.run should throw a wrapped 
exception (since the method sig doesn't permit exception throwing) and then the 
code in Main will catch it and throw the wrapped guy.
Comment 6 Darin Swanson CLA 2003-02-21 09:23:07 EST
I am confused...InternalBootLoader run methods both claim to throw Exception?

But with the return in the finally block, no exception, wrapped or otherwise 
will be thrown out of the method.
Comment 7 DJ Houghton CLA 2003-02-21 09:39:17 EST
Oops...sorry, a case of it being too early in the morning and my editor not 
scrolling to the right to see the rest of the method sig.

Yes, I see what you are saying now. Let me take a look at it and see what the 
scoop is but at first glance it looks like anyone not going through our Main 
class will be screwed because they'd be expecting an Exception, not their 
exception wrapped in an InvocationTargetException.
Comment 8 Darin Swanson CLA 2003-02-21 09:44:46 EST
No, even going through the Main class...unless I am misreading the code, no 
exceptions will come out of the InternalBootLoader try block because of the 
return statement in the finally. Is "return result;" supposed to be in the 
finally block?

try {
	result = runnable.run(applicationArgs);
} catch (Throwable e) {
	e.printStackTrace();
	throw new InvocationTargetException(e);
} finally {
	shutdown();
	return result;
}
Comment 9 DJ Houghton CLA 2003-02-21 09:53:03 EST
Every week I have "one of those days". 
Today is that day. :-)

I have released the change and it will be included in this morning's RC1 
candidate re-build.
Comment 10 Darin Swanson CLA 2003-02-21 09:57:51 EST
Thanks DJ :-)
I will check out the fix later today.
Comment 11 Darin Swanson CLA 2003-02-21 18:36:04 EST
Verified fixed in build 20030221.