Skip to content

Commit

Permalink
Fix ClassCastException
Browse files Browse the repository at this point in the history
Fix ClassCastException (not tested!).

See Stack Overflow question 78834435: https://stackoverflow.com/q/78834435/6505250

Stack trace (`eclipse.buildId=4.32.0.20240606-1231`):
```
java.lang.ClassCastException: class org.eclipse.jdt.internal.core.JavaNature cannot be cast to class org.eclipse.jdt.core.IJavaProject (org.eclipse.jdt.internal.core.JavaNature and org.eclipse.jdt.core.IJavaProject are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @529500a7)
    at org.hibernate.eclipse.console.wizards.NewConfigurationWizard.init(NewConfigurationWizard.java:325)
    at ...
```
  • Loading branch information
howlger authored Aug 5, 2024
1 parent 43bcf10 commit 2418fb4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public void init(IWorkbench workbench, IStructuredSelection selection) {
if (selection.getFirstElement() instanceof IProject){
try {
if (((IProject)selection.getFirstElement()).getNature(JavaCore.NATURE_ID) != null) {
jproj = (IJavaProject)((IProject)selection.getFirstElement()).getNature(JavaCore.NATURE_ID);
jproj = JavaCore.create((IProject)selection.getFirstElement());
}
} catch (CoreException e) {
HibernateConsolePlugin.getDefault().log(e);
Expand Down Expand Up @@ -362,4 +362,4 @@ public boolean canFinish() {
return super.canFinish();
}

}
}

0 comments on commit 2418fb4

Please sign in to comment.