Skip to content

Commit 9cb8962

Browse files
committed
[bugfix] throw error in repo:get-resource if file does not exist
1 parent c58d04e commit 9cb8962

File tree

1 file changed

+4
-4
lines changed
  • extensions/modules/expathrepo/src/main/java/org/exist/xquery/modules/expathrepo

1 file changed

+4
-4
lines changed

extensions/modules/expathrepo/src/main/java/org/exist/xquery/modules/expathrepo/GetResource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public class GetResource extends BasicFunction {
5050
},
5151
new FunctionReturnSequenceType(Type.BASE64_BINARY, Cardinality.ZERO_OR_ONE,
5252
"<status result=\"ok\"/> if deployment was ok. Throws an error otherwise."));
53-
53+
5454
public GetResource(XQueryContext context) {
5555
super(context, signature);
5656
}
57-
57+
5858
@Override
5959
public Sequence eval(Sequence[] args, Sequence contextSequence)
6060
throws XPathException {
@@ -71,8 +71,8 @@ public Sequence eval(Sequence[] args, Sequence contextSequence)
7171
// FileSystemResolver already returns an input stream
7272
StreamSource source = (StreamSource) pkg.getResolver().resolveResource(path);
7373
return Base64BinaryDocument.getInstance(context, source.getInputStream());
74-
} catch (Storage.NotExistException ex) {
75-
// nothing
74+
} catch (Storage.NotExistException e) {
75+
throw new XPathException(ErrorCodes.FODC0002, "Resource " + path + " does not exist.", e);
7676
}
7777
}
7878
}

0 commit comments

Comments
 (0)