File tree Expand file tree Collapse file tree
org.eclipse.lsp4e/src/org/eclipse/lsp4e
operations/symbols/internal Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments