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

Is ObserveRequest need payload #781

Closed
BruceZhangXL opened this issue Dec 20, 2019 · 5 comments
Closed

Is ObserveRequest need payload #781

BruceZhangXL opened this issue Dec 20, 2019 · 5 comments
Labels
question Any question about leshan

Comments

@BruceZhangXL
Copy link

BruceZhangXL commented Dec 20, 2019

lwM2mServer.getRegistrationService().addListener(new RegistrationListener() {
            @Override
            public void registered(Registration registration, Registration previousReg, Collection<Observation> previousObsersations) {
            ObserveRequest request = new ObserveRequest(CHANNEL_ID, 0, 0);
                        lwM2mServer.send(registration, request,lifeTimeInMillSec, observeResponse ...);
    }
}

I send ObserveRequest to the client,but exception throwed like this

java.lang.IllegalArgumentException: The validated object is null
        at org.eclipse.leshan.util.Validate.notNull(Validate.java:222)
        at org.eclipse.leshan.util.Validate.notNull(Validate.java:205)
        at org.eclipse.leshan.core.node.LwM2mSingleResource.<init>(LwM2mSingleResource.java:38)
        at org.eclipse.leshan.core.node.LwM2mSingleResource.newBinaryResource(LwM2mSingleResource.java:106)

code in class CoapRequestBuilder , no set payload

   @Override
    public void visit(ObserveRequest request) {
        coapRequest = Request.newGet();
        if (request.getContentFormat() != null)
            coapRequest.getOptions().setAccept(request.getContentFormat().getCode());
        coapRequest.setObserve();
        setTarget(coapRequest, request.getPath());

        // add context info to the observe request
        coapRequest.setUserContext(ObserveUtil.createCoapObserveRequestContext(endpoint, registrationId, request));
    }

Whether a problem?

@sbernard31
Copy link
Contributor

It seems that the binary value returned by the device is null... 🕵️‍♂️
is it the expected behavior ? I mean : does the resource /CHANNEL_ID/0/0 is equals to null or an empty byte array at device side ?

Maybe we do not support this correctly, I will check this one my side.

I suspect the stacktrace is not complete, could you please share the full error stacktrace ?

(By the way I have doubt that this error was raised in CoapRequestBuilder 🤔 ...)

@sbernard31 sbernard31 added the question Any question about leshan label Dec 30, 2019
@sbernard31
Copy link
Contributor

(If you have a wireshark capture this could help too)

@sbernard31
Copy link
Contributor

I pushed a commit (d44a562) which should fix an issue with empty value when using OPAQUE content format.
I'm not sure this is directly link to your issue.

@sbernard31
Copy link
Contributor

sbernard31 commented Jan 6, 2020

Should it fixed your issue ? could we close this one ?

@sbernard31
Copy link
Contributor

Do not hesitate to reopen if the issue is still here.

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

No branches or pull requests

2 participants