package net.floodlightcontroller.sos.web;

import java.io.IOException;

import net.floodlightcontroller.sos.ISOSConnection;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonGenerator.Feature;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

public class SOSConnectionSerializer extends JsonSerializer<ISOSConnection> {

	@Override
	public void serialize(ISOSConnection conn, JsonGenerator jGen, SerializerProvider sProv) 
			throws IOException, JsonProcessingException {
		jGen.configure(Feature.WRITE_NUMBERS_AS_STRINGS, true);

		if (conn == null) {
			jGen.writeStartArray();
			jGen.writeString("No SOS connection to report");
			jGen.writeEndArray();
			return;
		}

		jGen.writeStartObject();
		jGen.writeNumberField("buffer-size", conn.getBufferSize());
		jGen.writeNumberField("parallel-connections", conn.getNumParallelSockets());
		jGen.writeNumberField("queue-capacity", conn.getQueueCapacity());
		jGen.writeNumberField("flow-timeout", conn.getFlowTimeout());
		jGen.writeObjectField("client", conn.getClient());
		jGen.writeObjectField("client-side-agent", conn.getClientSideAgent());
		jGen.writeObjectField("server", conn.getServer());
		jGen.writeObjectField("server-side-agent", conn.getServerSideAgent());
		jGen.writeObjectField("server-side-agent-tcp-port", conn.getServerSideAgentTcpPort());
		jGen.writeObjectField("route-client-to-agent", conn.getClientSideRoute());
		jGen.writeObjectField("route-server-to-agent", conn.getServerSideRoute());
		jGen.writeObjectField("route-agent-to-agent", conn.getInterAgentRoute());
		jGen.writeStringField("route-client-to-agent", conn.getTransferID().toString());
		jGen.writeStringField("time-init", conn.getInitTime().toString());
		jGen.writeStringField("time-start", conn.getStartTime().toString());
		jGen.writeStringField("time-stop", conn.getStopTime().toString());

		jGen.writeEndObject();
	}
}
@@ -1817,16 +1817,54 @@
 e-init%22,
+ conn.getInitTime() == null ? %22none%22 :
  conn.ge
@@ -1921,24 +1921,63 @@
 time-start%22,
+ conn.getStartTime() == null ? %22none%22 :
  conn.getSta
@@ -2034,16 +2034,54 @@
 e-stop%22,
+ conn.getStopTime() == null ? %22none%22 :
  conn.ge

Check null times in connection serializer