@@ -75,7 +75,7 @@ public class SourceFactory {
75
75
* but the calling user does not have permission to access it.
76
76
* @throws IOException if a general I/O error occurs whilst accessing the resource.
77
77
*/
78
- public static @ Nullable Source getSource (final DBBroker broker , final String contextPath , final String location , final boolean checkXQEncoding ) throws IOException , PermissionDeniedException {
78
+ public static @ Nullable Source getSource (final DBBroker broker , @ Nullable final String contextPath , final String location , final boolean checkXQEncoding ) throws IOException , PermissionDeniedException {
79
79
Source source = null ;
80
80
81
81
/* resource: */
@@ -212,12 +212,18 @@ private static Source getSource_fromClasspath(final String contextPath, final St
212
212
*
213
213
* @return the source, or null if there is no such resource in the db indicated by {@code path}.
214
214
*/
215
- private static @ Nullable Source getSource_fromFile (final String contextPath , final String location , final boolean checkXQEncoding ) {
215
+ private static @ Nullable Source getSource_fromFile (@ Nullable final String contextPath , final String location , final boolean checkXQEncoding ) {
216
216
String locationPath = location .replaceAll ("^(file:)?/*(.*)$" , "$2" );
217
217
218
218
Source source = null ;
219
219
try {
220
- final Path p = Paths .get (contextPath , locationPath );
220
+ final Path p ;
221
+ if (contextPath == null ) {
222
+ p = Paths .get (locationPath );
223
+ } else {
224
+ p = Paths .get (contextPath , locationPath );
225
+ }
226
+
221
227
if (Files .isReadable (p )) {
222
228
locationPath = p .toUri ().toASCIIString ();
223
229
source = new FileSource (p , checkXQEncoding );
0 commit comments