Bug 103636 - JDT compiler produces invalid XML
Summary: JDT compiler produces invalid XML
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-13 07:42 EDT by Maarten Coene CLA
Modified: 2005-09-26 13:15 EDT (History)
0 users

See Also:


Attachments
The Ant build file (417 bytes, text/xml)
2005-07-14 02:13 EDT, Maarten Coene CLA
no flags Details
A test class (79 bytes, application/octet-stream)
2005-07-14 02:13 EDT, Maarten Coene CLA
no flags Details
The compiler output (7.77 KB, text/xml)
2005-07-14 02:15 EDT, Maarten Coene CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maarten Coene CLA 2005-07-13 07:42:35 EDT
Hi,

if the JDT compiler encounters compile errors, the produced XML log file is not 
valid (it doesn't has a </sources> element). 

I'm calling this compiler from Ant like this:

<java fork="true" 
      jar="C:/java/tools/org.eclipse.jdt.core_3.1.0.jar">
    <arg line="-cp ${jdt-compile.classpath}" />
    <arg line="-d none" />
    <arg line="-warn:deprecation" />
    <arg line="-source 1.4"/>
    <arg line="-log ${build.reports.deprecated}/compile-warnings.xml" />
    <arg line="${src.dir} ${src.test.dir}" />
</java>

regards,
Maarten
Comment 1 Olivier Thomann CLA 2005-07-13 09:26:12 EDT
Do you mean syntax errors?
Comment 2 Maarten Coene CLA 2005-07-13 10:05:56 EDT
This is an example of the generated XML file when compilation fails.

Remark that there is no closing "</sources>" tag before the <stats> element! 
This makes the file unusable since no XML parser will be able to parse it!

<?xml version="1.0" encoding="UTF-8"?>
<!-- 13 jul 2005 16:01:04 -->
<!DOCTYPE compiler SYSTEM "compiler.dtd">
<compiler name="Eclipse Java Compiler" copyright="Copyright IBM Corp 2000, 
2005. All rights reserved." version="0.570, 3.1.0 release">
	<command_line>
            ...
	</command_line>
	<options>
            ...
	</options>
	<classpaths>
	</classpaths>
	<sources>
		<source path="c:\temp\FaultTest.java">
			<problems problems="1" errors="1" warnings="0">
				<problem charEnd="959" charStart="952" 
severity="ERROR" line="36" id="UndefinedName">
					<message value="message2 cannot be 
resolved"/>
					<source_context value="super
(message2);" sourceStart="6" sourceEnd="13"/>
					<arguments>
						<argument value="message2"/>
					</arguments>
				</problem>
			</problems>
		</source>
		<stats>
			<problem_summary problems="1" errors="1" warnings="0" 
tasks="0"/>
		</stats>
	</compiler>
Comment 3 Olivier Thomann CLA 2005-07-13 13:48:30 EDT
Could you please provide your test case?
I tried and it works fine for me.
Could you also specify the build id?
Comment 4 Maarten Coene CLA 2005-07-13 15:43:47 EDT
How do I know the build id?
I've used the jar that came with the eclipse 3.1 release....

I'll provide a test case tomorrow.

Some extra information: I've used:
- ant 1.6.1
- jdk 1.4.2_06
- windows 2000

I've ran the ant build script outside Eclipse.

regards
Maarten
Comment 5 Maarten Coene CLA 2005-07-14 02:13:06 EDT
Created attachment 24733 [details]
The Ant build file

This is the Ant build file that calls the JDT compiler
Comment 6 Maarten Coene CLA 2005-07-14 02:13:49 EDT
Created attachment 24734 [details]
A test class

This is a java file that doesn't compile
Comment 7 Maarten Coene CLA 2005-07-14 02:15:24 EDT
Created attachment 24736 [details]
The compiler output

This is the output produced by the JDT compiler. As you can see, the produced
XML is not well-formed since there is no closing </sources> tag.
Comment 8 Maarten Coene CLA 2005-07-14 02:20:49 EDT
I've added a test case.

1. Place the build.xml and the java file in a directory.
2. Modify the path to org.eclipse.jdt.core_3.1.0.jar in the build.xml file
2. Run "ant compile" from the command prompt. This produces a 
file 'compiler.xml'. 

I've uploaded this compiler.xml file as well

I'm using:
- Ant 1.6.1
- Java 1.4.2_06 (build 1.4.2_06-b03)
- Windows 2000
- Eclipse 3.1

regards,
Maarten
Comment 9 Olivier Thomann CLA 2005-07-14 13:46:18 EDT
Reproduced.
I am working on it.
Comment 10 Olivier Thomann CLA 2005-07-14 14:03:19 EDT
I can reproduce using the ant adapter, but I cannot reproduce using the batch
compiler.
I am investigating what could be wrong.
Comment 11 Olivier Thomann CLA 2005-07-14 14:21:42 EDT
Fixed and released in HEAD and 3.1 maintenance streams.
Comment 12 Olivier Thomann CLA 2005-07-14 14:24:09 EDT
As a workaround for now, you can add the following argument:
 <arg line="-noExit" />

In your java task or you use a javac task with the Eclipse ant adapter. See the
Eclipse doc to do so.
Comment 13 Olivier Thomann CLA 2005-08-11 10:27:40 EDT
Verified for 3.2 M1 with I20050811-0010
Comment 14 Maxime Daniel CLA 2005-09-21 09:33:28 EDT
Verified for 3.2 M2 with build I20050920-0010.
Comment 15 David Audel CLA 2005-09-26 13:15:36 EDT
Verified using M20050923-1430 for 3.1.1