Reputation: 729
I want to add a new NewKey-NewValue pair to my config properties file in runtime. I tried :
Properties p = new Properties();
p.load(fileinpustream ...);
...
p.setProperty("NewKey","NewValue");
p.store(outputstream, "comment");
But i always get a NullPointerException on the setProperty line. Any suggestion?
Thanks.
Upvotes: 0
Views: 638
Reputation: 66
Make sure your "NewValue" isn't null
This is from Hashtable, parent of java.util.Properties
...
public synchronized V put(K key, V value) {
// Make sure the value is not null
if (value == null) {
throw new NullPointerException();
}
...
Upvotes: 5