if (Debug.debugging("properties")) {
if (Debug.debugging("locale")) { java.util.Locale.setDefault(new java.util.Locale("pl", "PL")); }   if (DEBUG) {
    protected void searchForAndLoadProperties() {        Properties tmpProperties = new Properties();        Properties includeProperties;        boolean foundProperties = false;        boolean showDebugMessages = false;                if (Debug.debugging("properties")) {            showDebugMessages = true;        }        if (Debug.debugging("showprogress")) {            updateProgress = true;        }        if (showDebugMessages) {            Debug.output("***** Searching for properties ****");        }                        // look for openmap.properties file in jar archive(of course        // only in same package as this class) or wherever this        // object's class file lives.        if (showDebugMessages) {            Debug.output("PropertyHandler: Looking for " +                          propsFileName + " in Resources");        }        InputStream propsIn = getClass().getResourceAsStream(propsFileName);        // Look in the codebase for applets...        if (propsIn == null && Environment.isApplet()) {            URL[] cba = new URL[1];            cba[0] =  Environment.getApplet().getCodeBase();            URLClassLoader ucl = URLClassLoader.newInstance(cba);            propsIn = ucl.getResourceAsStream(propsFileName);        }        if (propsIn == null) {            propsIn = ClassLoader.getSystemResourceAsStream(propsFileName);                        if (propsIn != null && showDebugMessages) {                Debug.output("Loading properties from System Resources: " +                              propsFileName);            }        } else {            if (showDebugMessages) {                Debug.output("Loading properties from file " +                              propsFileName + " from package of class " +                              getClass());            }        }        if (propsIn != null) {            foundProperties = PropUtils.loadProperties(tmpProperties, propsIn);            init(tmpProperties, "resources");            tmpProperties.clear();        }        if (!foundProperties && (Environment.isApplet() || showDebugMessages)) {            Debug.output("PropertyHandler: Unable to locate as resource: " + propsFileName);        }        //  Seems like we can kick out here in event of Applet...        if (Environment.isApplet()) {            Environment.init(getProperties());            return;        }        Properties systemProperties;        try {            systemProperties = System.getProperties();        } catch (java.security.AccessControlException ace) {            systemProperties = new Properties();        }        String openmapConfigDirectory =             systemProperties.getProperty(configDirProperty);        if (openmapConfigDirectory == null) {            Vector cps = Environment.getClasspathDirs();            String defaultExtraDir = "share";            for (int searchCount = 0; searchCount < cps.size(); searchCount++) {                File shareDir = new File((String)cps.elementAt(searchCount), defaultExtraDir);                if (shareDir.exists()) {//                  Debug.output("Found share directory: " + shareDir.getPath());                    openmapConfigDirectory = shareDir.getPath();                    break;//              } else {//                  Debug.output("No share directory in: " + shareDir.getPath());                }            }        }        Environment.addPathToClasspaths(openmapConfigDirectory);        // in OpenMap config directory        if (showDebugMessages) {            Debug.output("PropertyHandler: Looking for " +                          propsFileName + " in configuration directory: " +                          (openmapConfigDirectory == null?"not set":openmapConfigDirectory));        }        // We want foundProperties to reflect if properties have ever been found.        foundProperties |= PropUtils.loadProperties(tmpProperties,                                                     openmapConfigDirectory,                                                     propsFileName);                // Include properties from config file properties.        includeProperties =             getIncludeProperties(tmpProperties.getProperty(includeProperty),                                 tmpProperties);        merge(includeProperties, "include file properties", openmapConfigDirectory);        // OK, now merge the config file properties into the main properties        merge(tmpProperties, propsFileName, openmapConfigDirectory);        // Clear out the tmp        tmpProperties.clear();                // Let system properties take precidence over resource and        // config dir properties.        merge(systemProperties, "system properties", "system");        // in user's home directory, most precedence.        String userHomeDirectory = systemProperties.getProperty("user.home");        if (showDebugMessages) {            Debug.output("PropertyHandler: Looking for " +                          propsFileName + " in user's home directory: " +                          userHomeDirectory);        }                // We want foundProperties to reflect if properties have ever been found.        foundProperties |= PropUtils.loadProperties(tmpProperties,                                                     userHomeDirectory,                                                     propsFileName);        if (showDebugMessages) {            Debug.output("***** Done with property search ****");        }        if (!foundProperties && !Environment.isApplet()) {            PropUtils.copyProperties(PropUtils.promptUserForProperties(),                                     properties);        }        //  Before we the user properties into the overall properties,        //  need to check for the include properties URLs, and load        //  those first.        includeProperties =             getIncludeProperties(tmpProperties.getProperty(includeProperty),                                 tmpProperties);        merge(includeProperties, "include file properties", userHomeDirectory);        // Now, load the user home preferences last, since they take        // the highest precidence.        merge(tmpProperties, propsFileName, userHomeDirectory);        Environment.init(getProperties());    }