You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ExecutorLibrarySourceProvider uses this code to search for libraries to load at runtime. @Override public InputStream getLibrarySource(VersionedIdentifier versionedIdentifier) { Path path = Paths.get("src/main/resources").toAbsolutePath(); File source = new File(path.resolve(versionedIdentifier.getId() + "-" + versionedIdentifier.getVersion() + ".cql").toString());
The Paths base directory is FileSystem-dependent however, and doesn't translate over well. Deploying the war to tomcat, for example, breaks the library loading.
The Paths documentation itself provides a proposed solution
The Path is obtained by invoking the getPath method of the default FileSystem. Note that while this method is very convenient, using it will imply an assumed reference to the default FileSystem and limit the utility of the calling code. Hence it should not be used in library code intended for flexible reuse. A more flexible alternative is to use an existing Path instance as an anchor, such as:
ExecutorLibrarySourceProvider uses this code to search for libraries to load at runtime.
@Override public InputStream getLibrarySource(VersionedIdentifier versionedIdentifier) { Path path = Paths.get("src/main/resources").toAbsolutePath(); File source = new File(path.resolve(versionedIdentifier.getId() + "-" + versionedIdentifier.getVersion() + ".cql").toString());
try { return new FileInputStream(source); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Cannot find library source " + versionedIdentifier.getId()); } }
The Paths base directory is FileSystem-dependent however, and doesn't translate over well. Deploying the war to tomcat, for example, breaks the library loading.
The Paths documentation itself provides a proposed solution
Path dir = ... Path path = dir.resolve("file");
Paths Documentation Here
The text was updated successfully, but these errors were encountered: