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(), changeNotes.getChangeId(),
query, query,
reviewerScores.keySet())); reviewerScores.keySet()));
String pluginWeight = String key = plugin.getPluginName() + "-" + plugin.getExportName();
config.getString( String pluginWeight = config.getString("addReviewer", key, "weight");
"addReviewer", plugin.getPluginName() + "-" + plugin.getExportName(), "weight");
if (Strings.isNullOrEmpty(pluginWeight)) { if (Strings.isNullOrEmpty(pluginWeight)) {
pluginWeight = "1"; pluginWeight = "1";
} }
log.debug("weight for {}: {}", key, pluginWeight);
try { try {
weights.add(Double.parseDouble(pluginWeight)); weights.add(Double.parseDouble(pluginWeight));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
log.error( log.error("Exception while parsing weight for {}", key, e);
"Exception while parsing weight for "
+ plugin.getPluginName()
+ "-"
+ plugin.getExportName(),
e);
weights.add(1d); weights.add(1d);
} }
} }