AbstractNormalizedNodeDataOutput fails to write out header
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / stream / AbstractNormalizedNodeDataOutput.java
index 2224357d42d96b3c5c9e1bdcdfd0c618b3631233..d54baf92fc43538be2c11ab2c23c945d16c41cb5 100755 (executable)
@@ -77,7 +77,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
     protected abstract short streamVersion();
 
-    protected abstract void writeString(String string) throws IOException;
+    abstract void writeString(@NonNull String string) throws IOException;
 
     @Override
     public final void write(final int value) throws IOException {
@@ -362,14 +362,19 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
         output.writeInt(pathArguments.size());
 
         for (PathArgument pathArgument : pathArguments) {
-            writePathArgument(pathArgument);
+            writePathArgumentInternal(pathArgument);
         }
     }
 
-    @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST",
-            justification = "The casts in the switch clauses are indirectly confirmed via the determination of 'type'.")
     @Override
     public void writePathArgument(final PathArgument pathArgument) throws IOException {
+        ensureHeaderWritten();
+        writePathArgumentInternal(pathArgument);
+    }
+
+    @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST",
+            justification = "The casts in the switch clauses are indirectly confirmed via the determination of 'type'.")
+    final void writePathArgumentInternal(final PathArgument pathArgument) throws IOException {
 
         byte type = PathArgumentTypes.getSerializablePathArgumentType(pathArgument);