Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old mcc maps can be migrated to new metric names #3685 #3803

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ class MetricRenamer(
val updatedAttributes = node.attributes.toMutableMap()

val mccValue = updatedAttributes.remove("mcc")
if (mccValue == null) {
throw NullPointerException(
?: throw NullPointerException(
"Input file contains null value for a node attribute! Please ensure the input is a valid cc.json file."
)
}
updatedAttributes[newName] = mccValue

node.attributes = updatedAttributes
Expand All @@ -61,13 +59,13 @@ class MetricRenamer(
): Map<String, MutableMap<String, AttributeType>> {
val nodeAttributes = attributeTypes["nodes"] ?: return attributeTypes

val mccType = nodeAttributes.remove("mcc")
if (mccType == null) {
throw NullPointerException(
"Input file contains null value for an attribute type! Please ensure the input is a valid cc.json file."
)
if (nodeAttributes.containsKey("mcc")) {
val mccType = nodeAttributes.remove("mcc")
?: throw NullPointerException(
"Input file contains null value for an attribute type! Please ensure the input is a valid cc.json file."
)
nodeAttributes[newName] = mccType
}
nodeAttributes[newName] = mccType

return attributeTypes
}
Expand All @@ -77,12 +75,10 @@ class MetricRenamer(

val updatedAttributeDescriptors = attributeDescriptors.toMutableMap()
val mccDescriptor = updatedAttributeDescriptors.remove("mcc")

if (mccDescriptor == null) {
throw NullPointerException(
?: throw NullPointerException(
"Input file contains null value for an attribute descriptor! Please ensure the input is a valid cc.json file."
)
}

updatedAttributeDescriptors[newName] = mccDescriptor
return updatedAttributeDescriptors
}
Expand Down
Loading