[YANGTOOLS-622] Improve AbstractStringInstanceIdentifierCodec error reporting Created: 10/Jun/16 Updated: 04/Jul/21 |
|
| Status: | Confirmed |
| Project: | yangtools |
| Component/s: | codecs |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Highest |
| Reporter: | Jozef Behran | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Issue Links: |
|
||||||||
| Epic Link: | Usable RpcError | ||||||||
| Description |
|
Attempt to configure a websocket on "/car:cars/car:car-entry" or "/car:cars/car-entry" (or any other list) causes the following error:
{"errors":{"error":[
{"error-type":"protocol","error-tag":"malformed-message","error-message":"Error parsing input: Could not parse Instance Identifier '/car:cars/car:car-entry'. Offset: 23 : Reason: Entry (urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car?revision=2014-08-18)car-entry requires key or value predicate to be present","error-info":"java.lang.IllegalArgumentException: Could not parse Instance Identifier '/car:cars/car:car-entry'. Offset: 23 : Reason: Entry (urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car?revision=2014-08-18)car-entry requires key or value predicate to be present
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.opendaylight.yangtools.yang.data.util.XpathStringParsingPathArgumentBuilder.checkValid(XpathStringParsingPathArgumentBuilder.java:255)
at org.opendaylight.yangtools.yang.data.util.XpathStringParsingPathArgumentBuilder.computeIdentifier(XpathStringParsingPathArgumentBuilder.java:174)\n\tat org.opendaylight.yangtools.yang.data.util.XpathStringParsingPathArgumentBuilder.computeNextArgument(XpathStringParsingPathArgumentBuilder.java:101)\n\tat org.opendaylight.yangtools.yang.data.util.XpathStringParsingPathArgumentBuilder.build(XpathStringParsingPathArgumentBuilder.java:90)\n\tat org.opendaylight.yangtools.yang.data.util.AbstractStringInstanceIdentifierCodec.deserialize(AbstractStringInstanceIdentifierCodec.java:96)\n\tat org.opendaylight.yangtools.yang.data.util.AbstractStringInstanceIdentifierCodec.deserialize(AbstractStringInstanceIdentifierCodec.java:26)\n\tat org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.translateValueByType(JsonParserStream.java:235)\n\tat org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.setValue(JsonParserStream.java:123)\n\tat org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.read(JsonParserStream.java:131)\n\tat org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.read(JsonParserStream.java:195)\n\tat org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.read(JsonParserStream.java:195)\n\tat org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.parse(JsonParserStream.java:95)\n\tat org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader.readFrom(JsonNormalizedNodeBodyReader.java:131)\n\tat org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader.readFrom(JsonNormalizedNodeBodyReader.java:71)\n\tat org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader.readFrom(JsonNormalizedNodeBodyReader.java:52)\n\tat com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:488)\n\tat com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123)\n\tat com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:46)\n\tat com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153)\n\tat com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:183)\n\tat com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)\n\tat com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\n\tat com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\n\tat com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)\n\tat com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:668)\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1496)\n\tat org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:247)\n\tat org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:210)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1467)\n\tat org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:82)\n\tat org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:256)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1467)\n\tat org.opendaylight.aaa.filterchain.filters.CustomFilterAdapter.doFilter(CustomFilterAdapter.java:85)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1467)\n\tat org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)\n\tat org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)\n\tat org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)\n\tat org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)\n\tat org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)\n\tat org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)\n\tat org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)\n\tat org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)\n\tat org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)\n\tat org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)\n\tat org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)\n\tat org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1467)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)\n\tat org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)\n\tat org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:240)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)\n\tat org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:75)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:366)\n\tat org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)\n\tat org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)\n\tat org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)\n\tat org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)\n\tat org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)\n\tat org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)\n\tat org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)\n\tat org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)\n\tat java.lang.Thread.run(Thread.java:745)\n"}
]}} This makes it impossible to hook a websocket on a list to get a notification stream which emits messages about new items added to the list or old items deleted from the list. This is a problem in the Restconf parser as these list notification streams can be created in the Java code just fine. |
| Comments |
| Comment by Jozef Behran [ 13/Jun/16 ] |
|
Steps to reproduce: 1. Install ODL with "odl-clustering-test-app" feature installed |
| Comment by Ivan Hrasko [ 26/Jul/16 ] |
|
List is mixin node type. It does not represents data. |
| Comment by Jozef Behran [ 01/Aug/16 ] |
|
Well, by hooking a notification on a list I want to get updates about new items being created in that list or already present items being deleted. I should get just the item(s) affected in the notification instead of the entire list contents. That should be doable even when the list is a "mixin type which does not represent data". If there is a way to do that, A tutorial needs to be made to do this. Also the error report needs to be improved. When I see an exception like this, I assume something on the server crashed and I am getting info about the crash. And I suspect I am not the only one who tends to make such assumptions on seeing errors like this. |
| Comment by Miroslav Kovac [ 07/Sep/16 ] |
|
It is not possible to do the request on yang list because it is missing key. you can either do the request on following path: |
| Comment by Robert Varga [ 01/Jun/17 ] |
|
We need to improve the error message which is thrown by XpathStringParsingPathArgumentBuilder to better guide the user. We probably should also create a separate class of Exceptions which RESTCONF can use to translate parsing errors into RpcError details. |