Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute full path as modelURI causes error #72

Closed
ndoschek opened this issue Feb 9, 2021 · 4 comments · Fixed by #73
Closed

Absolute full path as modelURI causes error #72

ndoschek opened this issue Feb 9, 2021 · 4 comments · Fixed by #73

Comments

@ndoschek
Copy link
Contributor

ndoschek commented Feb 9, 2021

Using an absolute full path like file:///home/destination/file.coffee leads to the following error:

9765 [qtp1598898814-26] DEBUG DefaultModelResourceManager  - Could not load resource with URI: file:///home/nina/Clients/OpenSource/emfcloud/emfcloud-modelserver/examples/org.eclipse.emfcloud.modelserver.example/.temp/workspace/SuperBrewer3000.coffee
[qtp1598898814-26] WARN io.javalin.Javalin - Uncaught exception
java.lang.NullPointerException
	at org.eclipse.emfcloud.modelserver.emf.common.DefaultModelResourceManager.removeResource(DefaultModelResourceManager.java:194)
	at org.eclipse.emfcloud.modelserver.emf.common.DefaultModelResourceManager.removeResourceSafe(DefaultModelResourceManager.java:186)
	at org.eclipse.emfcloud.modelserver.emf.common.DefaultModelResourceManager.loadResource(DefaultModelResourceManager.java:178)
	at org.eclipse.emfcloud.modelserver.emf.common.DefaultModelResourceManager.loadResource(DefaultModelResourceManager.java:165)
	at org.eclipse.emfcloud.modelserver.emf.common.ModelRepository.getModel(ModelRepository.java:59)
	at org.eclipse.emfcloud.modelserver.emf.common.ModelController.getOne(ModelController.java:106)
...
martin-fleck-at pushed a commit that referenced this issue Feb 9, 2021
- Fixes #71: Process incoming requests after server configuration is completed
  - Make ModelServerRouting configurable via DI
- Enhance logging of request routing
- Change some log lines to debug level
- Change default debug level to DEBUG
- Fixes #72: Absolute full path as modelURI causes error

Signed-off-by: Nina Doschek <ndoschek@eclipsesource.com>
@vhemery
Copy link
Contributor

vhemery commented Feb 17, 2021

@ndoschek Sorry, but it looks like this issue fixed absolute path for linux but broke it for windows.
In org.eclipse.emfcloud.modelserver.emf.common.ModelServerRouting.adaptModelUri(String), uri.toString() used to work well for me. But now, URI.createFileURI(uri.path()).toString(); gets rid of my device part of the path and gives me 404 errors. ( b1eb06f )

Here is what my uri looks like and the various values of interest.
image
Maybe using devicePath or toFileString method ? Though I guess the issue would still be here because I have a blank authority...

I'm not sure what's the best fix here working for both linux and windows. Could you try and adapt this method to work with both URI patterns ?
Thanks in advance.

@vhemery
Copy link
Contributor

vhemery commented Feb 17, 2021

After second though, I'm also concerned with what may happen to non-file URIs... like a platform:/resource/ or cdo:// URI (which is absolute).
Maybe it would be best to delegate this adaptModelUri method to the ModelResourceManager, so that we can adapt it taking all the known supported schemes instead of this private scope-limited method...
I may try a PR on this, but I would need someone with a linux to review it so that the adaptModelUri method works as expected on both linux and windows.

@vhemery
Copy link
Contributor

vhemery commented Feb 17, 2021

Please review #80 to ensure it is compatible with the linux use case.

@ndoschek
Copy link
Contributor Author

Thank you very much for raising the issue, I'm sorry I didn't think of the windows use case here.
Also a big thanks for providing a solution so quickly, I will look right into it!

ndoschek pushed a commit that referenced this issue Feb 17, 2021
Fixing absolute file URI with device for windows.
Moving the adaptModelUri method to ModelResourceManager.

Signed-off-by: vhemery <vincent.hemery@csgroup.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants