dicoogle icon indicating copy to clipboard operation
dicoogle copied to clipboard

XML configuration files might not be saving properly

Open Enet4 opened this issue 6 years ago • 0 comments

This is a bit tricky to reproduce, but sometimes some configuration files are not fully written to disk. For example, roles.xml might end up like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Roles>

... rather than this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Roles>
  <Role name="admin"></Role>
  <Role name="healthcare"></Role>
</Roles>

Saving the settings back to disk is done on boot (so as to ensure that at least the default configuration files exist) and when certain configurations are updated. My hunch is that the XML parser implementations are not closing the output streams. These lines, for instance, look problematic, because it's not closing from the end adaptor pw and is swallowing potential I/O exceptions without even logging them. In RolesXML, the implementations of printFile and printXML also seem a bit dubious.

Enet4 avatar Jun 04 '18 13:06 Enet4