You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2017/08/31 16:05:00 UTC

[jira] [Resolved] (CONFIGURATION-671) Empty ini section occurs NPE while save to writer

     [ https://issues.apache.org/jira/browse/CONFIGURATION-671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-671.
----------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.2

Fixed in SVN in revision 1806820.

The root cause of the problem was that configuration nodes without children (as is the case for an empty section) were not recognized as section nodes. This has been fixed now.

Thanks again.

> 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
>             Fix For: 2.2
>
>
> 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)