Search code examples
javaini

strange Java org.ini4j.Ini behaviour - file is edited without intentional edit


I am having an ini file, which is my coniguration for a Java application.

I am using org.ini4j.Ini for the purpose of reading and editing the file.

ini = new Ini(new File("config.ini"));

[...]

public static String getImagePath() {
        return ini.get("other", "imagePath");
}

After starting the application and after executing the getImagePath function somehow Java or any program changes the config to

from

imagePath = C:\tmp

to

imagePath = C: mp

I don't see any code in my application doing this. The behaviour is reproducable. I am using Process Monitor (ProcMon) to log all access on the file, but I can't find anything suspicious. I also changed the machine and directory and the 'position of the variable in the configuration' without change. Could it be that a firewall or antivirus is causing this?


Solution

  • The problem was, I was specifying the imagePath as it is:

    C:\tmp
    
     not C:\\tmp
    

    and somehow java was after editing the configuration saving the file and interprets \t as tabulator.