[YANGTOOLS-67] Getting flow config data in json format causes exception Created: 21/Dec/13  Updated: 10/Apr/22  Resolved: 09/Jan/14

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Jan Medved Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: Other


External issue ID: 258

 Description   

... and no data is displayed. The exception is as follows

type Exception report

message

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.NullPointerException
com.google.common.base.Joiner.join(Joiner.java:230)
org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec$BitsCodecStringImpl.serialize(TypeDefinitionAwareCodec.java:368)
org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec$BitsCodecStringImpl.serialize(TypeDefinitionAwareCodec.java:358)
org.opendaylight.controller.sal.restconf.impl.RestCodec$ObjectCodec.serialize(RestCodec.java:75)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeValueOfNodeByType(JsonMapper.java:207)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeLeaf(JsonMapper.java:179)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeChildrenOfParent(JsonMapper.java:104)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeList(JsonMapper.java:153)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeChildrenOfParent(JsonMapper.java:92)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeList(JsonMapper.java:158)
org.opendaylight.controller.sal.rest.impl.JsonMapper.write(JsonMapper.java:58)
org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider.writeTo(StructuredDataToJsonProvider.java:55)
org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider.writeTo(StructuredDataToJsonProvider.java:27)
com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1479)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:440)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:179)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.32 logs.

This is for a previously configured flow. the URL to get the flow is, for example:
http://192.168.4.192:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/

Accept header is 'application/json'



 Comments   
Comment by Jozef Gloncak [ 08/Jan/14 ]

Hi,

can you please provide data which you used when mentioned exception was raised.
Thanks

Comment by Jan Medved [ 08/Jan/14 ]

Happens with every flow. For example, take the following flow that was programmed into the controller:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<table
xmlns="urn:opendaylight:flow:inventory">
<flow>
<strict>false</strict>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
<table_id>0</table_id>
<id>2</id>
<cookie_mask>255</cookie_mask>
<out_port>0</out_port>
<installHw>false</installHw>
<out_group>2</out_group>
<match>
<ipv4-destination>10.4.5.6/24</ipv4-destination>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
</match>
<hard-timeout>0</hard-timeout>
<flags/>
<cookie>14</cookie>
<idle-timeout>0</idle-timeout>
<flow-name>FooXf4</flow-name>
<priority>1</priority>
<barrier>false</barrier>
</flow>
</table>

The URL for putting the flow was as follows:
http://192.168.4.1:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/2

accept header was application/xml, content header was application/xml

The i retrieved the operational content of Table 0. URL was:

http://192.168.4.1:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/. With content type application/xml i get:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<table
xmlns="urn:opendaylight:flow:inventory">
<flow>
<strict>false</strict>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
<table_id>0</table_id>
<id>2</id>
<cookie_mask>255</cookie_mask>
<out_port>0</out_port>
<installHw>false</installHw>
<out_group>2</out_group>
<match>
<ipv4-destination>10.4.5.6/24</ipv4-destination>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
</match>
<hard-timeout>0</hard-timeout>
<flags/>
<cookie>14</cookie>
<idle-timeout>0</idle-timeout>
<flow-name>FooXf4</flow-name>
<priority>1</priority>
<barrier>false</barrier>
</flow>
</table>

with content type application/json i get:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.lang.NullPointerException
com.google.common.base.Joiner.join(Joiner.java:230)
org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec$BitsCodecStringImpl.serialize(TypeDefinitionAwareCodec.java:368)
org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec$BitsCodecStringImpl.serialize(TypeDefinitionAwareCodec.java:358)
org.opendaylight.controller.sal.restconf.impl.RestCodec$ObjectCodec.serialize(RestCodec.java:75)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeValueOfNodeByType(JsonMapper.java:207)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeLeaf(JsonMapper.java:179)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeChildrenOfParent(JsonMapper.java:104)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeList(JsonMapper.java:153)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeChildrenOfParent(JsonMapper.java:92)
org.opendaylight.controller.sal.rest.impl.JsonMapper.writeList(JsonMapper.java:158)
org.opendaylight.controller.sal.rest.impl.JsonMapper.write(JsonMapper.java:58)
org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider.writeTo(StructuredDataToJsonProvider.java:55)
org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider.writeTo(StructuredDataToJsonProvider.java:27)
com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1479)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:440)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:179)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.32 logs.

Sending the logs to you in email, it's too long to attach...

Comment by Jozef Gloncak [ 09/Jan/14 ]

Try to replace <flags/> with <flags></flags>.

Comment by Tony Tkacik [ 09/Jan/14 ]

Fixed in https://git.opendaylight.org/gerrit/#/c/4065/.
Bug was caused in YANGtools implementation of bit codec.

Generated at Wed Feb 07 20:52:10 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.