Donate Share

[ini4j]

Tracker: Bugs

5 Ini.store with null values - ID: 1897071
Last Update: Comment added ( szkiba )

I am using ini4j 0.3.2 to generate INI Files from database values (users
have a special form to enter the values).
If the key is defined but the value is null then I get the following:

java.lang.NullPointerException
at org.ini4j.Convert.escape(Convert.java:25)
at org.ini4j.Ini.store(Ini.java:250)

Well there is an easy workaround for me: I never put null values to the
section but use "" instead.

Nevertheless it would be nice if ini4j could handle this case. For example
changing Ini.java:250 to:

pr.println(e.getValue()==null ? "" :
Convert.escape(e.getValue()));

worked for my situation.

thanx,walter


walter podesser ( walpod ) - 2008-02-19 16:47

5

Closed

Fixed

Nobody/Anonymous

None

None

Public


Comment ( 1 )

Date: 2009-02-05 21:36
Sender: szkibaProject Admin

Fixed in version 0.3.3

By default, empty option (null values) skipepd in store method. If you
want to store null values as empty string, you should use FancyIniFormatter
class from addons package (just put org.ini4j.addons.FancyIniFormatter in
to META-INF/services/org.ini4j.IniFormatter file)




Attached File

No Files Currently Attached

Changes ( 4 )

Field Old Value Date By
status_id Open 2009-02-05 21:36 szkiba
resolution_id None 2009-02-05 21:36 szkiba
allow_comments 1 2009-02-05 21:36 szkiba
close_date - 2009-02-05 21:36 szkiba