View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0020166FPCRTLpublic2011-09-06 12:052011-09-06 17:31
ReporterHert van Zwietering 
Assigned To 
PrioritynormalSeveritytrivialReproducibilityalways
StatusnewResolutionopen 
PlatformanyOSanyOS Versionany
Product Version2.5.1Product Build 
Target VersionFixed in Version 
Summary0020166: TWriter doesn't stream empty value
DescriptionBy default, the TWriter class is not streaming properties which match the default value.

For instance; I create an object with a single string property and load it from a previously saves stream that contains a value in the string property. This works fine and my object now contains that value. Then subsequently, for this same object, I now load from another stream but this time the stream has an object with an empty string value. This string value was not written out to the stream because the TWriter thinks that an empty string value shouldn't have to be written. So after this second load, my object still contains the value of the first load, simply because the TReader didn't find (hence load) this property in the stream.

I know that this is by design, but would like to start a discussion to have this behavior changed. Delphi7 for instance writes empty strings to the output streams which is to be expected as an empty string is also a value. This doen't only apply to strings but any type... a 0 integer is also a value; a null variant is also a value.

In short I'd like to either have the default checking removed in TWriter.WriteProperty or have a setting for a TWriter where I can tell it to not check default values.
TagsNo tags attached.
FPCOldBugId
Fixed in Revision
Attached Files

- Relationships

-  Notes
(0051513)
Jonas Maebe (manager)
2011-09-06 16:34

Isn't the problem rather that properties not present in the stream aren't initialized to their default value?
(0051515)
Hert van Zwietering (reporter)
2011-09-06 17:31

Oh no, that isn't a problem at all. The problem is that empty values aren't written to the stream and as a result not being loaded. A property could well get a default string value in the constructor and when emptied the empty property would have to be written so that on load of the stream the value is also set to the stored empty value.

- Issue History
Date Modified Username Field Change
2011-09-06 12:05 Hert van Zwietering New Issue
2011-09-06 16:34 Jonas Maebe Note Added: 0051513
2011-09-06 17:31 Hert van Zwietering Note Added: 0051515



MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker