Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-41

[configuration] Output format of FileConfiguration classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1
    • 1.2
    • None
    • None
    • Operating System: Windows 2000
      Platform: Other

    • 37293

    Description

      I am using Commons Configuration 1.1.

      Saving 'FielConfiguration's the configuration files will be overwritten every time.
      Bad if you have formatted them with descriptions and comments ... but this is
      not so important.

      Not so good is, that in the class:

      PropertiesConfiguration:
      '\n' is used as "line separator" and not the "System.getProperty("line.separator")".
      So, on Windows systems the configuration files are badly readable.

      XMLConfiguration:
      The encoding is not looped though to the encoding in the XML head declaration.
      Every time "UTF-8" is set (<?xml version="1.0" encoding="UTF-8"?>)
      I would prefer that my encoding (setEncoding()) is reflected in the XML document.

      Is there a reason that it is implemented like you do?

      Attached are patches which would resolve the problems (if you want):

      PropertiesConfiguration.java:

      properties_lineseparator.patch

      136a137,138
      > private static final String lineSeparator =
      System.getProperty("line.separator");
      >
      344c346
      < out.write("\n");

      > out.write(lineSeparator);
      349c351
      < out.write("\n");

      > out.write(lineSeparator);
      486c488
      < write('\n');

      > write(lineSeparator);
      511c513
      < write("# " + comment + "\n");

      > write("# " + comment + lineSeparator);

      XMLConfiguration.java:

      XML_encoding.patch
      446a447
      > transformer.setOutputProperty(OutputKeys.ENCODING, getEncoding());

      Attachments

        Activity

          People

            Unassigned Unassigned
            kay.doebl@gabo.de Kay Doebl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: