I am starting a HSQLDB server programmatically. Everything is working well, except the silent option, which in despite of being the first method that is invoked on the Server object, one line is written on the standard output:
Server server = new Server();
server.setSilent(true);
server.start();
Outputs:
[Server@2c8d66b2]: [Thread[main,5,main]]: setSilent(true)
A quick look at the code associated to the class org.hsqldb.server.Server let me think it is a bug. The field isSilent is initialized to false by default. Then, its value can be changed with a call to setSilent or setProperties. However, these last methods make use of printWithThread to print a few things before changing the value of the field isSilent. Since value passed to printWithThread is written on the standard output if isSilent not set, there is always at least one line displayed on the standard output.
Is there any other solution to prevent output on standard output with the Server class?
If you write a patch to call the printWithMethod AFTER setting the property and check that it works in different configurations, I will look at and apply it if it works.
@Fred Toussi Please find enclosed a patch. It includes a few tests. I don't think the patch fits your coding rules but I hope it will help.
Thanks. The fix looks simple enough. Will check and commit.
Thank you, Fred. Can I expect a new release that includes the fix soon?
When this is fixed and committed to SVN, the status of this ticket will change and you can checkout the code from SVN and build the Jar. A release may happen anytime in the next three months.
I changed something to allow the check for server running state before setting the properties. Your tests pass. Thanks.