Skip to content

Commit 1f1c368

Browse files
committed
Add javadoc comment and change catched exception type
1 parent b2f851e commit 1f1c368

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,16 @@ public static Set<IEditorReference> findOpenEditorsFor(@Nullable URI uri) {
16021602
return null;
16031603
}
16041604

1605+
/**
1606+
* Converts the given string to a {@link URI} if possible.
1607+
* Ensures correct encoding in case of file URIs.
1608+
*
1609+
* @param uri a URI string
1610+
* @return a URI instance for the given string
1611+
* @throws IllegalArgumentException if the given string is not a valid URI (if it violates RFC 2396)
1612+
* @throws NullPointerException if the given string is null
1613+
* @see URI#create(String)
1614+
*/
16051615
public static URI toUri(String uri) {
16061616
URI initialUri = URI.create(uri);
16071617
return FILE_SCHEME.equals(initialUri.getScheme()) ? toUri(Path.fromPortableString(initialUri.getPath())) : initialUri;

org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/symbols/internal/SymbolIconProviderRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private SymbolIconProvider getIconProvider(Object symbol) {
144144

145145
try {
146146
return LSPEclipseUtils.toUri(uri);
147-
} catch (Exception e) {
147+
} catch (IllegalArgumentException | NullPointerException e) {
148148
LanguageServerPlugin.logWarning("Failed to parse URI " + uri, e); //$NON-NLS-1$
149149
return null;
150150
}

0 commit comments

Comments
 (0)