Skip to content
This repository was archived by the owner on Feb 27, 2018. It is now read-only.
This repository was archived by the owner on Feb 27, 2018. It is now read-only.

Attempted to read from closed stream exception #18

@mwiley63

Description

@mwiley63

Excellent project! I was able to integrate this library with a fresh Firebase project in less than 2 hours, and my Java backend was sending push notifications!

While the notification is still sent, on version 0.9, I get an exception when calling FCMClient.send() function (this exception does not appear on 0.8).

Here is the code that triggers the exception (IFCMClientSettings & PersonData are copied from the readme):

IFcmClientSettings clientSettings = new FixedFcmClientSettings("XXXXX");
// Create the Client using system-properties-based settings:
FcmClient client = new FcmClient(clientSettings);
// Message Options:
FcmMessageOptions options = FcmMessageOptions.builder().build();
NotificationPayload np = NotificationPayload.builder().setTitle("Hello world").setBody("AAbA").build();
// Send a Message:
List<String> ids = new ArrayList<String>();
ids.add("XXXXXX");
client.send(new DataMulticastMessage(options, ids, new PersonData("John", "Smith"), np));

Note, I get the same exception when using NotificationMutlicast and TopicMutlicast as well.

The relevant stack trace:

 Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Attempted read from closed stream.
at de.bytefish.fcmjava.client.http.HttpClient.post(HttpClient.java:63)
at de.bytefish.fcmjava.client.FcmClient.post(FcmClient.java:99)
at de.bytefish.fcmjava.client.FcmClient.send(FcmClient.java:55)

A side question: should I opt for 0.8 over 0.9? What bugs were fixed with 0.9? I could not find a changelog.

Thanks for the excellent code, cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions