Skip to content

Commit

Permalink
Add non-throwing variant of createFromURI.
Browse files Browse the repository at this point in the history
  • Loading branch information
toinehartman committed Dec 23, 2024
1 parent 92bebee commit 92711ed
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/org/rascalmpl/uri/URIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ public static URI assumeCorrect(String scheme, String authority, String path, St
throw y;
}
}
/**
* Non throwing variant of <a>createFromURI</a>, in case of scenarios where input can be trusted.
*/
public static ISourceLocation assumeCorrectLocation(String uri) {
try {
return createFromURI(uri);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);

Check warning on line 167 in src/org/rascalmpl/uri/URIUtil.java

View check run for this annotation

Codecov / codecov/patch

src/org/rascalmpl/uri/URIUtil.java#L165-L167

Added lines #L165 - L167 were not covered by tests
}
}

public static ISourceLocation correctLocation(String scheme, String authority, String path) {
try {
Expand Down

0 comments on commit 92711ed

Please sign in to comment.