File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
src/org/linkeddatafragments Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff 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 /**
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments