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

NPE when passing incorrect MUC service name #74

Closed
Fishbowler opened this issue Jan 1, 2022 · 0 comments · Fixed by #101
Closed

NPE when passing incorrect MUC service name #74

Fishbowler opened this issue Jan 1, 2022 · 0 comments · Fixed by #101

Comments

@Fishbowler
Copy link
Member

Example:
/v1/chatrooms/myroomname?servicename=invalid will return an HTTP/500 and put some errors in the logs

2022.01.01 21:37:53 INFO [Jetty-QTP-AdminConsole-183]: org.jivesoftware.openfire.plugin.rest.controller.MUCRoomController - Get the chat room: test999
2022.01.01 21:37:53 ERROR [Jetty-QTP-AdminConsole-183]: org.jivesoftware.openfire.container.PluginServlet - null
java.lang.NullPointerException: null
    at org.jivesoftware.openfire.plugin.rest.controller.MUCRoomController.getChatRoom(MUCRoomController.java:101) ~[?:?]
    at org.jivesoftware.openfire.plugin.rest.service.MUCRoomService.getMUCRoomJSON2(MUCRoomService.java:38) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

Looks to be this unsafe method chaining
https://github.com/igniterealtime/openfire-restAPI-plugin/blob/01cf5bd/src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCRoomController.java#L114-L115

I'm not sure whether this should return HTTP/404 because the service isn't found or HTTP/400 because a valid service name wasn't provided.

guusdk added a commit to guusdk/openfire-restAPI-plugin that referenced this issue May 11, 2022
…ences

When requests are made against MUC services or rooms that do not exist (but are expected to), then the old implementation would return a HTTP 500 "Internal Server Error" response.

This commit explicitly checks if the MUC service/room that is used in the request exist, and return HTTP 404 "Not Found" when that's not the case.

I've also included more annotations that will cause Swagger to generate a more complete list of errors that are returned for MUC services.

this fixes igniterealtime#74
guusdk added a commit that referenced this issue May 30, 2022
…ences

When requests are made against MUC services or rooms that do not exist (but are expected to), then the old implementation would return a HTTP 500 "Internal Server Error" response.

This commit explicitly checks if the MUC service/room that is used in the request exist, and return HTTP 404 "Not Found" when that's not the case.

I've also included more annotations that will cause Swagger to generate a more complete list of errors that are returned for MUC services.

this fixes #74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant