Skip to content

Commit be14c87

Browse files
committed
Invalid subjects and properties are not variables.
1 parent 235eead commit be14c87

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/org/linkeddatafragments/servlet/BasicLdfServlet.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private int parseAsInteger(String value) {
166166
*/
167167
private Resource parseAsResource(String value) {
168168
final RDFNode subject = parseAsNode(value);
169-
return subject instanceof Resource ? (Resource)subject : null;
169+
return subject == null || subject instanceof Resource ? (Resource)subject : INVALID_URI;
170170
}
171171

172172
/**
@@ -178,11 +178,9 @@ private Property parseAsProperty(String value) {
178178
final RDFNode predicateNode = parseAsNode(value);
179179
if (predicateNode instanceof Resource) {
180180
try { return ResourceFactory.createProperty(((Resource)predicateNode).getURI()); }
181-
catch (InvalidPropertyURIException ex) {
182-
return ResourceFactory.createProperty("urn:invalid-predicate-uri");
183-
}
181+
catch (InvalidPropertyURIException ex) { return INVALID_URI; }
184182
}
185-
return null;
183+
return predicateNode == null ? null : INVALID_URI;
186184
}
187185

188186
/**

src/org/linkeddatafragments/util/CommonResources.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public class CommonResources {
3131
public final static Property HYDRA_NEXTPAGE = createProperty(HYDRA + "nextPage");
3232
public final static Property HYDRA_PREVIOUSPAGE = createProperty(HYDRA + "previousPage");
3333

34+
public final static Property INVALID_URI = createProperty("urn:invalid");
35+
3436
private final static Property createProperty(String uri) {
3537
return ResourceFactory.createProperty(uri);
3638
}

0 commit comments

Comments
 (0)