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

XQuery import statement fails in current development code, when run from the file system #1217

Closed
rvdb opened this issue Jan 10, 2017 · 7 comments

Comments

@rvdb
Copy link
Contributor

rvdb commented Jan 10, 2017

In eXist-3.0RC2 and the latest nightly build (d555767), XQuery import statements fail when executed from the file system.

Given following main XQuery file main.xq:

xquery version "3.0";
import module namespace x="x" at "imported.xq";
x:echo("main query")

...and following imported XQuery file imported.xq:

xquery version "3.0";
module namespace x="x";
declare function x:echo($string) {
  let $output := "imported query"
  return string-join(($string, $output), ' -- ')
};

When both files are stored in ${exist.home}/webapps/test-import, execution of the main XQuery file at http://localhost:8080/exist/test-import/main.xq fails with following error:

Illegal char <:> at index 4: file:///F:/devtools/eXist/eXist-nightly/webapp/test-import/imported.xq

This worked as expected in eXist-3.0RC1 and earlier. Yet, when the files are stored in and run from the db, the XQuery works as expected without errors.

I'll include the files in this file: test-import.zip

@wolfgangmm
Copy link
Member

I stumbled across this as well and just started debugging. The issue somehow seems limited to windows.

@dizzzz
Copy link
Member

dizzzz commented Jan 10, 2017

related to #1041 ?

@wolfgangmm
Copy link
Member

wolfgangmm commented Jan 10, 2017

@dizzzz yes, both issues were caused by switching to Paths.get in SourceFactory.getSource (38dff53). The reason why this went unnoticed for so long probably is because the issue will only pop up on windows and none of us runs the test suite on windows. See SourceFactoryTest for the corresponding tests, which do pass on mac/linux.

@dizzzz
Copy link
Member

dizzzz commented Jan 10, 2017

@wolfgangmm hmmmmmm interesting. and annoying...

@adamretter
Copy link
Member

@wolfgangmm There is nothing that you can't do with Path that we did with File. Perhaps I made a mistake when I modified the code, do you have an example file path for a test case that I can use to identify and fix the issue?

@wolfgangmm
Copy link
Member

I already fixed the issue and am running the test suite now. The main problem is that Paths.get may throw an InvalidPathException which needs to get caught so the code continues probing.

wolfgangmm added a commit to wolfgangmm/exist that referenced this issue Jan 12, 2017
…s because of InvalidPathException being thrown while proping locations. Closes eXist-db#1217 and eXist-db#1041
@rvdb
Copy link
Contributor Author

rvdb commented Jan 12, 2017

@wolfgangmm Thanks for the quick fix. This Windows user can confirm that XQuery imports of files on the file system are working now, as well as loading files from the file system with the doc() function (as reported in #1041).

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

No branches or pull requests

4 participants