Unhandled IllegalArgumentException on incomplete hex digit escape sequence in URI unescaping
Typing the WIP URI http://Projects/Development%
in the resource search dialog produces the following exception in the console:
!ENTRY org.simantics.debug.ui 4 0 2020-08-16 12:18:26.014
!MESSAGE Unexpected exception
!STACK 0
org.simantics.db.exception.DatabaseException: Unexpected exception
at fi.vtt.simantics.procore.internal.SessionImplSocket.syncRequest(SessionImplSocket.java:1850)
at fi.vtt.simantics.procore.internal.SessionImplSocket.syncRequest(SessionImplSocket.java:2953)
at org.simantics.debug.ui.SearchResourceDialog$ItemsFilterWithSearchResults.<init>(SearchResourceDialog.java:282)
at org.simantics.debug.ui.SearchResourceDialog.createFilter(SearchResourceDialog.java:264)
at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.applyFilter(FilteredItemsSelectionDialog.java:1096)
at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.lambda$4(FilteredItemsSelectionDialog.java:647)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:183)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Text.wmCommandChild(Text.java:3014)
at org.eclipse.swt.widgets.Control.WM_COMMAND(Control.java:4910)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4762)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4827)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(Native Method)
at org.eclipse.swt.widgets.Text.callWindowProc(Text.java:313)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4860)
at org.eclipse.swt.widgets.Text.windowProc(Text.java:2618)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4819)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3585)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
at org.eclipse.jface.window.Window.open(Window.java:799)
at org.simantics.debug.ui.internal.DebugUtils.addStatement(DebugUtils.java:154)
at org.simantics.debug.ui.GraphDebuggerEditor$AddStatementAction.run(GraphDebuggerEditor.java:151)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:579)
at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:660)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
at org.simantics.workbench.internal.SimanticsWorkbenchApplication.start(SimanticsWorkbenchApplication.java:156)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.IllegalArgumentException: Incomplete hex digit escape sequence in Development%
at org.simantics.databoard.util.URIStringUtils.unescape(URIStringUtils.java:425)
at org.simantics.db.impl.query.URIToResource$1.execute(URIToResource.java:59)
at org.simantics.db.impl.query.URIToResource$1.execute(URIToResource.java:1)
at org.simantics.db.impl.query.URIToResource.performFromCache(URIToResource.java:110)
at org.simantics.db.impl.query.QueryCache.runnerURIToResource(QueryCache.java:302)
at org.simantics.db.impl.query.URIToResource.computeForEach(URIToResource.java:52)
at org.simantics.db.impl.query.QueryCache.runnerURIToResource(QueryCache.java:306)
at org.simantics.db.impl.query.QueryCacheBase.resultURIToResource(QueryCacheBase.java:962)
at org.simantics.db.impl.graph.ReadGraphImpl.getResource(ReadGraphImpl.java:293)
at org.simantics.db.impl.graph.ReadGraphImpl.getPossibleResource(ReadGraphImpl.java:326)
at org.simantics.debug.ui.SearchResourceDialog$ItemsFilterWithSearchResults$1.run(SearchResourceDialog.java:299)
at org.simantics.db.common.request.ReadRequest.perform(ReadRequest.java:21)
at fi.vtt.simantics.procore.internal.SessionImplSocket$6.run0(SessionImplSocket.java:1521)
at org.simantics.db.impl.query.QueryProcessor$SessionTask.run(QueryProcessor.java:226)
at fi.vtt.simantics.procore.internal.SessionRequestManager$1.run0(SessionRequestManager.java:127)
at org.simantics.db.impl.query.QueryProcessor$SessionTask.run(QueryProcessor.java:226)
at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:238)
There are around 100 places in the codebase where URIStringUtils.unescape
is used. Some of these could use more catching and proper handling of the error.