Skip to content

Commit

Permalink
Merge pull request #2113 from usethesource/feature/assume-correct-loc…
Browse files Browse the repository at this point in the history
…ation

Add non-throwing variant of createFromURI.
  • Loading branch information
jurgenvinju authored Dec 23, 2024
2 parents 92bebee + 92711ed commit 08f72e0
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);
}
}

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

0 comments on commit 08f72e0

Please sign in to comment.