fapifta commented on code in PR #4369:
URL: https://github.com/apache/ozone/pull/4369#discussion_r1131039674
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/DatanodeIdYaml.java:
##########
@@ -219,11 +226,31 @@ public void setCurrentVersion(int version) {
}
private static DatanodeDetailsYaml getDatanodeDetailsYaml(
- DatanodeDetails datanodeDetails) {
+ DatanodeDetails datanodeDetails, ConfigurationSource conf)
+ throws IOException {
+
+ DatanodeLayoutStorage datanodeLayoutStorage
+ = new DatanodeLayoutStorage(conf, datanodeDetails.getUuidString());
Map<String, Integer> portDetails = new LinkedHashMap<>();
if (!CollectionUtils.isEmpty(datanodeDetails.getPorts())) {
for (DatanodeDetails.Port port : datanodeDetails.getPorts()) {
+ Field f = null;
+ try {
+ f = port.getName().getClass()
+ .getDeclaredField(port.getName().toString());
+ } catch (NoSuchFieldException e) {
+ e.printStackTrace();
Review Comment:
Is this exception even possible to be thrown?
I believe it is impossible to get a port from the datanodeDetails object
that does not have a name defined in the enum.
Still, I think, as printStackTrace writes to the stderr, this
e.printStackTrace() should be either replaced with a simple comment that
describes why we do not expect the exception here, or it should be replaced
with logging at least.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]