Closed angelozerr closed 9 years ago
@angelozerr I won't be able to help with this fix, however, it should be relatively easy to achieve such behavior. An idea is to calculate a list of files not present in the scriptpath, but present in indexedFiles set in ensureSynchronized() method.
I'm seeing these errors:
java.lang.NullPointerException
at tern.resources.TernFileSynchronizer.fillSyncedFileNames(TernFileSynchronizer.java:174)
at tern.resources.TernProject.synchronize(TernProject.java:445)
at tern.resources.TernProject.request(TernProject.java:472)
at org.eclipse.angularjs.ui.contentassist.HTMLAngularTagsCompletionProposalComputer.populateAngularProposals(HTMLAngularTagsCompletionProposalComputer.java:349)
at org.eclipse.angularjs.ui.contentassist.HTMLAngularTagsCompletionProposalComputer.computeCompletionProposals(HTMLAngularTagsCompletionProposalComputer.java:444)
at org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLCompletionProposalComputer.computeCompletionProposals(AbstractXMLCompletionProposalComputer.java:169)
at org.eclipse.wst.sse.ui.internal.contentassist.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:284)
at org.eclipse.wst.sse.ui.internal.contentassist.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:290)
at org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor.collectProposals(StructuredContentAssistProcessor.java:484)
at org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor.computeCompletionProposals(StructuredContentAssistProcessor.jav
and
java.lang.NullPointerException
at tern.resources.TernFileSynchronizer.fillSyncedFileNames(TernFileSynchronizer.java:174)
at tern.resources.TernProject.synchronize(TernProject.java:445)
at tern.resources.TernProject.request(TernProject.java:506)
at org.eclipse.angularjs.internal.ui.taginfo.HTMLAngularTagInfoHoverProcessor.computeHelp(HTMLAngularTagInfoHoverProcessor.java:277)
at org.eclipse.angularjs.internal.ui.taginfo.HTMLAngularTagInfoHoverProces
Is this related to this problem?
@gamerson this is a bug. I've missed NPE check over there. I will fix it. It would be cool, if you can share a project, which exposes this issue with some steps, so that I can tell why "files" is null and whether it is valid or not.
@angelozerr should this be filed as a separate issue?
If this isn't related to synch file issues then yeah I think it should be a new bug. So what I did when this happened was just restart Eclipse and everything started working again. I can show you the projects if that helps but I don't know how to reproduce exactly. However, I believe it started happening when I renamed some of the scripts in the /src/main/webapp/js/** folder. That is why I pasted this on this issue because of the mention of losing track of files when they changed names. I think its somehow related to that.
The project that I'm working with is what I've shared before, an angularjs portlet project, actually two of them here: https://github.com/gamerson/angular-portlet/tree/ide https://github.com/gamerson/liferay-projects/tree/master/todo
If i can reproduce again I'll try to narrow things down.
On Thu, Oct 30, 2014 at 4:48 PM, Piotr Tomiak notifications@github.com wrote:
@gamerson https://github.com/gamerson this is a bug. I've missed NPE check over there. I will fix it. It would be cool, if you can share a project, which exposes this issue with some steps, so that I can tell why "files" is null and whether it is valid or not.
@angelozerr https://github.com/angelozerr should this be filed as a separate issue?
— Reply to this email directly or view it on GitHub https://github.com/angelozerr/tern.java/issues/157#issuecomment-61060453 .
Greg Amerson Liferay Developer Tools Liferay, Inc. www.liferay.com
@angelozerr should this be filed as a separate issue?
Yes please create a new issue, this issue is about synchronize eclipse files with tern when JS files :
I think it's hard to reproduce the problem because I suppose it's a problem with access thread. When I see stacktrace, I suppose that there is 2 threads which tries to call request the first time :
When I see TernProject#synchronize https://github.com/angelozerr/tern.java/blob/master/core/tern.core/src/tern/resources/TernProject.java#L423 it call :
Those 2 calls are not synchronized, perhaps it's a problem? Perhaps the fix is to set https://github.com/angelozerr/tern.java/blob/master/core/tern.core/src/tern/resources/TernProject.java#L423 as synchronized? Is it good for performance?
Lately I've been getting a lot of these exceptions:
java.io.IOException: Cannot save .tern-project
at tern.eclipse.ide.internal.core.resources.IDETernProject.save(IDETernProject.java:307)
at tern.resources.TernProject.saveIfNeeded(TernProject.java:333)
at tern.eclipse.ide.internal.core.resources.IDETernProject.addExternalScriptPath(IDETernProject.java:418)
at tern.eclipse.ide.jsdt.internal.JSDTClassPathManager.synchTernScriptPaths(JSDTClassPathManager.java:250)
at tern.eclipse.ide.jsdt.internal.JSDTClassPathManager.handleEvent(JSDTClassPathManager.java:207)
at tern.eclipse.ide.internal.core.TernProjectLifecycleManager.fireTernProjectLifeCycleListenerChanged(TernProjectLifecycleManager.java:66)
at tern.eclipse.ide.internal.core.resources.IDETernProject.load(IDETernProject.java:188)
at tern.eclipse.ide.internal.core.resources.IDETernFileSynchronizer.visit(IDETernFileSynchronizer.java:102)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:69)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:80)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:80)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:49)
at tern.eclipse.ide.internal.core.resources.IDETernFileSynchronizer.resourceChanged(IDETernFileSynchronizer.java:71)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:378)
at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1498)
at org.eclipse.core.internal.resources.File.setContents(File.java:366)
at org.eclipse.core.internal.resources.File.setContents(File.java:465)
at tern.eclipse.ide.internal.core.resources.IDETernProject.save(IDETernProject.java:304)
at tern.resources.TernProject.saveIfNeeded(TernProject.java:333)
at tern.eclipse.ide.internal.core.resources.IDETernProject.initAdaptedNaturesInfos(IDETernProject.java:250)
at tern.eclipse.ide.internal.core.resources.IDETernProject.load(IDETernProject.java:185)
at tern.eclipse.ide.internal.core.resources.IDEResourcesManager.getTernProject(IDEResourcesManager.java:65)
at tern.internal.resources.InternalTernResourcesManager.getTernProject(InternalTernResourcesManager.java:46)
at tern.TernResourcesManager.getTernProject(TernResourcesManager.java:33)
at tern.eclipse.ide.core.TernCorePlugin.getTernProject(TernCorePlugin.java:148)
at tern.eclipse.ide.internal.ui.validation.JavaDirtyRegionProcessor.<init>(JavaDirtyRegionProcessor.java:48)
at tern.eclipse.ide.internal.ui.validation.JavaEditorTracker.editorOpened(JavaEditorTracker.java:176)
at tern.eclipse.ide.internal.ui.validation.JavaEditorTracker.pageOpened(JavaEditorTracker.java:123)
at tern.eclipse.ide.internal.ui.validation.JavaEditorTracker.windowOpened(JavaEditorTracker.java:95)
at tern.eclipse.ide.internal.ui.validation.JavaEditorTracker.init(JavaEditorTracker.java:65)
at tern.eclipse.ide.internal.ui.validation.JavaEditorTracker.<init>(JavaEditorTracker.java:49)
at tern.eclipse.ide.internal.ui.validation.JavaEditorTracker.getInstance(JavaEditorTracker.java:54)
at tern.eclipse.ide.internal.ui.TernIDEStartup$1.run(TernIDEStartup.java:34)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3774)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3412)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:384)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:239)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: org.eclipse.core.internal.resources.ResourceException: The resource tree is locked for modifications.
at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:116)
at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2251)
at org.eclipse.core.internal.resources.File.setContents(File.java:356)
at org.eclipse.core.internal.resources.File.setContents(File.java:465)
at tern.eclipse.ide.internal.core.resources.IDETernProject.save(IDETernProject.java:304)
... 62 more
Looks like two threads trying to write the file at the same time?
Lately I've been getting a lot of these exceptions:
java.io.IOException: Cannot save .tern-project
at tern.eclipse.ide.internal.core.resources.IDETernProject.save(IDETernProject.java:307)
at tern.resources.TernProject.saveIfNeeded(TernProject.java:333)
at
@gamerson please create a new issue for that, it's an another problem which comes from since I observe .tern-project changes (ex : change it at hand) to reload the tern project.
When a JS file is moved or deleted, tern server is not refreshed with thos changes.
@piotrtomiak if you have time to see it, it should be very cool, otherwise I will do it.