Bug 177621 - XML log might be corrupted if an exception occurs while extracting problem context
Summary: XML log might be corrupted if an exception occurs while extracting problem co...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-15 14:56 EDT by Olivier Thomann CLA
Modified: 2007-03-21 10:33 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix (4.11 KB, patch)
2007-03-16 09:51 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2007-03-15 14:56:27 EDT
Compiling the org.eclipse.core.tests.resources project on Linux using the default UTF-8 encoding might lead to an xml log being corrupted because of an AIOOBE in the problem context extraction.
Here is the end of the xml log:
		<source output="/builds/N200703151001/src/plugins/org.eclipse.core.tests.resources/temp.folder/resourcestests.jar.bin" path="/builds/N200703151001/src/plugins/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/SymlinkTest.java">
			<problems errors="1" problems="1" warnings="0">
				<problem charEnd="0" charStart="0" id="InvalidEncoding" line="1" severity="ERROR">
					<message value="Cannot read the source from /builds/N200703151001/src/plugins/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/filesystem/SymlinkTest.java; either the file uses a different encoding than UTF-8 or it is corrupted"/>
				</sources>
				<exception class="class java.lang.ArrayIndexOutOfBoundsException" message="-1
java.lang.ArrayIndexOutOfBoundsException: -1
	at org.eclipse.jdt.internal.compiler.batch.Main$Logger.extractContext(Main.java(Compiled Code))
	at org.eclipse.jdt.internal.compiler.batch.Main$Logger.logXmlProblem(Main.java(Compiled Code))
	at org.eclipse.jdt.internal.compiler.batch.Main$Logger.logProblems(Main.java(Compiled Code))
"/>
			</compiler>

The <source> element is not properly closed.
Comment 1 Olivier Thomann CLA 2007-03-16 09:51:04 EDT
Created attachment 61091 [details]
Proposed fix

When the source unit is empty, there is nothing to do.
Patch is safe.
Comment 2 Olivier Thomann CLA 2007-03-16 09:51:51 EDT
Released for 3.3M6.
Comment 3 David Audel CLA 2007-03-21 10:33:03 EDT
Verified for 3.3 M6 using build I20070321-0010

Verified by patching jdtcore to force CompilationUnit#getContents() to throw a CharConversionException