Some ORBs incorrectly encode empty strings as having size 0. The pragmatic way to handle this case would be to return an empty string. Instead, read_string() throws a marshal exception whenever the size parameter is less than 1, making it very hard to use JacORB to integrate with a misbehaving server ORBs.
Created attachment 387 [details] simple (but wrong) fix
Created attachment 388 [details] trivial fix
This patch would unfortunately make JacORB non-compliant with the specification and may well break the unit tests. Which ORBs are non-compliant? An alternative and more compatible design would be to implement a jacorb property that would enable this behaviour. It should be defaulted to off so that JacORB is compliant out-of-the-box. This would also require changes to etc/jacorb_properties.template, the PDF documentation, doc/REL_NOTES, and ideally a unit test should also be added.
Created attachment 389 [details] sample implementation of jacorb.interop.lax_null_string_encoding property
Created attachment 390 [details] unit test showing the property at work.
According to the vendor documentation, the ORB showing the wrong string encoding behaviour is Visibroker. I've implemented a (hopefully) proper fix following your suggestions. ProgrammerGuide documentation, release notes and jacorb_properties.template updated as per your request. Was unsure how to add the unit test, so I resorted in updating the existing regression testcase (to test the existing default behaviour), as well as creating a new one testing the actual behaviour when the flag is set.
Thats great; thanks for your effort; I'll take a look at it.
Bugzilla 904/JAC#639 Enable interop null string marshalling. doc/REL_NOTES doc/ProgrammingGuide/ProgrammingGuide.pdf doc/ProgrammingGuide/Configuration/configuration.tex etc/jacorb_properties.template src/org/jacorb/orb/CDRInputStream.java src/org/jacorb/orb/CDROutputStream.java test/regression/src/org/jacorb/test/orb/CDRInputStreamNullStringTest.java test/regression/src/org/jacorb/test/orb/CDRInputStreamTest.java