[CONTROLLER-1241] ClassCastException when querying - controller-config/yang-ext:mount/config:modules Created: 08/Apr/15 Updated: 10/Apr/15 Resolved: 10/Apr/15 |
|
| Status: | Resolved |
| Project: | controller |
| Component/s: | restconf |
| Affects Version/s: | Post-Helium |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Devin Avery | Assignee: | Jan Hajnar |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: Linux |
||
| External issue ID: | 2964 |
| Description |
|
When we query: GET, accept: application/json we get a 500 error. If we change the type to be application/xml it works. Stack: /restconf/config/opendaylight-inventory:nodes/node/controller-config/yang-ext:mount/config:modules/. Reason: |
| Comments |
| Comment by Tom Pantelis [ 09/Apr/15 ] |
|
It chokes here in JSONNormalizedNodeStreamWriter: private void writeValue(Object value, JSONCodec<Object> codec) The codec class is JSONStringIdentityrefCodec whose serializeToWriter method has this signature: public void serializeToWriter(JsonWriter writer, QName value) But the value contained in the leaf node is of type String: "prefix:binding-broker-osgi-registry". I'm not sure if the wrong codec class was chosen earlier or if the value should've been converted to a QName (I suspect the latter). In my case the data it's trying to serialize corresponds to this xml snippet in 99-netconf-connector.xml: <binding-registry> |
| Comment by Tony Tkacik [ 09/Apr/15 ] |
|
This seems to be bug in XML codecs and/or Netconf which |
| Comment by Tony Tkacik [ 09/Apr/15 ] |
| Comment by Tom Pantelis [ 09/Apr/15 ] |
|
I pulled in the patch but now I'm seeing a different exception: Problem accessing /restconf/config/opendaylight-inventory:nodes/node/controller-config/yang-ext:mount/config:modules. Reason: |
| Comment by Tom Pantelis [ 09/Apr/15 ] |
|
In this method in JSONNormalizedNodeStreamWriter, the NULL_CODEC is returned from codeFor: public void leafNode(final NodeIdentifier name, final Object value) throws IOException { final LeafSchemaNode schema = tracker.leafNode(name); final JSONCodec<Object> codec = codecs.codecFor(schema); <------- context.emittingChild(codecs.getSchemaContext(), writer); context.writeChildJsonIdentifier(codecs.getSchemaContext(), writer, name.getNodeType()); writeValue(value, codec); }In JSONCodefFactory#createFromSimpleType: LOG.debug("Codec for type \"{}\" is not implemented yet.", type.getQName() It appears no codec has been implemented for IdentityrefType. |
| Comment by Tom Pantelis [ 09/Apr/15 ] |
|
Actually it seems the problem is it isn't picking up the JSONStringIdentityrefCodec now - it did before. |
| Comment by Tony Tkacik [ 09/Apr/15 ] |
|
Original patch https://git.opendaylight.org/gerrit/#/c/17991/ https://git.opendaylight.org/gerrit/#/c/17912/ patch introduced regression which Patch https://git.opendaylight.org/gerrit/#/c/18030/1 |
| Comment by Tom Pantelis [ 09/Apr/15 ] |
|
Verified fixes - thanks for turning this around quickly. |