camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-11559: Work around a NPE in milo 0.1.3
Date Wed, 19 Jul 2017 12:17:42 GMT
CAMEL-11559: Work around a NPE in milo 0.1.3

When the sampling interval is unset in the Camel component, then it is
passed to milo as 'null'. Which is acceptable to the milo API, however
internally milo automatically unboxes the value from 'Double' to
'double' and may run into a NPE by doing so.

This patch assures that, although theoretically acceptable,
'null' is never passed in to the Milo API.

Signed-off-by: Jens Reimann <jreimann@redhat.com>

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/431c3198
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/431c3198
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/431c3198

Branch: refs/heads/master
Commit: 431c3198d1eaa7ef81e1b3331d3822b7efd8e8a3
Parents: b710a07
Author: Jens Reimann <jreimann@redhat.com>
Authored: Wed Jul 19 10:21:33 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 19 14:17:32 2017 +0200

----------------------------------------------------------------------
 .../component/milo/client/internal/SubscriptionManager.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/431c3198/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
index 7502164..877bf08 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
@@ -174,7 +174,12 @@ public class SubscriptionManager {
                 } else {
                     final NodeId nodeId = s.getPartialNodeId().toNodeId(namespaceIndex);
                     final ReadValueId itemId = new ReadValueId(nodeId, AttributeId.Value.uid(),
null, QualifiedName.NULL_VALUE);
-                    final MonitoringParameters parameters = new MonitoringParameters(entry.getKey(),
s.getSamplingInterval(), null, null, null);
+                    Double samplingInterval = s.getSamplingInterval();
+                    if (samplingInterval == null) {
+                        // work around a bug (NPE) in Eclipse Milo 0.1.3
+                        samplingInterval = 0.0;
+                    }
+                    final MonitoringParameters parameters = new MonitoringParameters(entry.getKey(),
samplingInterval, null, null, null);
                     items.add(new MonitoredItemCreateRequest(itemId, MonitoringMode.Reporting,
parameters));
                 }
             }


Mime
View raw message