Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320167 - Auto-Activation works only once
Summary: Auto-Activation works only once
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P3 blocker (vote)
Target Milestone: 3.6.1   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 350854 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-17 10:09 EDT by Jan CLA
Modified: 2011-06-30 13:36 EDT (History)
8 users (show)

See Also:
srikanth_sankaran: review+


Attachments
Complete Logfile (8.40 KB, application/octet-stream)
2010-07-23 14:19 EDT, Jan CLA
no flags Details
Proposed fix (2.81 KB, patch)
2010-08-04 17:30 EDT, Olivier Thomann CLA
no flags Details | Diff
fix + test (20.03 KB, patch)
2010-08-05 10:31 EDT, Ayushman Jain CLA
no flags Details | Diff
Regression test for the change in CharOperation (1.29 KB, patch)
2010-08-05 16:15 EDT, Olivier Thomann CLA
no flags Details | Diff
cumulative patch (23.54 KB, patch)
2010-08-09 05:47 EDT, Ayushman Jain CLA
no flags Details | Diff
Logfile (24.16 KB, application/octet-stream)
2010-08-10 08:54 EDT, Jan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan CLA 2010-07-17 10:09:21 EDT
First I get a warning with that exceptions:

eclipse.buildId=I20100608-0911
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product


Warning
Sat Jul 17 15:56:54 CEST 2010


java.lang.ArrayIndexOutOfBoundsException: -1
	at org.eclipse.jdt.core.compiler.CharOperation.indexOf(CharOperation.java:2126)
	at org.eclipse.jdt.core.compiler.CharOperation.indexOf(CharOperation.java:2063)
	at org.eclipse.jdt.internal.core.JavadocContents.computeChildrenSections(JavadocContents.java:213)
	at org.eclipse.jdt.internal.core.JavadocContents.computeMethodRange(JavadocContents.java:300)
	at org.eclipse.jdt.internal.core.JavadocContents.getMethodDoc(JavadocContents.java:126)
	at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:560)
	at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:470)
	at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:450)
	at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:96)
	at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:76)
	at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:59)
	at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:555)
	at org.eclipse.jface.text.contentassist.AdditionalInfoController$3.run(AdditionalInfoController.java:106)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

And after that, I get this error, and Auto-Activation does not work anymore.

eclipse.buildId=I20100608-0911
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product


Error
Sat Jul 17 15:57:09 CEST 2010
Unhandled event loop exception

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ArrayIndexOutOfBoundsException)
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.ArrayIndexOutOfBoundsException

After restarting eclipse the auto-activation feature works again only once...

-- Configuration Details --
Product: Eclipse 1.3.0.20100617-0520 (org.eclipse.epp.package.java.product)
Installed Features:
 org.eclipse.platform 3.6.0.v20100602-9gF78GpqFt6trOGhL60z0oEx3fz-JKNwxPY
Comment 1 Dani Megert CLA 2010-07-19 04:14:08 EDT
What exactly do you mean with "Auto-Activation"? Which editor? Steps?Please 

Might be a duplicate of bug 317570 but hard to say without having the complete .log file.
Comment 2 Jan CLA 2010-07-19 05:14:45 EDT
It is hard for me to reproduce, too, because this can be only reproduced with a special internet provider, which blocks some ports, so loading the Javadoc fails... (Vodafone Germany, UMTS)

And I am there not until Friday, so I can reproduce this at Friday at the earliest.
Comment 3 Jan CLA 2010-07-19 05:18:13 EDT
Auto-Activation is the thing which completes code...
Comment 4 Ayushman Jain CLA 2010-07-19 05:27:02 EDT
I'll follow up. Jan, please do let us know the steps to reproduce once you are able to do so to help us investigate further. Thanks!
Comment 5 Jan CLA 2010-07-23 14:19:58 EDT
Created attachment 175092 [details]
Complete Logfile

Okay, here it is.
In attachement the .log-file - besides I created a video to make clear, what I mean with the bug description from above.

http://www.youtube.com/watch?v=l43ouo4OPUg

The bug occurs only with the internet provider "Vodafone Germany" - UMTS (3G). I guess because they are blocking some of internet contents (e.g. I am also not able to be the hoster at some internet games - because Vodafone blocks incoming connections...)
Comment 6 Will Horn CLA 2010-08-02 14:45:18 EDT
I get a similar error on Linux after doing an auto complete in a specific case (on a static assert method in a JUnit 3 TestCase test, e.g. "assertS" + Ctrl + Space ).  However, for me, the entire UI fails.  It is not a hang since the main thread is still live and the event loop is running.  But no events are processed - keyboard and mouse input seem completely ignored (although mouse cursor does change on resize bars).  I have to kill Eclipse and restart.  This is reproducible, but I'm not sure If I can create a test case since I have a complex project structure.

