`bw` is not part of `additionalKeyValues()`
Code that landed for #52 (closed) contains (among others):
long bw = -1L;
if (relayLine.additionalKeyValues().get("bw") != null) {
bw = Long.parseLong(
relayLine.additionalKeyValues().get("bw"));
opWriter.processRequest(bwGauge, nodeId, nick, null, rt, bw);
} else {
logger.warn("`bw` Key is null, this should never happen.");
}
preparedStatement.setLong(2, relayLine.bw());
The if
-else
clause is wrong in assuming bw
is part of additionalKeyValzes()
as the preparedStatement.setLong()
call shows. One can see that as well in the metrics library code in BandwidthFileImpl.java
:
switch (key) {
case "node_id":
nodeId = value;
break;
case "master_key_ed25519":
masterKeyEd25519 = value;
break;
case "bw":
try {
bw = Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new DescriptorParseException(String.format(
"Unable to parse bw '%s' in line '%s'.", value, line), e);
}
break;
default:
additionalKeyValues.put(key, value);