From 07fabab017d40384c0a46338ebfd5cb3a9d8bc2d Mon Sep 17 00:00:00 2001 From: Benjamin Reed Date: Thu, 6 Jul 2023 14:03:21 -0400 Subject: [PATCH] fix a number of sonar warnings in recent code --- .../opennms/container/jaas/JaasSupport.java | 75 +++++++++------ .../core/config/api/JaxbListWrapper.java | 18 ++-- .../server/KafkaMessageConsumerManager.java | 16 ++-- .../core/mate/commands/MetaCommand.java | 28 +++--- .../snmp/JUnitSnmpAgentExecutionListener.java | 8 +- .../ext2/cm/change/types/NumberType.java | 17 ++-- .../syslogd/ParserStageSequenceBuilder.java | 15 ++- .../support/DefaultReportServiceLocator.java | 18 ++-- .../netflow/parser/Netflow5UdpParser.java | 8 +- .../parser/transport/MessageUtils.java | 8 +- .../transport/Netflow5MessageBuilder.java | 57 ++++++----- .../transport/Netflow9MessageBuilder.java | 96 ++++++++++--------- .../netflow/transport/SamplingAlgorithm.java | 4 +- .../model/OnmsAcknowledgmentCollection.java | 5 +- .../netmgt/model/OnmsAlarmCollection.java | 5 +- .../netmgt/model/OnmsCategoryCollection.java | 7 +- .../netmgt/model/OnmsEventCollection.java | 5 +- .../opennms/netmgt/model/OnmsGroupList.java | 5 +- .../netmgt/model/OnmsIpInterfaceList.java | 5 +- .../OnmsLocationAvailDefinitionList.java | 5 +- .../netmgt/model/OnmsMetaDataList.java | 5 +- .../netmgt/model/OnmsMinionCollection.java | 5 +- .../model/OnmsMonitoredServiceDetailList.java | 5 +- .../model/OnmsMonitoredServiceList.java | 5 +- .../model/OnmsMonitoringSystemCollection.java | 5 +- .../opennms/netmgt/model/OnmsNodeList.java | 5 +- .../model/OnmsNotificationCollection.java | 5 +- .../netmgt/model/OnmsOutageCollection.java | 11 +-- .../netmgt/model/OnmsSnmpInterfaceList.java | 12 +-- .../opennms/netmgt/model/OnmsUserList.java | 5 +- .../model/alarm/AlarmSummaryCollection.java | 1 + .../model/outage/OutageSummaryCollection.java | 5 +- .../model/resource/ResourceDTOCollection.java | 7 +- .../netmgt/rrd/RrdStrategyFactory.java | 37 +++---- .../org/opennms/web/category/Category.java | 10 +- .../web/svclayer/support/PropertyUtils.java | 30 +++--- 36 files changed, 304 insertions(+), 254 deletions(-) diff --git a/container/jaas-login-module/src/main/java/org/opennms/container/jaas/JaasSupport.java b/container/jaas-login-module/src/main/java/org/opennms/container/jaas/JaasSupport.java index f1099964d461..b90b4ffd1414 100644 --- a/container/jaas-login-module/src/main/java/org/opennms/container/jaas/JaasSupport.java +++ b/container/jaas-login-module/src/main/java/org/opennms/container/jaas/JaasSupport.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2012-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2012-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -28,6 +28,8 @@ package org.opennms.container.jaas; +import java.util.concurrent.atomic.AtomicReference; + import org.opennms.netmgt.config.GroupDao; import org.opennms.netmgt.config.api.UserConfig; import org.opennms.web.springframework.security.SpringSecurityUserDao; @@ -37,55 +39,66 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class JaasSupport { - private static final transient Logger LOG = LoggerFactory.getLogger(OpenNMSLoginModule.class); +public final class JaasSupport { + private static final Logger LOG = LoggerFactory.getLogger(JaasSupport.class); + + private static AtomicReference m_context = new AtomicReference<>(); + private static AtomicReference m_userConfig = new AtomicReference<>(); + private static AtomicReference m_groupDao = new AtomicReference<>(); + private static AtomicReference m_userDao = new AtomicReference<>(); - private static transient volatile BundleContext m_context; - private static transient volatile UserConfig m_userConfig; - private static transient volatile GroupDao m_groupDao; - private static transient volatile SpringSecurityUserDao m_userDao; + private JaasSupport() {} public static synchronized void setContext(final BundleContext context) { - m_userConfig = null; - m_groupDao = null; - m_userDao = null; - m_context = context; + m_context.set(context); + m_userConfig.set(null); + m_groupDao.set(null); + m_userDao.set(null); } public static synchronized BundleContext getContext() { - if (m_context == null) { - setContext(FrameworkUtil.getBundle(JaasSupport.class).getBundleContext()); - } - return m_context; + final var context = m_context.get(); + if (context != null) { + return context; + } + setContext(FrameworkUtil.getBundle(JaasSupport.class).getBundleContext()); + return m_context.get(); } public static UserConfig getUserConfig() { - if (m_userConfig == null) { - m_userConfig = getFromRegistry(UserConfig.class); - } - return m_userConfig; + final var userConfig = m_userConfig.get(); + if (userConfig != null) { + return userConfig; + } + m_userConfig.set(getFromRegistry(UserConfig.class)); + return m_userConfig.get(); } public static SpringSecurityUserDao getSpringSecurityUserDao() { - if (m_userDao == null) { - m_userDao = getFromRegistry(SpringSecurityUserDao.class); - } - return m_userDao; + final var userDao = m_userDao.get(); + if (userDao != null) { + return userDao; + } + m_userDao.set(getFromRegistry(SpringSecurityUserDao.class)); + return m_userDao.get(); } public static GroupDao getGroupDao() { - if (m_groupDao == null) { - m_groupDao = getFromRegistry(GroupDao.class); - } - return m_groupDao; + final var groupDao = m_groupDao.get(); + if (groupDao != null) { + return groupDao; + } + m_groupDao.set(getFromRegistry(GroupDao.class)); + return m_groupDao.get(); } private static T getFromRegistry(final Class clazz) { - if (m_context == null) { + final var context = m_context.get(); + if (context == null) { LOG.warn("No bundle context. Unable to get class {} from the registry.", clazz); return null; } - final ServiceReference ref = m_context.getServiceReference(clazz); - return m_context.getService(ref); + final ServiceReference ref = context.getServiceReference(clazz); + return context.getService(ref); } } diff --git a/core/api/src/main/java/org/opennms/core/config/api/JaxbListWrapper.java b/core/api/src/main/java/org/opennms/core/config/api/JaxbListWrapper.java index 72ec15b52fc4..494816ea2eff 100644 --- a/core/api/src/main/java/org/opennms/core/config/api/JaxbListWrapper.java +++ b/core/api/src/main/java/org/opennms/core/config/api/JaxbListWrapper.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2014-2017 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2017 The OpenNMS Group, Inc. + * Copyright (C) 2014-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -66,21 +66,25 @@ * } */ @XmlAccessorType(XmlAccessType.NONE) +@SuppressWarnings("java:S2162") public class JaxbListWrapper implements Serializable, Iterable { private static final long serialVersionUID = 1L; - private List m_objects = new ArrayList<>(); + private transient List m_objects = new ArrayList<>(); private Integer m_totalCount; private Integer m_offset = 0; public List getObjects() { return m_objects; - }; + } + public void setObjects(final List objects) { - if (objects == m_objects) return; + if (m_objects.equals(objects)) { + return; + } m_objects.clear(); m_objects.addAll(objects); - }; + } public JaxbListWrapper() {} public JaxbListWrapper(final Collection objects) { @@ -101,7 +105,7 @@ public boolean add(final T obj) { @XmlAttribute(name="count") public Integer getCount() { - if (m_objects.size() == 0) { + if (m_objects.isEmpty()) { return null; } else { return m_objects.size(); diff --git a/core/ipc/sink/kafka/server/src/main/java/org/opennms/core/ipc/sink/kafka/server/KafkaMessageConsumerManager.java b/core/ipc/sink/kafka/server/src/main/java/org/opennms/core/ipc/sink/kafka/server/KafkaMessageConsumerManager.java index a21b78e99ca3..eb8125317a93 100644 --- a/core/ipc/sink/kafka/server/src/main/java/org/opennms/core/ipc/sink/kafka/server/KafkaMessageConsumerManager.java +++ b/core/ipc/sink/kafka/server/src/main/java/org/opennms/core/ipc/sink/kafka/server/KafkaMessageConsumerManager.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2016 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2016 The OpenNMS Group, Inc. + * Copyright (C) 2016-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -33,6 +33,7 @@ import static org.opennms.core.ipc.common.kafka.KafkaSinkConstants.MESSAGEID_CACHE_CONFIG; import static org.opennms.core.ipc.sink.api.Message.SINK_METRIC_CONSUMER_DOMAIN; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -90,6 +91,7 @@ import io.opentracing.util.GlobalTracer; public class KafkaMessageConsumerManager extends AbstractMessageConsumerManager implements InitializingBean { + private static final Duration CONSUMER_POLL_DURATION = Duration.ofMillis(100); private static final Logger LOG = LoggerFactory.getLogger(KafkaMessageConsumerManager.class); @@ -160,7 +162,7 @@ public void run() { try { consumer.subscribe(Arrays.asList(topic)); while (!closed.get()) { - ConsumerRecords records = consumer.poll(100); + ConsumerRecords records = consumer.poll(CONSUMER_POLL_DURATION); for (ConsumerRecord record : records) { try { // Parse sink message content from protobuf. @@ -176,11 +178,13 @@ public void run() { continue; } // Avoid duplicate chunks. discard if chunk is repeated. - if(currentChunkCache.getIfPresent(messageId) == null) { + Integer chunkNum = currentChunkCache.getIfPresent(messageId); + if (chunkNum == null) { currentChunkCache.put(messageId, 0); + chunkNum = 0; } - Integer chunkNum = currentChunkCache.getIfPresent(messageId); - if(chunkNum != null && chunkNum == sinkMessage.getCurrentChunkNumber()) { + + if(chunkNum == sinkMessage.getCurrentChunkNumber()) { continue; } ByteString byteString = largeMessageCache.getIfPresent(messageId); diff --git a/core/mate/shell-commands/src/main/java/org/opennms/core/mate/commands/MetaCommand.java b/core/mate/shell-commands/src/main/java/org/opennms/core/mate/commands/MetaCommand.java index 83fde5fe897b..a1430c4892f5 100644 --- a/core/mate/shell-commands/src/main/java/org/opennms/core/mate/commands/MetaCommand.java +++ b/core/mate/shell-commands/src/main/java/org/opennms/core/mate/commands/MetaCommand.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2019 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2019 The OpenNMS Group, Inc. + * Copyright (C) 2019-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -55,7 +55,9 @@ @Command(scope = "opennms", name = "metadata-test", description = "Test Meta-Data replacement") @Service +@SuppressWarnings("java:S106") public class MetaCommand implements Action { + private static final String MATCHER = "^.*([pP]assword|[sS]ecret).*$"; @Reference private SessionUtils sessionUtils; @@ -78,17 +80,15 @@ public class MetaCommand implements Action { @Argument(index = 0, name = "expression", description = "Expression to use, e.g. '${context:key|fallback_context:fallback_key|default}'", required = false, multiValued = false) private String expression; - private final String MATCHER = ".*([pP]assword|[sS]ecret).*"; - void printScope(final Scope scope) { final Map> grouped = scope.keys().stream() .collect(Collectors.groupingBy(ContextKey::getContext, TreeMap::new, Collectors.toCollection(TreeSet::new))); for (final Map.Entry> group : grouped.entrySet()) { - System.out.printf("%s:\n", group.getKey()); + System.out.printf("%s:%n", group.getKey()); for (final ContextKey contextKey : group.getValue()) { final boolean omitOutput = (SecureCredentialsVaultScope.CONTEXT.equals(group.getKey()) && SecureCredentialsVaultScope.PASSWORD.equals(contextKey.getKey())) || contextKey.getKey().matches(MATCHER); - System.out.printf(" %s='%s'\n", contextKey.getKey(), scope.get(contextKey).map(r -> String.format("%s @ %s", omitOutput ? "" : r.value, r.scopeName)).orElse("")); + System.out.printf(" %s='%s'%n", contextKey.getKey(), scope.get(contextKey).map(r -> String.format("%s @ %s", omitOutput ? "" : r.value, r.scopeName)).orElse("")); } } } @@ -100,7 +100,7 @@ public Object execute() throws Exception { try { final OnmsNode onmsNode = this.nodeDao.get(this.nodeRef); if (onmsNode == null) { - System.out.printf("Cannot find node with ID/FS:FID=%s.\n", this.nodeRef); + System.out.printf("Cannot find node with ID/FS:FID=%s.%n", this.nodeRef); return null; } @@ -109,28 +109,28 @@ public Object execute() throws Exception { final Scope interfaceScope = this.entityScopeProvider.getScopeForInterface(onmsNode.getId(), this.interfaceAddress); final Scope serviceScope = this.entityScopeProvider.getScopeForService(onmsNode.getId(), InetAddressUtils.getInetAddress(this.interfaceAddress), this.serviceName); - System.out.printf("---\nMeta-Data for node (id=%d)\n", onmsNode.getId()); + System.out.printf("---%nMeta-Data for node (id=%d)%n", onmsNode.getId()); printScope(nodeScope); if (this.interfaceAddress != null) { - System.out.printf("---\nMeta-Data for interface (ipAddress=%s):\n", this.interfaceAddress); + System.out.printf("---%nMeta-Data for interface (ipAddress=%s):%n", this.interfaceAddress); printScope(interfaceScope); } if (this.serviceName != null) { - System.out.printf("---\nMeta-Data for service (name=%s):\n", this.serviceName); + System.out.printf("---%nMeta-Data for service (name=%s):%n", this.serviceName); printScope(serviceScope); } - System.out.printf("---\n"); + System.out.printf("---%n"); if (!Strings.isNullOrEmpty(this.expression)) { final Interpolator.Result result = Interpolator.interpolate(this.expression, new FallbackScope(nodeScope, interfaceScope, serviceScope)); - System.out.printf("Input: '%s'\nOutput: '%s'\n", this.expression, result.output); + System.out.printf("Input: '%s'%nOutput: '%s'%n", this.expression, result.output); - System.out.printf("Details:\n"); + System.out.printf("Details:%n"); for(final Interpolator.ResultPart resultPart : result.parts) { - System.out.printf(" Part: '%s' => match='%s', value='%s', scope='%s'\n", resultPart.input, resultPart.match, resultPart.value.value, resultPart.value.scopeName); + System.out.printf(" Part: '%s' => match='%s', value='%s', scope='%s'%n", resultPart.input, resultPart.match, resultPart.value.value, resultPart.value.scopeName); } } return null; diff --git a/core/test-api/snmp/src/main/java/org/opennms/core/test/snmp/JUnitSnmpAgentExecutionListener.java b/core/test-api/snmp/src/main/java/org/opennms/core/test/snmp/JUnitSnmpAgentExecutionListener.java index 89ea56a66af4..a2a57cd98670 100644 --- a/core/test-api/snmp/src/main/java/org/opennms/core/test/snmp/JUnitSnmpAgentExecutionListener.java +++ b/core/test-api/snmp/src/main/java/org/opennms/core/test/snmp/JUnitSnmpAgentExecutionListener.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2011-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2011-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -142,11 +142,11 @@ public void afterTestMethod(final TestContext testContext) throws Exception { } // Put the strategy class property back the way it was before the tests. - final String strategyClass = (String)testContext.getAttribute(STRATEGY_CLASS_KEY); + final Object strategyClass = testContext.getAttribute(STRATEGY_CLASS_KEY); if (strategyClass == null) { System.clearProperty(STRATEGY_CLASS_PROPERTY); } else { - System.setProperty(STRATEGY_CLASS_PROPERTY, strategyClass); + System.setProperty(STRATEGY_CLASS_PROPERTY, (String)strategyClass); } } diff --git a/features/config/upgrade/src/main/java/liquibase/ext2/cm/change/types/NumberType.java b/features/config/upgrade/src/main/java/liquibase/ext2/cm/change/types/NumberType.java index 39c384b4bb3e..9fe5d32cc17e 100644 --- a/features/config/upgrade/src/main/java/liquibase/ext2/cm/change/types/NumberType.java +++ b/features/config/upgrade/src/main/java/liquibase/ext2/cm/change/types/NumberType.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2021 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2021 The OpenNMS Group, Inc. + * Copyright (C) 2021-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -26,7 +26,6 @@ * http://www.opennms.com/ *******************************************************************************/ - package liquibase.ext2.cm.change.types; import java.util.List; @@ -60,11 +59,13 @@ public NumberType(final List listOfAttributes) { if (maxP < minP) { throw new IllegalArgumentException(String.format("min=%s must not be bigger than max=%s", minP, maxP)); } - if (min.isPresent() && defaultValue < minP) { - throw new IllegalArgumentException(String.format("defaultValue=%s must not be smaller than min=%s", defaultValue, min.get())); - } - if (max.isPresent() && defaultValue > maxP) { - throw new IllegalArgumentException(String.format("defaultValue=%s must not be bigger than max=%s", defaultValue, max.get())); + if (defaultValue != null) { + if (min.isPresent() && defaultValue < minP) { + throw new IllegalArgumentException(String.format("defaultValue=%s must not be smaller than min=%s", defaultValue, min.get())); + } + if (max.isPresent() && defaultValue > maxP) { + throw new IllegalArgumentException(String.format("defaultValue=%s must not be bigger than max=%s", defaultValue, max.get())); + } } } diff --git a/features/events/syslog/src/main/java/org/opennms/netmgt/syslogd/ParserStageSequenceBuilder.java b/features/events/syslog/src/main/java/org/opennms/netmgt/syslogd/ParserStageSequenceBuilder.java index 428ac90512cf..3b31f887be27 100644 --- a/features/events/syslog/src/main/java/org/opennms/netmgt/syslogd/ParserStageSequenceBuilder.java +++ b/features/events/syslog/src/main/java/org/opennms/netmgt/syslogd/ParserStageSequenceBuilder.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2016-2016 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2016 The OpenNMS Group, Inc. + * Copyright (C) 2016-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -1021,7 +1021,11 @@ public Integer getValue(ParserStageState state) { * @return */ public static int trimAndConvert(String value) { - boolean trimmed = false; + if (value == null) { + return 0; + } + + boolean trimmed = false; while (value.startsWith("0")) { value = value.substring(1); trimmed = true; @@ -1043,6 +1047,11 @@ public boolean equals(Object o) { return Objects.equals(m_resultConsumer, other.m_resultConsumer); } + @Override + public int hashCode() { + return Objects.hash(m_resultConsumer); + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) diff --git a/features/reporting/core/src/main/java/org/opennms/reporting/core/svclayer/support/DefaultReportServiceLocator.java b/features/reporting/core/src/main/java/org/opennms/reporting/core/svclayer/support/DefaultReportServiceLocator.java index d0f5f59c3ad7..ca63b4b1dc83 100644 --- a/features/reporting/core/src/main/java/org/opennms/reporting/core/svclayer/support/DefaultReportServiceLocator.java +++ b/features/reporting/core/src/main/java/org/opennms/reporting/core/svclayer/support/DefaultReportServiceLocator.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2007-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2007-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -33,6 +33,7 @@ import org.opennms.features.reporting.repository.global.GlobalReportRepository; import org.opennms.reporting.core.svclayer.ReportServiceLocator; import org.opennms.reporting.core.svclayer.ReportServiceLocatorException; +import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -49,14 +50,11 @@ public class DefaultReportServiceLocator implements ApplicationContextAware, Rep * {@inheritDoc} */ @Override - public ReportService getReportService(String reportServiceName) throws ReportServiceLocatorException { - - ReportService reportService = (ReportService) m_applicationContext.getBean(reportServiceName); - - if (reportService == null) { - throw new ReportServiceLocatorException("cannot locate report service bean: " + reportServiceName); - } else { - return reportService; + public ReportService getReportService(final String reportServiceName) throws ReportServiceLocatorException { + try { + return m_applicationContext.getBean(reportServiceName, ReportService.class); + } catch (final BeansException e) { + throw new ReportServiceLocatorException("cannot locate report service bean: " + reportServiceName, e); } } diff --git a/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/Netflow5UdpParser.java b/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/Netflow5UdpParser.java index 123315612d85..cda07c6c916f 100644 --- a/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/Netflow5UdpParser.java +++ b/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/Netflow5UdpParser.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2018-2018 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2018 The OpenNMS Group, Inc. + * Copyright (C) 2018-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -31,6 +31,7 @@ import static org.opennms.netmgt.telemetry.listeners.utils.BufferUtils.slice; import java.net.InetSocketAddress; +import java.time.Duration; import org.opennms.core.ipc.sink.api.AsyncDispatcher; import org.opennms.distributed.core.api.Identity; @@ -41,7 +42,6 @@ import org.opennms.netmgt.telemetry.listeners.utils.BufferUtils; import org.opennms.netmgt.telemetry.listeners.UdpParser; import org.opennms.netmgt.telemetry.protocols.netflow.parser.ie.RecordProvider; -import org.opennms.netmgt.telemetry.protocols.netflow.parser.ie.Value; import org.opennms.netmgt.telemetry.protocols.netflow.parser.netflow5.proto.Header; import org.opennms.netmgt.telemetry.protocols.netflow.parser.netflow5.proto.Packet; import org.opennms.netmgt.telemetry.protocols.netflow.parser.session.Session; @@ -79,7 +79,7 @@ protected RecordProvider parse(final Session session, final ByteBuf buffer) thro final Header header = new Header(slice(buffer, Header.SIZE)); final Packet packet = new Packet(header, buffer); - detectClockSkew(header.unixSecs * 1000L + header.unixNSecs / 1000L, session.getRemoteAddress()); + detectClockSkew(Duration.ofSeconds(header.unixSecs, header.unixNSecs).toMillis(), session.getRemoteAddress()); return packet; } diff --git a/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/MessageUtils.java b/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/MessageUtils.java index 00efb4fce2fa..6a802b3597fa 100644 --- a/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/MessageUtils.java +++ b/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/MessageUtils.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2020 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2020 The OpenNMS Group, Inc. + * Copyright (C) 2020-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -47,8 +47,7 @@ import com.google.protobuf.UInt32Value; import com.google.protobuf.UInt64Value; -public class MessageUtils { - +public interface MessageUtils { static Long getLongValue(Value value) { if (value instanceof UnsignedValue) { UnsignedLong unsignedValue = ((UnsignedValue) value).getValue(); @@ -82,6 +81,7 @@ static Instant getTime(Value value) { return null; } + @SafeVarargs public static Optional first(final V... values) { return Stream.of(values) .filter(Objects::nonNull) diff --git a/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/Netflow5MessageBuilder.java b/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/Netflow5MessageBuilder.java index 6ddc8218100f..ad7d9011fafd 100644 --- a/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/Netflow5MessageBuilder.java +++ b/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/Netflow5MessageBuilder.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2020 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2020 The OpenNMS Group, Inc. + * Copyright (C) 2020-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -38,6 +38,7 @@ import static org.opennms.netmgt.telemetry.protocols.netflow.parser.transport.MessageUtils.setLongValue; import java.net.InetAddress; +import java.time.Duration; import org.opennms.netmgt.telemetry.protocols.netflow.parser.RecordEnrichment; import org.opennms.netmgt.telemetry.protocols.netflow.parser.ie.Value; @@ -47,19 +48,15 @@ import org.opennms.netmgt.telemetry.protocols.netflow.transport.SamplingAlgorithm; public class Netflow5MessageBuilder implements MessageBuilder { - - public Netflow5MessageBuilder() { - } - @Override public FlowMessage.Builder buildMessage(final Iterable> values, final RecordEnrichment enrichment) { final FlowMessage.Builder builder = FlowMessage.newBuilder(); - Long unixSecs = null; - Long unixNSecs = null; - Long sysUpTime = null; - Long first = null; - Long last = null; + long unixSecs = 0; + long unixNSecs = 0; + long sysUpTime = 0; + long first = 0; + long last = 0; InetAddress srcAddr = null; InetAddress dstAddr = null; InetAddress nextHop = null; @@ -88,19 +85,7 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R getUInt32Value(value).ifPresent(builder::setEngineId); break; case "@samplingAlgorithm": - Long saValue = getLongValue(value); - SamplingAlgorithm samplingAlgorithm = SamplingAlgorithm.UNASSIGNED; - if (saValue != null) { - switch (saValue.intValue()) { - case 1: - samplingAlgorithm = SamplingAlgorithm.SYSTEMATIC_COUNT_BASED_SAMPLING; - break; - case 2: - samplingAlgorithm = SamplingAlgorithm.RANDOM_N_OUT_OF_N_SAMPLING; - break; - } - } - builder.setSamplingAlgorithm(samplingAlgorithm); + builder.setSamplingAlgorithm(getSamplingAlgorithm(value)); break; case "@samplingInterval": getDoubleValue(value).ifPresent(builder::setSamplingInterval); @@ -161,14 +146,16 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R getUInt32Value(value).ifPresent(builder::setDstMaskLen); break; case "egress": - Boolean egress = getBooleanValue(value); + boolean egress = getBooleanValue(value); Direction direction = egress ? Direction.EGRESS : Direction.INGRESS; builder.setDirection(direction); break; + default: + break; } } - long timeStamp = unixSecs * 1000L + unixNSecs / 1000_000L; + long timeStamp = Duration.ofSeconds(unixSecs, unixNSecs).toMillis(); long bootTime = timeStamp - sysUpTime; builder.setNetflowVersion(NetflowVersion.V5); @@ -191,4 +178,22 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R return builder; } + + private static SamplingAlgorithm getSamplingAlgorithm(final Value value) { + Long saValue = getLongValue(value); + SamplingAlgorithm samplingAlgorithm = SamplingAlgorithm.UNASSIGNED; + if (saValue != null) { + switch (saValue.intValue()) { + case 1: + samplingAlgorithm = SamplingAlgorithm.SYSTEMATIC_COUNT_BASED_SAMPLING; + break; + case 2: + samplingAlgorithm = SamplingAlgorithm.RANDOM_N_OUT_OF_N_SAMPLING; + break; + default: + break; + } + } + return samplingAlgorithm; + } } diff --git a/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/Netflow9MessageBuilder.java b/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/Netflow9MessageBuilder.java index 1f57a2482cb1..23615c697ddf 100644 --- a/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/Netflow9MessageBuilder.java +++ b/features/telemetry/protocols/netflow/parser/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/parser/transport/Netflow9MessageBuilder.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2020 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2020 The OpenNMS Group, Inc. + * Copyright (C) 2020-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -49,15 +49,13 @@ import com.google.protobuf.UInt32Value; +@SuppressWarnings("java:S109") public class Netflow9MessageBuilder implements MessageBuilder { private Long flowActiveTimeoutFallback; private Long flowInactiveTimeoutFallback; private Long flowSamplingIntervalFallback; - public Netflow9MessageBuilder() { - } - @Override public FlowMessage.Builder buildMessage(final Iterable> values, final RecordEnrichment enrichment) { final FlowMessage.Builder builder = FlowMessage.newBuilder(); @@ -79,8 +77,8 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R Long dstVlan = null; Long flowActiveTimeout = this.flowActiveTimeoutFallback; Long flowInActiveTimeout = this.flowInactiveTimeoutFallback; - Long sysUpTime = null; - Long unixSecs = null; + long sysUpTime = 0; + long unixSecs = 0; Long firstSwitched = null; Long lastSwitched = null; Long flowStartMilliseconds = null; @@ -94,7 +92,7 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R builder.setSamplingInterval(setDoubleValue(this.flowSamplingIntervalFallback)); } - for (Value value : values) { + for (final Value value : values) { switch (value.getName()) { // Header case "@recordCount": @@ -116,19 +114,7 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R getUInt64Value(value).ifPresent(builder::setNumBytes); break; case "DIRECTION": - Long directionValue = getLongValue(value); - Direction direction = Direction.UNKNOWN; - if (directionValue != null) { - switch (directionValue.intValue()) { - case 0: - direction = Direction.INGRESS; - break; - case 1: - direction = Direction.EGRESS; - break; - } - } - builder.setDirection(direction); + builder.setDirection(getDirection(value)); break; case "IPV4_DST_ADDR": ipv4DstAddress = getInetAddress(value); @@ -188,17 +174,7 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R getUInt32Value(value).ifPresent(builder::setProtocol); break; case "SAMPLING_ALGORITHM": - Long saValue = getLongValue(value); - SamplingAlgorithm samplingAlgorithm = SamplingAlgorithm.UNASSIGNED; - if (saValue != null) { - if (saValue.intValue() == 1) { - samplingAlgorithm = SamplingAlgorithm.SYSTEMATIC_COUNT_BASED_SAMPLING; - } - if (saValue.intValue() == 2) { - samplingAlgorithm = SamplingAlgorithm.RANDOM_N_OUT_OF_N_SAMPLING; - } - } - builder.setSamplingAlgorithm(samplingAlgorithm); + builder.setSamplingAlgorithm(getSamplingAlgorithm(value)); break; case "SAMPLING_INTERVAL": getDoubleValue(value).ifPresent(builder::setSamplingInterval); @@ -251,13 +227,15 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R case "egressPhysicalInterface": egressPhysicalInterface = getUInt32Value(value).orElse(null); break; + default: + break; } } - long timeStampInMsecs = unixSecs != null ? unixSecs * 1000 : 0; + long timeStampInMsecs = unixSecs * 1000; builder.setTimestamp(timeStampInMsecs); - long bootTime = sysUpTime != null ? timeStampInMsecs - sysUpTime : timeStampInMsecs; + long bootTime = timeStampInMsecs - sysUpTime; if (firstSwitched != null) { builder.setFirstSwitched(setLongValue(firstSwitched + bootTime)); @@ -277,18 +255,14 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R } // Set input interface - first(ingressPhysicalInterface, inputSnmp).ifPresent(ifIndex -> { - builder.setInputSnmpIfindex(ifIndex); - }); + first(ingressPhysicalInterface, inputSnmp).ifPresent(builder::setInputSnmpIfindex); // Set output interface - first(egressPhysicalInterface, outputSnmp).ifPresent(ifIndex -> { - builder.setOutputSnmpIfindex(ifIndex); - }); + first(egressPhysicalInterface, outputSnmp).ifPresent(builder::setOutputSnmpIfindex); // Set Destination address and host name. - first(ipv6DstAddress, ipv4DstAddress).ifPresent(inetAddress -> { + first(ipv6DstAddress, ipv4DstAddress).ifPresent((final InetAddress inetAddress) -> { enrichment.getHostnameFor(inetAddress).ifPresent(builder::setDstHostname); builder.setDstAddress(inetAddress.getHostAddress()); }); @@ -298,7 +272,7 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R builder.setDstMaskLen(setIntValue(dstMaskLen.intValue()))); // Set Source address and host name. - first(ipv6SrcAddress, ipv4SrcAddress).ifPresent(inetAddress -> { + first(ipv6SrcAddress, ipv4SrcAddress).ifPresent((final InetAddress inetAddress) -> { enrichment.getHostnameFor(inetAddress).ifPresent(builder::setSrcHostname); builder.setSrcAddress(inetAddress.getHostAddress()); }); @@ -306,7 +280,7 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R first(ipv6SrcMask, srcMask).ifPresent(srcMaskLen -> builder.setSrcMaskLen(setIntValue(srcMaskLen.intValue()))); // Set next hop address, hostname. - first(ipv6NextHop, ipv4NextHop, bgpIpv6NextHop, bgpIpv4NextHop).ifPresent(inetAddress -> { + first(ipv6NextHop, ipv4NextHop, bgpIpv6NextHop, bgpIpv4NextHop).ifPresent((final InetAddress inetAddress) -> { enrichment.getHostnameFor(inetAddress).ifPresent(builder::setNextHopHostname); builder.setNextHopAddress(inetAddress.getHostAddress()); }); @@ -326,6 +300,42 @@ public FlowMessage.Builder buildMessage(final Iterable> values, final R return builder; } + private static Direction getDirection(final Value value) { + Long directionValue = getLongValue(value); + Direction direction = Direction.UNKNOWN; + if (directionValue != null) { + switch (directionValue.intValue()) { + case 0: + direction = Direction.INGRESS; + break; + case 1: + direction = Direction.EGRESS; + break; + default: + break; + } + } + return direction; + } + + private static SamplingAlgorithm getSamplingAlgorithm(final Value value) { + Long saValue = getLongValue(value); + SamplingAlgorithm samplingAlgorithm = SamplingAlgorithm.UNASSIGNED; + if (saValue != null) { + switch(saValue.intValue()) { + case 1: + samplingAlgorithm = SamplingAlgorithm.SYSTEMATIC_COUNT_BASED_SAMPLING; + break; + case 2: + samplingAlgorithm = SamplingAlgorithm.RANDOM_N_OUT_OF_N_SAMPLING; + break; + default: + break; + } + } + return samplingAlgorithm; + } + public Long getFlowActiveTimeoutFallback() { return this.flowActiveTimeoutFallback; } diff --git a/features/telemetry/protocols/netflow/transport/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/transport/SamplingAlgorithm.java b/features/telemetry/protocols/netflow/transport/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/transport/SamplingAlgorithm.java index e285a9a20142..a77d0f203047 100644 --- a/features/telemetry/protocols/netflow/transport/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/transport/SamplingAlgorithm.java +++ b/features/telemetry/protocols/netflow/transport/src/main/java/org/opennms/netmgt/telemetry/protocols/netflow/transport/SamplingAlgorithm.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2020 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2020 The OpenNMS Group, Inc. + * Copyright (C) 2020-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsAcknowledgmentCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsAcknowledgmentCollection.java index e70f01d22cc8..56cbb3ecf523 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsAcknowledgmentCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsAcknowledgmentCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -48,6 +48,7 @@ public OnmsAcknowledgmentCollection(final Collection getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsAlarmCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsAlarmCollection.java index 434f9abea5ca..ca9b9054c174 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsAlarmCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsAlarmCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -48,6 +48,7 @@ public OnmsAlarmCollection(final Collection alarms) { super(alarms); } + @Override @XmlElement(name="alarm") @JsonProperty("alarm") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsCategoryCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsCategoryCollection.java index ad15b88c77a7..c920912e9347 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsCategoryCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsCategoryCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -48,13 +48,14 @@ public OnmsCategoryCollection(final Collection categorie super(categories); } + @Override @XmlElement(name="category") @JsonProperty("category") public List getObjects() { return super.getObjects(); } - public List getCategories() { + public List getCategories() { return getObjects(); } } diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsEventCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsEventCollection.java index 6afaab61e2d9..0fbc69d3c51e 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsEventCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsEventCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -49,6 +49,7 @@ public OnmsEventCollection(final Collection events) { super(events); } + @Override @XmlElement(name="event") @JsonProperty("event") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGroupList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGroupList.java index c9c35fdab745..2ca8b59f2d2c 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGroupList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGroupList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2011-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2011-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -51,6 +51,7 @@ public OnmsGroupList(final Collection groups) { super(groups); } + @Override @XmlElement(name="group") @JsonProperty("group") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsIpInterfaceList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsIpInterfaceList.java index 6ddc9b3789c5..45e94abe2376 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsIpInterfaceList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsIpInterfaceList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -51,6 +51,7 @@ public OnmsIpInterfaceList(final Collection iface) { super(iface); } + @Override @XmlElement(name="ipInterface") @JsonProperty("ipInterface") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsLocationAvailDefinitionList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsLocationAvailDefinitionList.java index ab273a57bc3c..cd2d9ba356d6 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsLocationAvailDefinitionList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsLocationAvailDefinitionList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2011-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2011-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -46,6 +46,7 @@ public OnmsLocationAvailDefinitionList(final Collection getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMetaDataList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMetaDataList.java index c4648c200a95..8c2c805cde24 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMetaDataList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMetaDataList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2019 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2019 The OpenNMS Group, Inc. + * Copyright (C) 2019-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -48,6 +48,7 @@ public OnmsMetaDataList(final Collection onmsNodeMetaDat super(onmsNodeMetaData); } + @Override @XmlElement(name="meta-data") @JsonProperty("metaData") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMinionCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMinionCollection.java index ce620d6b1141..feb18d532fc7 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMinionCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMinionCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2012-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2012-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -49,6 +49,7 @@ public OnmsMinionCollection(final Collection minion) { super(minion); } + @Override @XmlElement(name="minion") @JsonProperty("minion") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoredServiceDetailList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoredServiceDetailList.java index 7cc08cd888ab..2163fb04632c 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoredServiceDetailList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoredServiceDetailList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -48,6 +48,7 @@ public OnmsMonitoredServiceDetailList(final Collection getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoredServiceList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoredServiceList.java index dd166c05d789..ee3851ce1cfb 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoredServiceList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoredServiceList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -48,6 +48,7 @@ public OnmsMonitoredServiceList(final Collection super(services); } + @Override @XmlElement(name="service") @JsonProperty("service") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoringSystemCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoringSystemCollection.java index adb2769e6d00..2370789ea92d 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoringSystemCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsMonitoringSystemCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2012-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2012-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -50,6 +50,7 @@ public OnmsMonitoringSystemCollection(final Collection getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsNodeList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsNodeList.java index aa776984a4a1..5c5b2b0ac007 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsNodeList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsNodeList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -48,6 +48,7 @@ public OnmsNodeList(final Collection nodes) { super(nodes); } + @Override @XmlElement(name="node") @JsonProperty("node") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsNotificationCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsNotificationCollection.java index b47599efe008..6ddcffa0131c 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsNotificationCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsNotificationCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -48,6 +48,7 @@ public OnmsNotificationCollection(final Collection n super(notifications); } + @Override @XmlElement(name="notification") @JsonProperty("notification") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsOutageCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsOutageCollection.java index 1b5739e87c45..028d1e45542a 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsOutageCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsOutageCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -38,12 +38,6 @@ import org.codehaus.jackson.map.annotate.JsonRootName; import org.opennms.core.config.api.JaxbListWrapper; -/** - *

OnmsOutageCollection class.

- * - * @author ranger - * @version $Id: $ - */ @XmlRootElement(name="outages") @JsonRootName("outages") public class OnmsOutageCollection extends JaxbListWrapper { @@ -54,6 +48,7 @@ public OnmsOutageCollection(final Collection outages) { super(outages); } + @Override @XmlElement(name="outage") @JsonProperty("outage") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsSnmpInterfaceList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsSnmpInterfaceList.java index e78820bac517..444440064bc4 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsSnmpInterfaceList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsSnmpInterfaceList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -38,13 +38,6 @@ import org.codehaus.jackson.map.annotate.JsonRootName; import org.opennms.core.config.api.JaxbListWrapper; - -/** - *

OnmsSnmpInterfaceList class.

- * - * @author ranger - * @version $Id: $ - */ @XmlRootElement(name = "snmpInterfaces") @JsonRootName("snmpInterfaces") public class OnmsSnmpInterfaceList extends JaxbListWrapper { @@ -55,6 +48,7 @@ public OnmsSnmpInterfaceList(final Collection iface super(ifaces); } + @Override @XmlElement(name="snmpInterface") @JsonProperty("snmpInterface") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsUserList.java b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsUserList.java index 08d08122cdb0..4421901aff1d 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsUserList.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsUserList.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2008-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2008-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -53,6 +53,7 @@ public OnmsUserList(final Collection users) { @XmlElement(name="user") @JsonProperty("user") + @Override public List getObjects() { return super.getObjects(); } diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/alarm/AlarmSummaryCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/alarm/AlarmSummaryCollection.java index 5b6a41e19ca6..6b483d1ea7b1 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/alarm/AlarmSummaryCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/alarm/AlarmSummaryCollection.java @@ -51,6 +51,7 @@ public AlarmSummaryCollection(Collection alarmSummaries) } @XmlElement(name="alarm-summary") @JsonProperty("alarm-summary") + @Override public List getObjects() { return super.getObjects(); } diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/outage/OutageSummaryCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/outage/OutageSummaryCollection.java index 8a7d15ae3670..a603e68efe64 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/outage/OutageSummaryCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/outage/OutageSummaryCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2002-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2002-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -50,6 +50,7 @@ public OutageSummaryCollection(final Collection summari super(summaries); } + @Override @XmlElement(name="outage-summary") @JsonProperty("outage-summary") public List getObjects() { diff --git a/opennms-model/src/main/java/org/opennms/netmgt/model/resource/ResourceDTOCollection.java b/opennms-model/src/main/java/org/opennms/netmgt/model/resource/ResourceDTOCollection.java index 883b7a8393aa..3d6ce015c3a6 100644 --- a/opennms-model/src/main/java/org/opennms/netmgt/model/resource/ResourceDTOCollection.java +++ b/opennms-model/src/main/java/org/opennms/netmgt/model/resource/ResourceDTOCollection.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2015-2015 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2015 The OpenNMS Group, Inc. + * Copyright (C) 2015-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -34,6 +34,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import org.codehaus.jackson.annotate.JsonProperty; import org.opennms.core.config.api.JaxbListWrapper; @XmlRootElement(name = "resources") @@ -49,7 +50,9 @@ public ResourceDTOCollection(Collection resources) { super(resources); } + @Override @XmlElement(name = "resource") + @JsonProperty("resource") public List getObjects() { return super.getObjects(); } diff --git a/opennms-rrd/opennms-rrd-api/src/main/java/org/opennms/netmgt/rrd/RrdStrategyFactory.java b/opennms-rrd/opennms-rrd-api/src/main/java/org/opennms/netmgt/rrd/RrdStrategyFactory.java index 1b78644eca20..d0b745b222b9 100644 --- a/opennms-rrd/opennms-rrd-api/src/main/java/org/opennms/netmgt/rrd/RrdStrategyFactory.java +++ b/opennms-rrd/opennms-rrd-api/src/main/java/org/opennms/netmgt/rrd/RrdStrategyFactory.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2007-2015 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2015 The OpenNMS Group, Inc. + * Copyright (C) 2007-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -28,6 +28,7 @@ package org.opennms.netmgt.rrd; +import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -63,25 +64,25 @@ public void setApplicationContext(ApplicationContext context) { @SuppressWarnings("unchecked") public RrdStrategy getStrategy() { RrdStrategy rrdStrategy = null; - Boolean useQueue = (Boolean) m_context.getBean("useQueue"); - Boolean useTcp = (Boolean) m_context.getBean("useTcp"); + boolean useQueue = m_context.getBean("useQueue", Boolean.class); + boolean useTcp = m_context.getBean("useTcp", Boolean.class); - if (useQueue) { - if (useTcp) { - rrdStrategy = (RrdStrategy) m_context.getBean(StrategyName.tcpAndQueuingRrdStrategy.toString()); + try { + if (useQueue) { + if (useTcp) { + rrdStrategy = m_context.getBean(StrategyName.tcpAndQueuingRrdStrategy.toString(), RrdStrategy.class); + } else { + rrdStrategy = m_context.getBean(StrategyName.queuingRrdStrategy.toString(), RrdStrategy.class); + } } else { - rrdStrategy = (RrdStrategy) m_context.getBean(StrategyName.queuingRrdStrategy.toString()); + if (useTcp) { + rrdStrategy = m_context.getBean(StrategyName.tcpAndBasicRrdStrategy.toString(), RrdStrategy.class); + } else { + rrdStrategy = m_context.getBean(StrategyName.basicRrdStrategy.toString(), RrdStrategy.class); + } } - } else { - if (useTcp) { - rrdStrategy = (RrdStrategy) m_context.getBean(StrategyName.tcpAndBasicRrdStrategy.toString()); - } else { - rrdStrategy = (RrdStrategy) m_context.getBean(StrategyName.basicRrdStrategy.toString()); - } - } - - if (rrdStrategy == null) { - throw new IllegalStateException(String.format("Invalid RRD configuration useQueue: %s, useTcp: %s", useQueue, useTcp)); + } catch (final BeansException e) { + throw new IllegalStateException(String.format("Invalid RRD configuration useQueue: %s, useTcp: %s", useQueue, useTcp), e); } return rrdStrategy; diff --git a/opennms-web-api/src/main/java/org/opennms/web/category/Category.java b/opennms-web-api/src/main/java/org/opennms/web/category/Category.java index 85d7f9f64638..23a66641fa1b 100644 --- a/opennms-web-api/src/main/java/org/opennms/web/category/Category.java +++ b/opennms-web-api/src/main/java/org/opennms/web/category/Category.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2002-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2002-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -166,7 +166,8 @@ public String getName() { */ @XmlAttribute(name="normal-threshold") public double getNormalThreshold() { - return m_categoryDef == null? null : m_categoryDef.getNormalThreshold(); + final var ret = m_categoryDef == null? null : m_categoryDef.getNormalThreshold(); + return ret == null? 0 : ret; } /** @@ -178,7 +179,8 @@ public double getNormalThreshold() { */ @XmlAttribute(name="warning-threshold") public double getWarningThreshold() { - return m_categoryDef == null? null : m_categoryDef.getWarningThreshold(); + final var ret = m_categoryDef == null? null : m_categoryDef.getWarningThreshold(); + return ret == null? 0 : ret; } /** diff --git a/opennms-web-api/src/main/java/org/opennms/web/svclayer/support/PropertyUtils.java b/opennms-web-api/src/main/java/org/opennms/web/svclayer/support/PropertyUtils.java index cd97e2bd3d11..ef105ad66883 100644 --- a/opennms-web-api/src/main/java/org/opennms/web/svclayer/support/PropertyUtils.java +++ b/opennms-web-api/src/main/java/org/opennms/web/svclayer/support/PropertyUtils.java @@ -1,8 +1,8 @@ /******************************************************************************* * This file is part of OpenNMS(R). * - * Copyright (C) 2006-2014 The OpenNMS Group, Inc. - * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. + * Copyright (C) 2006-2023 The OpenNMS Group, Inc. + * OpenNMS(R) is Copyright (C) 1999-2023 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * @@ -37,18 +37,12 @@ import org.opennms.netmgt.model.OnmsSeverityEditor; import org.opennms.netmgt.model.PrimaryType; import org.opennms.netmgt.model.PrimaryTypeEditor; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanWrapper; +import org.springframework.beans.BeansException; import org.springframework.beans.PropertyAccessorFactory; -import org.springframework.util.Assert; -/** - *

BeanUtils class.

- * - * @author ranger - * @version $Id: $ - * @since 1.8.1 - */ -public abstract class PropertyUtils { +public interface PropertyUtils { /** *

getProperties

@@ -81,15 +75,15 @@ public static T getPathValue(final Object bean, final String path, final Cla wrapper.registerCustomEditor(java.net.InetAddress.class, new InetAddressTypeEditor()); wrapper.registerCustomEditor(OnmsSeverity.class, new OnmsSeverityEditor()); wrapper.registerCustomEditor(PrimaryType.class, new PrimaryTypeEditor()); - final Class propType = wrapper.getPropertyType(path); - if (propType == null) { - // we were unable to find the property - Assert.notNull(propType, "propType in BeanUtils is null path: " + path); //for debug purposes + try { + final Class propType = wrapper.getPropertyType(path); + if (!expectedClass.isAssignableFrom(propType)) { + throw new IllegalArgumentException("Could not retrieve property of type "+propType+" as type "+expectedClass); + } + } catch (final BeansException e) { + LoggerFactory.getLogger(PropertyUtils.class).warn("propType in BeanUtils is null for path: {}", path); return null; } - if (!expectedClass.isAssignableFrom(propType)) { - throw new IllegalArgumentException("Could not retrieve property of type "+propType+" as type "+expectedClass); - } return (T) wrapper.getPropertyValue(path); }