Thursday, July 26, 2012

Why System.setProperties(Properties p) is a bad idea...

For the last day I've been debugging what I believed to be an issue with Drools and a "cannot read dialect" error. Turns out the problem was when I called System.setProperties(Properties p). After some quick investigation, I found that when you call this method (as opposed to setProperty(String key, String value)), all of the System properties get overwritten!

More information can be found in my original stackoverflow post: http://stackoverflow.com/questions/11659055/drools-dialect-nullpointerexception-running-outside-of-ide

tl;dr - Don't use System.setProperties(Properties p) unless you know what you're doing. It will cause unknown and uncontrolled side effects.

No comments:

Post a Comment