ReviewerRecommender: Add debug log of plugin provided weight

Also update existing log calls to use the Logger's built in string
formatting rather than concatenation.

Change-Id: Icfaf65eec65aa17a70f85a3b2910a4419212ea43
This commit is contained in:
David Pursehouse 2018-02-07 10:23:25 +09:00
parent 74a2af64db
commit 4657155eec

View File

@ -137,21 +137,16 @@ public class ReviewerRecommender {
changeNotes.getChangeId(),
query,
reviewerScores.keySet()));
String pluginWeight =
config.getString(
"addReviewer", plugin.getPluginName() + "-" + plugin.getExportName(), "weight");
String key = plugin.getPluginName() + "-" + plugin.getExportName();
String pluginWeight = config.getString("addReviewer", key, "weight");
if (Strings.isNullOrEmpty(pluginWeight)) {
pluginWeight = "1";
}
log.debug("weight for {}: {}", key, pluginWeight);
try {
weights.add(Double.parseDouble(pluginWeight));
} catch (NumberFormatException e) {
log.error(
"Exception while parsing weight for "
+ plugin.getPluginName()
+ "-"
+ plugin.getExportName(),
e);
log.error("Exception while parsing weight for {}", key, e);
weights.add(1d);
}
}