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

setting a payload metric to null should throw an exception immediately #451

Closed
pstanton opened this issue Aug 11, 2016 · 1 comment · Fixed by #505
Closed

setting a payload metric to null should throw an exception immediately #451

pstanton opened this issue Aug 11, 2016 · 1 comment · Fixed by #505

Comments

@pstanton
Copy link

If you set a metric to null:

KuraPayload.addMetric("xyz", null);

The payload is a ticking time bomb and will throw an exception when it is encoded later:

org.eclipse.kura.KuraInvalidMetricTypeException: Metric null value is invalid.
        at org.eclipse.kura.core.cloud.CloudPayloadProtoBufEncoderImpl.setProtoKuraMetricValue(CloudPayloadProtoBufEncoderImpl.java:166)
        at org.eclipse.kura.core.cloud.CloudPayloadProtoBufEncoderImpl.getBytes(CloudPayloadProtoBufEncoderImpl.java:66)

It should either:
a) be skipped when encoding later (ignored)
b) throw an exception on the 'addMetric' call

@cdealti
Copy link
Contributor

cdealti commented Aug 11, 2016

@pstanton thanks. Maybe a) would be the preferred option. Option b) would require an unchecked exception for API backward compatibility and these exceptions are dangerous.

Are you going to submit a pull request?

Ciao,
Cristiano

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants