You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/07/19 12:17:41 UTC

[1/2] camel git commit: CAMEL-11559: Work around a NPE in milo 0.1.3

Repository: camel
Updated Branches:
  refs/heads/camel-2.19.x 9c9aa099e -> 1a692127f
  refs/heads/master b710a0790 -> 431c3198d


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 <jr...@redhat.com>

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

Branch: refs/heads/camel-2.19.x
Commit: 1a692127f54990e72dcbf1d56f83b0e3cb9df20e
Parents: 9c9aa09
Author: Jens Reimann <jr...@redhat.com>
Authored: Wed Jul 19 10:21:33 2017 +0200
Committer: Jens Reimann <jr...@redhat.com>
Committed: Wed Jul 19 10:31:15 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/1a692127/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));
                 }
             }


[2/2] camel git commit: CAMEL-11559: Work around a NPE in milo 0.1.3

Posted by da...@apache.org.
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 <jr...@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 <jr...@redhat.com>
Authored: Wed Jul 19 10:21:33 2017 +0200
Committer: Claus Ibsen <da...@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));
                 }
             }