commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Putnam <deput...@cisco.com>
Subject CompositeConfiguration Checking Existence of Properties.
Date Wed, 31 Oct 2012 15:51:53 GMT
I am making my first foray into CompositeConfiguration and am struggling 
with some basics. I am trying to create a method that returns a 
specified property or 'null' if it does not exist:

Public String getProperty(String prop) {
    return((String) config.getProperty(prop));
}

The problem is that I keep getting a NullPointerException. I know it is 
not 'config' that is null so the exception is a bit confusing. In any 
case I also know that the value of 'prop' is a key that does not exist. 
So the question really is, how do I determine that a property does not 
exist so I can return a null? When I search for checking existence of a 
property I get nothing useful and the docs don't seem to indicate a 
solution either. TIA.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message