Truncate size of the binary file 49/2549/2
authorJussi Koskela <jussi.koskela@semantum.fi>
Thu, 13 Dec 2018 11:03:00 +0000 (13:03 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 13 Dec 2018 11:22:24 +0000 (11:22 +0000)
gitlab #233

Change-Id: I563e413ce2b3ecf3e1b3455221c3a3690bc31674

bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java

index 2ef40c29459d4be20009b30a73f54bd85b6fb08f..79fe974642d2a71e66054fe6de5d00a60424b7bf 100644 (file)
@@ -5914,6 +5914,8 @@ public class ReadGraphImpl implements AsyncReadGraph {
             }
             Serializer serializer = binding.serializer();
             byte[] bytes = serializer.serialize(initialValue);
+            // In case the file has been previously accessed and was larger we set the correct size now
+            rd.binaryFile.setLength(bytes.length);
             rd.binaryFile.write(bytes);
             ravs.put(resource, rd);
             return rd;