Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[leshan-dev] Possible NPE in DownlinkRequestSerDes class

Hi guys!

Seems that there is a small mistake in
leshan-server-cluster\src\main\java\org\eclipse\leshan\server\cluster\serialization\DownlinkRequestSerDes.java
class which can cause eaither wrong request deserialization or NPE error. I mean the code

            public void visit(ObserveRequest request) {
                o.add("kind", "observe");
                if (request.getFormat() == null)
                    o.add("contentFormat", request.getFormat().getCode());
            }

            public void visit(ReadRequest request) {
                o.add("kind", "read");
                if (request.getFormat() == null)
                    o.add("contentFormat", request.getFormat().getCode());
            }

As I understand in both cases should be

if (request.getFormat() != null)
instead of
if (request.getFormat() == null)

Best regards

Vitaliy

Back to the top