yankai zhang created CONFIGURATION-671:
------------------------------------------
Summary: Empty ini section occurs NPE while save to writer
Key: CONFIGURATION-671
URL: https://issues.apache.org/jira/browse/CONFIGURATION-671
Project: Commons Configuration
Issue Type: Bug
Components: File reloading, Format
Affects Versions: 2.1.1
Environment: OS: OS X 10.12
JDK: 1.8
Reporter: yankai zhang
Priority: Minor
Run following code:
{code:java}
import org.apache.commons.configuration2.INIConfiguration;
import java.io.*;
public class Demo {
public static void main(String[] args) throws Exception {
INIConfiguration ini = new INIConfiguration();
ini.read(new StringReader("[emptySection]"));
ini.write(new StringWriter());
}
}
{code}
Result:
{noformat}
Exception in thread "main" java.lang.NullPointerException
at
org.apache.commons.configuration2.INIConfiguration.writeProperty(INIConfiguration.java:458)
at
org.apache.commons.configuration2.INIConfiguration.write(INIConfiguration.java:309)
at Demo.main(Demo.java:8)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)