Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Another Error creating index #69

Open
ghost opened this issue May 20, 2015 · 7 comments
Open

Another Error creating index #69

ghost opened this issue May 20, 2015 · 7 comments

Comments

@ghost
Copy link

ghost commented May 20, 2015

Tried to index a project which only had Maven dependencies (with source download enabled)

Instasearch indexing, worked for a while indexing the maven dependency jars, then stopped.

I'm using STS version:
Version: 3.6.4.RELEASE
Build Id: 201503100339
Platform: Eclipse Luna SR1 (4.4.2)

JAVA version: Oracle windows 64 jdk1.7.0_25

The plugin log file had:

!ENTRY org.eclipse.m2e.logback.appender 4 0 2015-05-20 16:47:47.035
!MESSAGE Unable to update index for nexus|http://nexus.polarlake.com/nexus/content/groups/public/: http://nexus.polarlake.com/nexus/content/groups/public/.index/nexus-maven-repository-index.properties

!ENTRY it.unibz.instasearch 4 0 2015-05-20 16:50:49.615
!MESSAGE org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus
!STACK 0
java.lang.ClassCastException: org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus
at org.eclipse.jdt.internal.core.ClassFile.getBuffer(ClassFile.java:367)
at org.eclipse.jdt.internal.core.ClassFile.getSource(ClassFile.java:509)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT$ClassFileSourceStorage.(WorkspaceIndexerJDT.java:425)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT.indexClassFiles(WorkspaceIndexerJDT.java:193)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT.indexContainers(WorkspaceIndexerJDT.java:83)
at it.unibz.instasearch.indexing.WorkspaceIndexer.createIndex(WorkspaceIndexer.java:99)
at it.unibz.instasearch.jobs.IndexingJob.runInWorkspace(IndexingJob.java:44)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

!ENTRY it.unibz.instasearch 4 0 2015-05-20 16:53:23.346
!MESSAGE org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus
!STACK 0
java.lang.ClassCastException: org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus
at org.eclipse.jdt.internal.core.ClassFile.getBuffer(ClassFile.java:367)
at org.eclipse.jdt.internal.core.ClassFile.getSource(ClassFile.java:509)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT$ClassFileSourceStorage.(WorkspaceIndexerJDT.java:425)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT.indexClassFiles(WorkspaceIndexerJDT.java:193)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT.indexContainers(WorkspaceIndexerJDT.java:83)
at it.unibz.instasearch.indexing.WorkspaceIndexer.createIndex(WorkspaceIndexer.java:99)
at it.unibz.instasearch.jobs.IndexingJob.runInWorkspace(IndexingJob.java:44)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

@ajermakovics
Copy link
Owner

what's strange is that the exception comes from Eclipse's classes.
does re-indexing the workspace help at all?

@ghost
Copy link
Author

ghost commented May 21, 2015

Hi,

I tried again with the latest STS
Version: 3.6.4.RELEASE
Build Id: 201503100339
Platform: Eclipse Luna SR1 (4.4.2)

JAVA: ORacle 1.7.79 64bit

new workspace

instasearch:

after clicking on instsearch build index, I can see it working through the maven dependencies in the project. And this it stops.

I wonder if this jar is the issue?
http://grepcode.com/snapshot/repo1.maven.org/maven2/com.wordnik/swagger-core_2.9.1/1.2.0

For swagger-core_2.9.1-1.2.0.jar the swagger-core_2.9.1-1.2.0-sources.jar does not contain sources for all classes in the jar???

the workspace .log shows this:
!ENTRY it.unibz.instasearch 4 0 2015-05-21 09:31:21.360
!MESSAGE org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus
!STACK 0
java.lang.ClassCastException: org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus
at org.eclipse.jdt.internal.core.ClassFile.getBuffer(ClassFile.java:367)
at org.eclipse.jdt.internal.core.ClassFile.getSource(ClassFile.java:509)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT$ClassFileSourceStorage.(WorkspaceIndexerJDT.java:425)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT.indexClassFiles(WorkspaceIndexerJDT.java:193)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT.indexContainers(WorkspaceIndexerJDT.java:83)
at it.unibz.instasearch.indexing.WorkspaceIndexer.createIndex(WorkspaceIndexer.java:99)
at it.unibz.instasearch.jobs.IndexingJob.runInWorkspace(IndexingJob.java:44)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

@ghost
Copy link
Author

ghost commented May 21, 2015

So, if I hack the pom and add an exclusion for swagger-core_2.9.1, the indexing gets further.

Next problematic jar is http://grepcode.com/snapshot/repo1.maven.org/maven2/org.parboiled/parboiled-scala_2.10/1.1.6

interesting enough, when I use STS to look at the source of org.parboiled.scala.package.class
STS shows and error dialog: "An error has occurred. See error log for more details.
org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus"

the log file has a familiar classcastexecption

java.lang.ClassCastException: org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus
at org.eclipse.jdt.internal.core.ClassFile.getBuffer(ClassFile.java:367)
at org.eclipse.jdt.internal.core.ClassFile.getSourceRange(ClassFile.java:519)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getEditorID(EditorUtility.java:421)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:179)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:268)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:233)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376)
at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:538)
at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:853)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:850)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1142)

@ghost
Copy link
Author

ghost commented May 21, 2015

Any chance the plugin could be altered to avoid this stacktrace:

java.lang.ClassCastException: org.eclipse.core.runtime.Status cannot be cast to org.eclipse.jdt.core.IJavaModelStatus
at org.eclipse.jdt.internal.core.ClassFile.getBuffer(ClassFile.java:367)
at org.eclipse.jdt.internal.core.ClassFile.getSource(ClassFile.java:509)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT$ClassFileSourceStorage.(WorkspaceIndexerJDT.java:425)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT.indexClassFiles(WorkspaceIndexerJDT.java:193)
at it.unibz.instasearch.indexing.WorkspaceIndexerJDT.indexContainers(WorkspaceIndexerJDT.java:83)
at it.unibz.instasearch.indexing.WorkspaceIndexer.createIndex(WorkspaceIndexer.java:99)
at it.unibz.instasearch.jobs.IndexingJob.runInWorkspace(IndexingJob.java:44)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Perhaps a try/catch around
WorkspaceIndexerJDT.indexClassFiles(WorkspaceIndexerJDT.java:193)

I can't seem to build the plugin myself due to this error
"[ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.19.0:validate-version (default-validate-version) on project it.unibz.instasearch: OSGi version 1.5.6 in META-INF/MANIFEST.MF does not match Maven version 1.5.7 in
pom.xml -> [Help 1]"

@ajermakovics
Copy link
Owner

Probably putting these lines in try-catch block:
https://github.com/ajermakovics/eclipse-instasearch/blob/master/instasearch/src/it/unibz/instasearch/indexing/WorkspaceIndexerJDT.java#L193-L196

would skip the files in error. Building InstaSearch from source is easy with Maven if you're up for a little challange:).

@ghost
Copy link
Author

ghost commented May 21, 2015

Sure, happy to submit a fix.

I am having an issue building with maven at the mo:
any suggestions?

"[ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.19.0:validate-version (default-validate-version) on project it.unibz.instasearch: OSGi version 1.5.6 in META-INF/MANIFEST.MF does not match Maven version 1.5.7 in
pom.xml -> [Help 1]"

@ajermakovics
Copy link
Owner

Uh, my bad. pushed a fix 09e1517

ajermakovics added a commit that referenced this issue May 22, 2015
Issue #69. Avoid Ex where Eclipse has trouble loading a source file.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant