commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CONFIGURATION-671) Empty ini section occurs NPE while save to writer
Date Thu, 31 Aug 2017 16:05:00 GMT

     [ 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)

Mime
View raw message