What steps will reproduce the problem?
1. Linux: No Kde Desktop installed or ~/.kde/share/config/kioslaverc not exists
2. Use Strategy.KDE as first entry in customized ProxySearch:
import com.btr.proxy.search.ProxySearch;
public class KdeProxySearchStrategyError {
public static void main(String[] args) {
ProxySearch proxySearch = new ProxySearch();
proxySearch.addStrategy(ProxySearch.Strategy.KDE);
proxySearch.addStrategy(ProxySearch.Strategy.GNOME);
proxySearch.getProxySelector();
}
}
What is the expected output? What do you see instead?
expected: no error
actual: NullPointerException
Exception in thread "main" java.lang.NullPointerException
at com.btr.proxy.search.desktop.kde.KdeProxySearchStrategy.getProxySelector(KdeProxySearchStrategy.java:75)
..
What version of the product are you using? On what operating system?
proxy-vole: v2011102 and current SVN
OS: Gentoo Linux
Desktop: Gnome 2.32
Java: 1.6.0_32
Please provide any additional information below.
KdeSettingsParser.parseSettings() returns <null> if no settings file was found.
This <null> value is used unchecked here:
KdeProxySearchStrategy.getProxySelector()
..
Properties settings = readSettings(); // settings == null
ProxySelector result = null;
int type = Integer.parseInt(settings.getProperty("ProxyType", "-1")); // NPE
..
TODO:
Keep the <null> result for readSettings() if no settings available.
Check for <null> after readSettings() and return <null> if no settings
available.
In general I would prefer this for all ..SearchStrategy parsers if the checked
environment is not available. Actual in this case an empty Properties() is
returned for some parsers.
Regards
Stefan.
Original issue reported on code.google.com by tuxatwor...@gmail.com on 25 May 2012 at 2:36
Original issue reported on code.google.com by
tuxatwor...@gmail.com
on 25 May 2012 at 2:36