Many INI parsers automatically trim leading and trailing whitespace from values on read, so what you’re seeing is the default behavior of the library rather than a bug. Most libraries don’t have a flag to keep leading spaces because INI’s original spec treats leading spaces as not significant. Common work-arounds: Quote the value in the INI file (e.g. key = " bbb.000001") – many parsers preserve spaces inside quotes. If your library supports a raw or untrimmed getter (for example getRaw() or fetch(…,...
That usually happens because the INI library you’re using doesn’t preserve the original line breaks or spacing for comments when it rewrites the file. When you call remove()/add() and then store(), most simple INI implementations regenerate the file content line-by-line from their internal data structures—comments often get treated as keyless properties and lose the newline before the next entry, so they appear “glued” to the next line. Typical fixes: Upgrade or switch libraries: e.g. ini4j (Wini)...
It’s working as designed: the standard Java Properties or most basic INI-parsers don’t support in-place editing. When you call store() on a section it rewrites the file from scratch — which is why you lose the other sections. You’ll need to load the whole file, modify the section you want, and then write the whole thing back. That’s typical for INI handling since the format isn’t random-access. Options: Use a library that preserves all sections/comments, e.g. ini4j . Or roll your own: Ini ini = new...