!ENTRY org.eclipse.ui 4 0 2010-08-02 11:15:49.231
!MESSAGE "Content Assist" did not complete normally.  Please see the log for more information.
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: -1
	at org.eclipse.jdt.core.compiler.CharOperation.indexOf(CharOperation.java:2126)
	at org.eclipse.jdt.core.compiler.CharOperation.indexOf(CharOperation.java:2063)
	at org.eclipse.jdt.internal.core.JavadocContents.computeChildrenSections(JavadocContents.java:213)
	at org.eclipse.jdt.internal.core.JavadocContents.computeMethodRange(JavadocContents.java:300)
	at org.eclipse.jdt.internal.core.JavadocContents.getMethodDoc(JavadocContents.java:126)
	at org.eclipse.jdt.internal.core.BinaryMethod.getParameterNames(BinaryMethod.java:254)
	at org.eclipse.jdt.internal.codeassist.InternalCompletionProposal.findMethodParameterNames(InternalCompletionProposal.java:317)
	at org.eclipse.jdt.internal.codeassist.InternalCompletionProposal.findParameterNames(InternalCompletionProposal.java:1416)
	at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.appendUnboundedParameterList(CompletionProposalLabelProvider.java:112)
	at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.createMethodProposalLabel(CompletionProposalLabelProvider.java:271)
	at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.createStyledLabel(CompletionProposalLabelProvider.java:561)
	at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.computeDisplayString(LazyJavaCompletionProposal.java:247)
	at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getStyledDisplayString(LazyJavaCompletionProposal.java:226)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.handleSetData(CompletionProposalPopup.java:829)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$24(CompletionProposalPopup.java:819)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$3.handleEvent(CompletionProposalPopup.java:583)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Table.checkData(Table.java:286)
	at org.eclipse.swt.widgets.Table.cellDataProc(Table.java:223)
	at org.eclipse.swt.widgets.Display.cellDataProc(Display.java:747)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8163)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1239)
	at org.eclipse.swt.internal.gtk.OS._gdk_window_process_updates(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gdk_window_process_updates(OS.java:5340)
	at org.eclipse.swt.widgets.Control.update(Control.java:4753)
	at org.eclipse.swt.widgets.Shell.setVisible(Shell.java:2002)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.displayProposals(CompletionProposalPopup.java:1194)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$23(CompletionProposalPopup.java:1159)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:500)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482)
	at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1660)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:182)
	at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
	at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1525)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1257)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1294)
	at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:730)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:2839)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4794)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4372)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8163)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1239)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2224)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3169)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
        ...
Comment 7 Dani Megert CLA 2010-08-03 01:50:49 EDT
> This
>is reproducible, but I'm not sure If I can create a test case 
A test case would be great!
Comment 8 Ayushman Jain CLA 2010-08-03 02:29:20 EDT
In all these cases, it seems like we're trying to pull the javadoc contents off of the internet and are unable to do so because of some reason. Though I doubt that an AIOOB is responsible for hanging the workbench. It'll at best not show content assist. Will, a test will be great help in this one.
Comment 9 Olivier Thomann CLA 2010-08-04 17:30:00 EDT
Created attachment 175893 [details]
Proposed fix

I think the problem comes from the first lastIndex value being -1 and that there is no protection against a start index being lower than zero in the CharOperation.indexOf(..) call.
Ayushman, please try to get a regression test for this case.
Comment 10 Ayushman Jain CLA 2010-08-05 10:31:18 EDT
Created attachment 175946 [details]
fix + test

I think the problem occurs when we dont get a properly formed javadoc from the internet, maybe because either the server modifies it, or because the connection breaks. The AIOOBE occurs while searching for the pattern "<!-- =" in the javadoc obtained. If this is not present, lastIndex will become -1 and the next call to CharOperation.indexOf(..) will cause AIOOBE.

In the added test, I've used a javadoc which doesnt have the <!-- =  pattern. Hence without the patch an AIOOBE is thrown, and with the patch we dont find a valid javadoc format, so we throw a JavaModelException. The test captures this. Note that I have removed X.java and Y.java from the src folder in AttachedJavadocProject since we dont reference them anywhere, but we reference the binaries from the test6.jar in AttachedJavadocProject>lib.

Will / Jan, can you please test the patch and check if you still get the bug? Thanks.
Comment 11 Jan CLA 2010-08-05 15:10:26 EDT
(In reply to comment #10)
> Will / Jan, can you please test the patch and check if you still get the bug?
> Thanks.

Where do I have to apply the patch to test it?
Comment 12 Olivier Thomann CLA 2010-08-05 16:14:47 EDT
Ayushman, please release for 3.7M2.
I will attach a new regression test for CharOperationTest suite.
Comment 13 Olivier Thomann CLA 2010-08-05 16:15:35 EDT
Created attachment 175979 [details]
Regression test for the change in CharOperation
Comment 14 Olivier Thomann CLA 2010-08-05 16:17:26 EDT
+1 for backporting to 3.6.1 as the consequences of this bug are pretty bad.
I already reviewed the patch.
Ayuhsman, just request a review and I'll set it to +1.
Comment 15 Srikanth Sankaran CLA 2010-08-09 02:00:21 EDT
Patch looks good. Ayush, please release for 3.6.1.
Comment 16 Ayushman Jain CLA 2010-08-09 05:47:52 EDT
Created attachment 176142 [details]
cumulative patch
Comment 17 Ayushman Jain CLA 2010-08-09 05:50:20 EDT
(In reply to comment #16)
> Created an attachment (id=176142) [details]
> cumulative patch

Released in HEAD for 3.7M2
Released in R3_6_maintenance for 3.6.1

Added tests AttachedJavadocTests#testBug320167(), 
CharOperationTest#test008()... 009()
Comment 18 Ayushman Jain CLA 2010-08-09 05:51:39 EDT
(In reply to comment #11)
> (In reply to comment #10)
> > Will / Jan, can you please test the patch and check if you still get the bug?
> > Thanks.
> 
> Where do I have to apply the patch to test it?

You can use the next I-build and test the patch. Do let us know if you run into this issue again.
Comment 19 Jan CLA 2010-08-10 08:53:50 EDT
Ok, I tested it once again with the nightly build "N20100809-2000" and the problem itself is fixed - content assist seems to work.

Nevertheless, I get some error log entries though, when trying to view details of the Javadoc.

I added the .log again, maybe, you are able to fix this problem, too.
Comment 20 Jan CLA 2010-08-10 08:54:46 EDT
Created attachment 176229 [details]
Logfile
Comment 21 Ayushman Jain CLA 2010-08-10 09:04:57 EDT
(In reply to comment #20)
> Created an attachment (id=176229) [details]
> Logfile

Thanks a lot for testing the fix.
The errors that you get in the log file are expected - JavaModelException being thrown because the javadoc is not in the format that we're expecting because of reasons such as those in comment 10. It maybe because of your ISP, which as you said - blocks some ports, or it may be because of an interrupted data transfer. These cases are out of our control, and the best we can do is throw a JavaModelException.
Comment 22 Dani Megert CLA 2010-08-10 10:24:51 EDT
Jan, where do you fetch your Javadoc from? Would you be able to provide us the link to it and also which JRE you are using?
Comment 23 Jan CLA 2010-08-10 10:49:57 EDT
These exceptions are thrown when trying to access the Javadoc for the standard Java-functions, so it should be the default value there...
Comment 24 Jan CLA 2010-08-10 10:52:36 EDT
oh, and I use the JRE version 6 Update 20
Comment 25 Dani Megert CLA 2010-08-10 10:53:02 EDT
Yeah "should". It should also work and not throw exceptions ;-)

Can you just go to the project, open the properties of the rt.jar and check what's the value of the Javadoc location path.
Comment 26 Jan CLA 2010-08-10 11:03:06 EDT
It is
http://java.sun.com/javase/6/docs/api/
;)
Comment 27 Dani Megert CLA 2010-08-10 11:10:32 EDT
(In reply to comment #26)
> It is
> http://java.sun.com/javase/6/docs/api/
> ;)
Sounds good. 

And the attached source field is empty, right?

Would you be able to attach a small test project that reproduces the problem? If we cannot reproduce it then, then I suspect that your firewall mangles the Javadoc.
Comment 28 Jan CLA 2010-08-10 11:12:35 EDT
Btw. maybe this is a hint: 
In my browser (Firefox), I need to have a plugin installed, which modifies the headers ("Modify Headers") to turn off image compression which is enabled by default by my ISP. 

Therefore I have to add in this plugin "Cache-Control" = "no-cache" and "Pragma" = "no-cache"
Comment 29 Jan CLA 2010-08-10 11:14:48 EDT
Yes, the field is empty,

And if I connect via VPN with my university the problem does not exist, either.

So it must be a problem with my ISP...
Comment 30 Dani Megert CLA 2010-08-10 11:37:57 EDT
>So it must be a problem with my ISP...
You should report the bug there.
Comment 31 Srikanth Sankaran CLA 2010-08-26 03:12:47 EDT
Verified by reporter using build N20100809-2000.
Comment 32 Srikanth Sankaran CLA 2010-09-14 05:10:37 EDT
using build N20100809-2000.
Comment 33 Ayushman Jain CLA 2011-06-30 13:36:23 EDT
*** Bug 350854 has been marked as a duplicate of this bug. ***