Bug 34658 - Save All failed with unhelpful error message.
Summary: Save All failed with unhelpful error message.
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 2.1 RC3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 34706 34734 34802 34907 36733 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-11 11:54 EST by Mike Wilson CLA
Modified: 2003-04-22 08:42 EDT (History)
6 users (show)

See Also:


Attachments
File which caused the exception. (1.50 KB, text/plain)
2003-03-11 12:10 EST, Mike Wilson CLA
no flags Details
Patch (1.75 KB, patch)
2003-03-13 08:49 EST, 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 Mike Wilson CLA 2003-03-11 11:54:16 EST
I had several editors open in the workbench, three of which were dirty, on of
which was a scrapbook page. When I selected "Save All" from the File menu, I got
a dialog that said "Save Failed: Errors during build.".

The "Reason:" was "Errors during build."

The "Details" was "1802976400".

I do not know what the problem is.
Comment 1 Mike Wilson CLA 2003-03-11 12:10:44 EST
Created attachment 3998 [details]
File which caused the exception.

It appears that the problem occurs when attempting to save the attached Java
file.
Comment 2 Olivier Thomann CLA 2003-03-11 12:18:08 EST
The problem occured during the reconcile operation on the working copy, but I
cannot reproduce it on Windows2000 using RC2.
Comment 3 Olivier Thomann CLA 2003-03-11 12:26:45 EST
I cannot have access to a Mac before Chris MacLaren is back from vacation. So
this PR is on hold till tomorrow.
Comment 4 Veronika Irvine CLA 2003-03-11 13:51:49 EST
Could not reproduce it on Verokina's Mac machine. It is running under JDK1.3.1. So we 
need to try it again on a Mac that has JDK1.4.1.
Comment 5 Mike Wilson CLA 2003-03-11 14:23:04 EST
Here is the stack trace from the log...

java.lang.ArrayIndexOutOfBoundsException: 1802976400
	at org.eclipse.jdt.internal.compiler.parser.Parser.check(Parser.java:616)
	at org.eclipse.jdt.internal.compiler.parser.Parser.tAction(Parser.java:7564)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:6845)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:7070)
	at
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.parseStatements(MethodDeclaration.java:95)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.parseMethod(TypeDeclaration.java:725)
	at org.eclipse.jdt.internal.compiler.Compiler.getMethodBodies(Compiler.java:391)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:527)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:338)
	at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:195)
	at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:145)
	at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:51)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:194)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:122)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:424)
	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:867)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:125)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:181)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:191)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:151)
	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:867)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:165)
	at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:243)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:212)
	at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:884)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1596)
	at
org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot.createModule(CVSWorkspaceRoot.java:358)
	at
org.eclipse.team.internal.ccvs.ui.wizards.SharingWizard$1.run(SharingWizard.java:260)
	at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:95)
Comment 6 Olivier Thomann CLA 2003-03-11 14:40:35 EST
*** Bug 34706 has been marked as a duplicate of this bug. ***
Comment 7 Olivier Thomann CLA 2003-03-11 15:16:58 EST
Add to CC's
Comment 8 Olivier Thomann CLA 2003-03-11 15:41:33 EST
*** Bug 34734 has been marked as a duplicate of this bug. ***
Comment 9 Olivier Thomann CLA 2003-03-11 15:42:44 EST
Could you please try with no jit?
Channing, this page seems to explain how to disable the jit.
http://developer.apple.com/techpubs/macosx/Java/JavaDevelopment/system_properties/chapter_9_section_3.html

Comment 10 Channing Walton CLA 2003-03-11 15:53:27 EST
The properties key in the info.plist seems to be the place you put system properties usually defined with -D - http://developer.apple.com/techpubs/macosx/Java/JavaDevelopment/deploying/chapter_3_section_5.html

But, its not working for me - I'll keep digging. (Perhaps Andre knows how to do this ?)

Channing
Comment 11 Olivier Thomann CLA 2003-03-11 16:01:07 EST
I tried without a jit on my side, but I could not reproduce the problem with or
without the jit. So it looks like it is crashing, but doesn't seem to be 100%
reproducable.
I really looks like a VM problem, but we need to be able to find out what is wrong.
If you have a reproducable test case, please submit your piece of code.
Comment 12 Channing Walton CLA 2003-03-11 16:59:06 EST
I can recreate the problem by creating a plugin project-I used the plugin with
an editor template. 
Comment 13 Channing Walton CLA 2003-03-11 17:09:15 EST
I don't know if it helps but I notice that the line number of the file that the
error occurs at is always 0.
Comment 14 Andre Weinand CLA 2003-03-11 18:03:30 EST
Hi,
I'm on the IBM Websphere conference right now and just had a chance to download 
Apple's final 1.4.1.
I don't know what the problem is, but at least Eclipse runs just fine in its default 
configuration (which is to use 1.3.1).
Please, give me some more time for investigation...
Comment 15 Paul Arena CLA 2003-03-11 18:10:38 EST
It may work fine in it's default configuration, but since Ant is launched in the same VM as Eclipse, if you have custom Ant tasks that get compiled with your project, you have to run Eclipse in 1.4.1 or you'll get a version conflict.  So in cases like mine, I can change the info.plist back to 1.3.1 and successfully compile my application, but it makes the Ant integration with Eclipse rather useless.  
btw, thanks for all your hard work on OS X SWT Andre!
Comment 16 Channing Walton CLA 2003-03-12 04:27:28 EST
In its default configuration, but using the 1.4.1 as the default VM it works
fine too.
Comment 17 Olivier Thomann CLA 2003-03-12 09:49:39 EST
*** Bug 34802 has been marked as a duplicate of this bug. ***
Comment 18 Olivier Thomann CLA 2003-03-12 10:37:38 EST
If I switched to interpreted mode (-Xint), then the index changes. I will try to
see when this is happening exactly, but for now it looks like a serious problem
with the JVM.
Comment 19 ulrich köster CLA 2003-03-12 11:24:18 EST
TestCase for MacOSX 10.2.4 Eclipse RC2 JDK 1.4.1(Final)
Create this class. Save will fail with an InternalCompilerError until you remove the first 
method.

