Source:
<code>public void run() throws Exception { log.info("Starting the Camus - Daily Cleaner"); Configuration conf = new Configuration(); fs = FileSystem.get(conf); List<String> blacklist = Utils.getStringList(props, "camus.sweeper.blacklist"); List<String> whitelist = Utils.getStringList(props, "camus.sweeper.whitelist"); String fromLocation = (String) props.getProperty("camus.sweeper.source.dir"); String destLocation = (String) props.getProperty("camus.sweeper.dest.dir", ""); if (destLocation.isEmpty()) destLocation = fromLocation; <START> sourcePath = fs.getFileStatus(new Path(destLocation)).getPath(); <END> log.debug("Daily Path : " + sourcePath); simulate = Boolean.parseBoolean(props.getProperty(SIMULATE, "false")); force = Boolean.parseBoolean(props.getProperty(FORCE, "false")); Map<String, String> map = Utils.getMapByPrefix(props, RETENTION_TOPIC_PREFIX); int regularRetention = Integer.parseInt((String) props.getProperty("camus.sweeper.clean.retention.days.global", "-1")); if (regularRetention != -1) System.out.println("Global retention set to " + regularRetention); else System.out.println("Global retention set to infinity, will not delete unspecified topics"); WhiteBlackListPathFilter filter = new WhiteBlackListPathFilter(whitelist, blacklist, sourcePath); Map<FileStatus, String> topics = CamusSweeper.findAllTopics(sourcePath, filter, sourceSubDir, fs); for (FileStatus status : topics.keySet()) { String name = status.getPath().getName(); if (name.startsWith(".") || name.startsWith("_")) { continue; } String fullname = topics.get(status); int topicRetention = map.containsKey(fullname) ? Integer.parseInt(map.get(fullname)) : regularRetention; enforceRetention(fullname, status, sourceSubDir, destSubDir, topicRetention); } if (topicExceptionString != null) { throw new RuntimeException(topicExceptionString); } }</code><technical_language>This variable name 'sourcePath' is confusing, 'destPath' is better</technical_language>

Target:
public void run() throws Exception { log.info("Starting the Camus - Daily Cleaner"); Configuration conf = new Configuration(); fs = FileSystem.get(conf); List<String> blacklist = Utils.getStringList(props, "camus.sweeper.blacklist"); List<String> whitelist = Utils.getStringList(props, "camus.sweeper.whitelist"); String fromLocation = (String) props.getProperty("camus.sweeper.source.dir"); sourcePath = fs.getFileStatus(new Path(fromLocation)).getPath(); log.debug("Path : " + sourcePath); simulate = Boolean.parseBoolean(props.getProperty(SIMULATE, "false")); force = Boolean.parseBoolean(props.getProperty(FORCE, "false")); Map<String, String> map = Utils.getMapByPrefix(props, RETENTION_TOPIC_PREFIX); int regularRetention = Integer.parseInt((String) props.getProperty("camus.sweeper.clean.retention.days.global", "-1")); if (regularRetention != -1) log.info("Global retention set to " + regularRetention); else log.info("Global retention set to infinity, will not delete unspecified topics"); WhiteBlackListPathFilter filter = new WhiteBlackListPathFilter(whitelist, blacklist, sourcePath); Map<FileStatus, String> topics = CamusSweeper.findAllTopics(sourcePath, filter, sourceSubDir, fs); for (FileStatus status : topics.keySet()) { String name = status.getPath().getName(); if (name.startsWith(".") || name.startsWith("_")) { continue; } String fullname = topics.get(status); int topicRetention = map.containsKey(fullname) ? Integer.parseInt(map.get(fullname)) : regularRetention; enforceRetention(fullname, status, sourceSubDir, destSubDir, topicRetention); } if (topicExceptionString != null) { throw new RuntimeException(topicExceptionString); } }