@Override
    public Map<String, Object> load(String configKey) {
        if (targetUri == null) {
            return null;
        }

        // Check for new file every so often
        int currentTimeSecs = Time.currentTimeSecs();
        if (lastReturnedValue != null && ((currentTimeSecs - lastReturnedTime) < artifactoryPollTimeSecs)) {
            LOG.debug("currentTimeSecs: {}; lastReturnedTime {}; artifactoryPollTimeSecs: {}. Returning our last map.",
                      currentTimeSecs, lastReturnedTime, artifactoryPollTimeSecs);
            return (Map<String, Object>) lastReturnedValue.get(configKey);
        }

        try {
            Map<String, Object> raw = loadFromUri(targetUri);
            if (raw != null) {
                return (Map<String, Object>) raw.get(configKey);
            }
        } catch (Exception e) {
            LOG.error("Failed to load from uri {}", targetUri);
        }
        return null;
    }
@Test
    public void testMalformedYaml() {
        // This is a test where we are configured to point right at a single artifact
        Config conf = new Config();
        conf.put(DaemonConfig.SCHEDULER_CONFIG_LOADER_URI,
                 ARTIFACTORY_HTTP_SCHEME_PREFIX + "bogushost.yahoo.com:9999/location/of/this/artifact");
        conf.put(Config.STORM_LOCAL_DIR, tmpDirPath.toString());

        ArtifactoryConfigLoaderMock loaderMock = new ArtifactoryConfigLoaderMock(conf);
        loaderMock.setData("Anything", "/location/of/this/artifact", "{ \"downloadUri\": \"anything\"}");
        loaderMock.setData(null, null, "ThisIsNotValidYaml");

        Map<String, Object> ret = loaderMock.load(DaemonConfig.MULTITENANT_SCHEDULER_USER_POOLS);
        assertNull(ret, "Unexpectedly returned a map");
    }