package a.hfhf.fdha.g;
/*
 * Created on 12.03.2003
 *
 * To change this generated comment go to 
 * Window>Preferences>Java>Code Generation>Code Template
 */
/**
 * @author uli
 *
 * To change this generated comment go to 
 * Window>Preferences>Java>Code Generation>Code Template
 */
public class Test {
	//this will fail
	public void test(String string) {
		if ((Object) string instanceof Test)
			return;
	}
	//this work
	public void test(String string) {
		Object object = (Object)string;
		if (object instanceof Test)
			return;
	}
}
Comment 20 ulrich köster CLA 2003-03-12 11:33:16 EST
I don`t know if this is important, but there are two methods that do the check.
The first(check) returns a short
The second (original_state) calls check and returns an int.
Comment 21 Olivier Thomann CLA 2003-03-12 11:39:49 EST
The problem is that it works fine on all VMs except this 1.4.1 VM.
Comment 22 Olivier Thomann CLA 2003-03-12 12:32:37 EST
I added a trace in the parser loop to find out why we get this
ArrayIndexOutOfBoundException. It appears that on the JDK1.4.1 one of the
internal parser tables is shorter than on the JDK1.3.1. So this narrows down
this issue to the initialization of this table.
I will continue to investigate. I'll keep you inform of my progress.
Comment 23 Olivier Thomann CLA 2003-03-12 15:04:53 EST
I located the problem. At least for the ones that report an
ArrayIndexOutOfBoundException in the .log file. The problem appears because the
resource files used to initialize the parser internal tables wasn't completely
read. Our loop to initialize the table was boggus.
Changing it to ensure that the whole file is read fixed the problem. I need to
double-check the code before I release it.
Comment 24 Andre Weinand CLA 2003-03-12 18:11:17 EST
Olivier - could you paste in the fix for this bug ? (philippe)
Comment 25 Channing Walton CLA 2003-03-12 18:26:44 EST
Excellent news that the bug has been found.

I'm curious as to why this bug doesn't occur on other platforms, any idea? Also, what is the class/method where the bug is - just curious.

Channing
Comment 26 Olivier Thomann CLA 2003-03-13 08:46:21 EST
*** Bug 34907 has been marked as a duplicate of this bug. ***
Comment 27 Olivier Thomann CLA 2003-03-13 08:49:17 EST
Created attachment 4093 [details]
Patch

Apply it to compiler/org/eclipse/jdt/internal/compiler/util/Util.java
Comment 28 Olivier Thomann CLA 2003-03-13 08:53:43 EST
Channing, the problem was in the reading of a stream into a byte[]. On the
JDK1.4.1 for MacOS the reading is stopped too early and the table is incomplete.
Therefore in the parser loop if an action requires to go beyond the size of the
table, we end up with the exception you saw.
Why didn't this happen on other platform? I could be due to the implementation
of the native method available() on subclasses of java.io.InputStream or simply
by luck.
I attach the patch for this fix. So feel free to try it.
Comment 29 Channing Walton CLA 2003-03-13 09:08:16 EST
Thanks for the explanation Olivier :-) I'll try the patch later today.

Channing
Comment 30 ulrich köster CLA 2003-03-13 10:04:11 EST
Thanks for the fix Oliver. Works great.
Ulrich
Comment 31 Chris Kau CLA 2003-03-13 10:12:20 EST
Patch works for me too. Thanks Olivier
Comment 32 Paul Arena CLA 2003-03-13 11:44:44 EST
Confirmed as well.  Thanks
Comment 33 Philipe Mulet CLA 2003-03-13 12:00:26 EST
Verified the patch and integrated (with variable rename and -1 special case to 
make it more obvious).

Comment 34 David Audel CLA 2003-03-20 05:25:58 EST
Verified.
Comment 35 Olivier Thomann CLA 2003-04-22 08:42:13 EDT
*** Bug 36733 has been marked as a duplicate of this bug. ***