zalando / intellij-swagger

A plugin to help you easily edit Swagger and OpenAPI specification files inside IntelliJ IDEA
https://plugins.jetbrains.com/plugin/8347
MIT License
1.17k stars 74 forks source link

Plugin fails on non-swagger YAML files #293

Open middlewareman opened 4 years ago

middlewareman commented 4 years ago

This has caused failure to save YAML files.


Error while indexing /Users/anny/Xyz/MyIdeaProject/Something/NotOpenAPIorSwagger.yaml
To reindex this file IDEA has to be restarted

java.lang.ClassCastException: class com.intellij.openapi.file.exclude.EnforcedPlainTextFileTypeFactory$2 cannot be cast to class com.intellij.openapi.fileTypes.LanguageFileType (com.intellij.openapi.file.exclude.EnforcedPlainTextFileTypeFactory$2 and com.intellij.openapi.fileTypes.LanguageFileType are in unnamed module of loader com.intellij.util.lang.UrlClassLoader @4566e5bd)
    at com.intellij.util.indexing.FileContentImpl.createFileFromText(FileContentImpl.java:138)
    at com.intellij.util.indexing.FileContentImpl.getFileFromText(FileContentImpl.java:106)
    at com.intellij.util.indexing.FileContentImpl.getPsiFileForPsiDependentIndex(FileContentImpl.java:274)
    at com.intellij.util.indexing.FileContentImpl.getPsiFile(FileContentImpl.java:94)
    at org.zalando.intellij.swagger.index.SpecIndexer.map(SpecIndexer.java:50)
    at org.zalando.intellij.swagger.index.SpecIndexer.map(SpecIndexer.java:25)
    at com.intellij.util.indexing.impl.MapReduceIndex.mapInput(MapReduceIndex.java:312)
    at com.intellij.util.indexing.VfsAwareMapReduceIndex.mapInput(VfsAwareMapReduceIndex.java:109)
    at com.intellij.util.indexing.impl.MapReduceIndex.calculateUpdateData(MapReduceIndex.java:268)
    at com.intellij.util.indexing.impl.MapReduceIndex.update(MapReduceIndex.java:250)
    at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1680)
    at com.intellij.util.indexing.FileBasedIndexImpl.lambda$doIndexFileContent$28(FileBasedIndexImpl.java:1605)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:656)
    at com.intellij.util.indexing.FileBasedIndexImpl.doIndexFileContent(FileBasedIndexImpl.java:1564)
    at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1550)
    at com.intellij.util.indexing.UnindexedFilesUpdater.lambda$indexFiles$0(UnindexedFilesUpdater.java:109)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.lambda$run$0(CacheUpdateRunner.java:219)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1106)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.lambda$run$1(CacheUpdateRunner.java:235)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
    at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:232)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)```