SessionReader does not explicitly catch MissingParameterException leading to meaningless INTERNAL_ERROR response #46

Closed
opened 2026-04-02 13:32:51 +02:00 by lars.winzer · 8 comments
lars.winzer commented 2026-04-02 13:32:51 +02:00 (Migrated from git.scicore.unibas.ch)

Bug Report

Environment

  • Branch & Commit: 07587340d4
  • Others are not applicable

Summary

The SessionReader does not handle the MissingParameterException, while the CommandParser has no way to do so.

Expected Behavior

The SessionReader should catch this exception and respond with an ErrorResponse .

Actual Behavior

The Exception is unhandled and an ErrorResponse with the INTERNAL_ERROR code is sent to the client. Information about why the error occured is herby lost.

Steps to Reproduce

  1. Checkout 07587340d4
  2. Start the server
  3. Send an CHECK_USERNAME request to the server missing the USERNAME parameter
  4. Observe the recieved INTERNAL_ERROR response and the trace in the server log

Stack Trace / Error Message

Unexpected RuntimeException occured
ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.MissingParameterException: Required parameter with key 'USERNAME' is missing.
        at ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.RequestParameterAccessor.require(RequestParameterAccessor.java:40)
        at ch.unibas.dmi.dbis.cs108.casono.server.app.commands.check_nick.CheckUsernameParser.parse(CheckUsernameParser.java:11)
        at ch.unibas.dmi.dbis.cs108.casono.server.app.commands.check_nick.CheckUsernameParser.parse(CheckUsernameParser.java:1)
        at ch.unibas.dmi.dbis.cs108.casono.server.network.command.parsing.CommandParserDispatcher.parse(CommandParserDispatcher.java:36)
        at ch.unibas.dmi.dbis.cs108.casono.server.network.sessions.SessionReader.run(SessionReader.java:68)
        at java.base/java.lang.VirtualThread.run(VirtualThread.java:456)

Possible Cause / Notes

Checklist

  • I reproduced the problem using the steps above
  • I searched documentation for relevant information
  • I added relevant labels
## Bug Report <!--The reccommended type is: Issue--> ### Environment - **Branch & Commit:** 07587340d411c2f59a2c91d98400e837079dffcb - Others are not applicable ### Summary The SessionReader does not handle the `MissingParameterException`, while the `CommandParser` has no way to do so. ### Expected Behavior The SessionReader should catch this exception and respond with an `ErrorResponse` . ### Actual Behavior The Exception is unhandled and an `ErrorResponse` with the `INTERNAL_ERROR` code is sent to the client. Information about why the error occured is herby lost. ### Steps to Reproduce 1. Checkout 07587340d411c2f59a2c91d98400e837079dffcb 2. Start the server 3. Send an `CHECK_USERNAME` request to the server missing the `USERNAME` parameter 4. Observe the recieved `INTERNAL_ERROR` response and the trace in the server log ### Stack Trace / Error Message ``` Unexpected RuntimeException occured ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.MissingParameterException: Required parameter with key 'USERNAME' is missing. at ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.RequestParameterAccessor.require(RequestParameterAccessor.java:40) at ch.unibas.dmi.dbis.cs108.casono.server.app.commands.check_nick.CheckUsernameParser.parse(CheckUsernameParser.java:11) at ch.unibas.dmi.dbis.cs108.casono.server.app.commands.check_nick.CheckUsernameParser.parse(CheckUsernameParser.java:1) at ch.unibas.dmi.dbis.cs108.casono.server.network.command.parsing.CommandParserDispatcher.parse(CommandParserDispatcher.java:36) at ch.unibas.dmi.dbis.cs108.casono.server.network.sessions.SessionReader.run(SessionReader.java:68) at java.base/java.lang.VirtualThread.run(VirtualThread.java:456) ``` ### Possible Cause / Notes <!--Optional: your own hypothesis about the root cause--> ### Checklist - [x] I reproduced the problem using the steps above - [x] I searched documentation for relevant information - [x] I added relevant labels
lars.winzer commented 2026-04-02 13:33:20 +02:00 (Migrated from git.scicore.unibas.ch)

This issue was discovered while implementing the CHECK_USERNAME request in #39

This issue was discovered while implementing the `CHECK_USERNAME` request in #39
lars.winzer commented 2026-04-02 13:33:58 +02:00 (Migrated from git.scicore.unibas.ch)

created branch fix/46-sessionreader-catch-missingparameterexception to address this issue

created branch [`fix/46-sessionreader-catch-missingparameterexception`](/cs108-fs26/Gruppe-13/-/compare/main...fix%2F46-sessionreader-catch-missingparameterexception) to address this issue
lars.winzer commented 2026-04-02 13:34:00 +02:00 (Migrated from git.scicore.unibas.ch)

assigned to @lars.winzer

assigned to @lars.winzer
lars.winzer commented 2026-04-02 13:47:05 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in merge request !73

mentioned in merge request !73
lars.winzer commented 2026-04-02 13:48:27 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in commit 95e3474c8c

mentioned in commit 95e3474c8c1087a804d9b213b57d49eaee248489
lars.winzer (Migrated from git.scicore.unibas.ch) closed this issue 2026-04-02 13:48:28 +02:00
lars.winzer commented 2026-04-02 13:48:58 +02:00 (Migrated from git.scicore.unibas.ch)

added 8m of time spent at 2026-04-02 12:00:00 +0200

added 8m of time spent at 2026-04-02 12:00:00 +0200
lars.winzer commented 2026-04-02 13:49:20 +02:00 (Migrated from git.scicore.unibas.ch)

changed the description

changed the description
lars.winzer commented 2026-04-02 15:09:07 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in merge request !75

mentioned in merge request !75
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: University-of-Basel-Studentprojects/Programmierprojekt#46