[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1085) Receiving FileNotFoundException when Openning Mapping File in a multiple-source-folder project
Thai (JIRA)
noreply at atlassian.com
Mon Nov 24 18:29:15 EST 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31804#action_31804 ]
Thai commented on HBX-1085:
---------------------------
To clarify, this issue is happening with HibernateTools-3.2.4.Beta1-R200810311334. And I suspect the same issue is happening with nightly build HibernateTools-3.2.4.CR1-N200811201326.zip (which was made before your changes in SVN).
If I have time, I will verify the issue again when a newer nightly build is made (which will contain your code changes).
> Receiving FileNotFoundException when Openning Mapping File in a multiple-source-folder project
> ----------------------------------------------------------------------------------------------
>
> Key: HBX-1085
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1085
> Project: Hibernate Tools
> Issue Type: Bug
> Components: consoleconfiguration
> Affects Versions: 3.2LATER
> Environment: Windows XP SP3
> JDK 1.6.0_01
> Eclipse 3.4.0 (Ganymede)
> HibernateTools plugin 3.2.4 nightly build (HibernateTools-3.2.4.200808270817-nightly)
> Reporter: Thai
> Attachments: bizservice.zip
>
>
> I received the following exception when Openning Mapping File from Hibernate perspective:
> java.io.FileNotFoundException: F:\projects\bizservice\src\main\filtered-resources\org\openbiz\bizservice\domain\User.hbm.xml (The system cannot find the path specified)
> at java.io.FileInputStream.open(Native Method)
> at java.io.FileInputStream.<init>(FileInputStream.java:106)
> at org.hibernate.eclipse.console.actions.OpenFileActionUtils.getDocument(OpenFileActionUtils.java:233)
> at org.hibernate.eclipse.console.actions.OpenFileActionUtils.rootClassInResource(OpenFileActionUtils.java:98)
> at org.hibernate.eclipse.console.actions.OpenFileActionUtils.elementInResource(OpenFileActionUtils.java:86)
> at org.hibernate.eclipse.console.actions.OpenFileActionUtils.getResource(OpenFileActionUtils.java:282)
> at org.hibernate.eclipse.console.actions.OpenMappingAction.run(OpenMappingAction.java:120)
> at org.hibernate.eclipse.console.actions.OpenMappingAction.run(OpenMappingAction.java:96)
> at org.hibernate.eclipse.console.actions.OpenMappingAction.run(OpenMappingAction.java:71)
> at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168)
> at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
> at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
> at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> I find out the root cause in the following class org.hibernate.eclipse.console.actions.OpenFileActionUtils (lines 273-282)
> for (int i = 0; i < packageFragmentRoots.length && resource == null; i++) {
> //search in source folders.
> if (packageFragmentRoots[i].getClass() == PackageFragmentRoot.class) {
> IPackageFragmentRoot packageFragmentRoot = packageFragmentRoots[i];
> IPath path = packageFragmentRoot.getPath().append(file.getValue());
> resource = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
> }
> }
> if (resource != null &&
> elementInResource(consoleConfiguration, resource, element)) return resource;
> The code assumes that if resource variable is not null, then the corresponding file exists at that location. In fact, when the file doesn't exist, the method org.eclipse.core.internal.resources.Container.getFile(..) might still return a not-null value (see http://mobius.inria.fr/eclipse-doc/org/eclipse/core/resources/IContainer.html#getFile(org.eclipse.core.runtime.IPath)). As a result, a not-null file path will be passed to OpenFileActionUtils.elementInResource(..), and a FileNotFoundException will be thrown.
> * Note that my project contains more than one source folder. This issue may not happen on one-source-folder project.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list