gshakhn / idea-fitnesse

An IntelliJ plugin for Fitnesse.
12 stars 22 forks source link

Exception with IntelliJ 16 EAP #22

Closed stela closed 8 years ago

stela commented 8 years ago

Got this exception when loading a fitnesse project using IntelliJ 16 EAP. The filename reported changes occasionally (maybe the order they are processed is a bit random?). I didn't manage to trigger it using IntelliJ 15.

Error while indexing /Users/ ....  Sip010002A/content.txt
To reindex this file IDEA has to be restarted: Unexpected termination offset for lexer fitnesse.idea.lexer.FitnesseLexer@6afba13c
java.lang.IllegalStateException: Unexpected termination offset for lexer fitnesse.idea.lexer.FitnesseLexer@6afba13c
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.a(LexerEditorHighlighter.java:333)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.setText(LexerEditorHighlighter.java:302)
    at com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding$TokenSetTodoIndexer.map(PlatformIdTableBuilding.java:179)
    at com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding$TokenSetTodoIndexer.map(PlatformIdTableBuilding.java:156)
    at com.intellij.psi.impl.cache.impl.todo.TodoIndex$4.map(TodoIndex.java:108)
    at com.intellij.psi.impl.cache.impl.todo.TodoIndex$4.map(TodoIndex.java:100)
    at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
    at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
    at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
    at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
    at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
    at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
    at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

java.lang.IllegalStateException: Unexpected termination offset for lexer fitnesse.idea.lexer.FitnesseLexer@7b6e075d
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.a(LexerEditorHighlighter.java:333)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.setText(LexerEditorHighlighter.java:302)
    at com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding$TokenSetTodoIndexer.map(PlatformIdTableBuilding.java:179)
    at com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding$TokenSetTodoIndexer.map(PlatformIdTableBuilding.java:156)
    at com.intellij.psi.impl.cache.impl.todo.TodoIndex$4.map(TodoIndex.java:108)
    at com.intellij.psi.impl.cache.impl.todo.TodoIndex$4.map(TodoIndex.java:100)
    at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
    at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
    at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
    at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
    at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
    at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
    at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

java.lang.IllegalStateException: Unexpected termination offset for lexer fitnesse.idea.lexer.FitnesseLexer@3efd8918
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.a(LexerEditorHighlighter.java:333)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.setText(LexerEditorHighlighter.java:302)
    at com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding$TokenSetTodoIndexer.map(PlatformIdTableBuilding.java:179)
    at com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding$TokenSetTodoIndexer.map(PlatformIdTableBuilding.java:156)
    at com.intellij.psi.impl.cache.impl.todo.TodoIndex$4.map(TodoIndex.java:108)
    at com.intellij.psi.impl.cache.impl.todo.TodoIndex$4.map(TodoIndex.java:100)
    at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
    at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
    at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
    at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
    at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
    at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
    at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

java.lang.IllegalStateException: Unexpected termination offset for lexer fitnesse.idea.lexer.FitnesseLexer@3d841973
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.a(LexerEditorHighlighter.java:333)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.setText(LexerEditorHighlighter.java:302)
    at com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding$TokenSetTodoIndexer.map(PlatformIdTableBuilding.java:179)
    at com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding$TokenSetTodoIndexer.map(PlatformIdTableBuilding.java:156)
    at com.intellij.psi.impl.cache.impl.todo.TodoIndex$4.map(TodoIndex.java:108)
    at com.intellij.psi.impl.cache.impl.todo.TodoIndex$4.map(TodoIndex.java:100)
    at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
    at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
    at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
    at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
    at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
    at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
    at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
amolenaar commented 8 years ago

Thanks! I'll dig into it.

amolenaar commented 8 years ago

I fiddled a little with content.txt pages in IntelliJ IC 16 EAP (with the latest FitNesse plugin installed), but I can not reproduce the error so far.

Is it a specific page (or specific content) that caused the problem? Can you share your page content? Are there any actions I should perform to trigger this exception?

stela commented 8 years ago

Our fitnesse scripts are fairly complex with lots of includes and such, so not easy to make a minimal sample which reproduces it. It does look like it gets stuck on one or two scripts all the time, might well be due to contents and not by random ordering then if you can't easily reproduce it. It's for work so can't share the whole project.

amolenaar commented 8 years ago

The content parsing is my prime suspect. I'm using FitNesse's native parser to process the pages, so it may turn out that there is something going wrong there.

You can also send the page directly to me if you do not feel like posting the content here (gaphor@gmail.com).

stela commented 8 years ago

OK, could simply be that the page is broken syntactically without me realizing it... If so, wouldn't it be better to mark the broken parts of the page red, marking it with an error message and catching the exception?

amolenaar commented 8 years ago

If for some reason a part of the page is invalid, the parser should treat it as plain text. That's how the wiki parser does its rendering. More complex elements, such as !include statement, need to figure out their offset themselves, which might result in offset differences. IIRC the highlighter wants regions to be connected. In IJ 16, the parser might have become more picky.

amolenaar commented 8 years ago

Can I close this issue? I think version 1.4.4 has some improvement that should make those errors less likely.

stela commented 8 years ago

Looks like this issue is resolved with 1.4.4 :-)

I still got a lot of "java.lang.IllegalStateException: Unexpected termination offset for lexer fitnesse..." when opening the fitnesse project and selecting "File - Invalidate Caches/Restart" when using version 1.4.3. I updated the fitnesse plugin to version 1.4.4 and now the errors are gone, thanks.

(now though, all fitnesse scripts seem to claim "No fixture method found" or "No fixture class found", but it's an improvement at least)

amolenaar commented 8 years ago

Are your fixtures in Java? That's currently the only language the FitNesse plugin can deal with.

stela commented 8 years ago

Yes, they are all Java. They are included via the pom.xml from a separate project. IntelliJ itself can find open them from the Fitnesse project.

amolenaar commented 8 years ago

Indeed. The current search scope is limited to source, test and module dependencies. Libraries are not included in the search. Before I can broaden the scope to libraries, the plugin needs to handle import paths properly, so a lookup results in less false positives.

Having that said, would it make sense to join the FitNesse module with the fixtures? I think it would make sense to have high-level/businessy fixtures and (for example) drop scenario tables altogether. It greatly improves maintainability.