Ktt-Development/simplehttpserver

Can not remove extended HttpContext contexts [EXTERNAL ISSUE]

Katsute opened this issue · 1 comments

Prerequisites

If all checks are not passed then the issue will be closed

  • I have checked that no other similar issue already exists

Operating System: Operating system name and version
Windows 10

Release Version: Release version or branch where the issue occurred
03.05.06

Issue

Explain your issue. Add any screenshots here
HttpServer can not remove HttpContexts that don't extend HttpContextImpl. This is a clear design flaw for a non-final class.

This issue is caused by HttpServer and is not a SimpleHttpServer issue.

Expected Behavior

Explain what was supposed to happen
HttpServer should be able to remove HttpContexts that don't extend HttpContextImpl

Steps To Reproduce

Explain how and/or when the error occurred
Remove context using extended HttpContext.

sun.net.httpserver.ServerImpl

...
    public synchronized void removeContext (HttpContext context) throws IllegalArgumentException {
        if (!(context instanceof HttpContextImpl)) {
                                        ^ here
            throw new IllegalArgumentException ("wrong HttpContext type");
        }
        contexts.remove ((HttpContextImpl)context);
        logger.log (Level.DEBUG, "context removed: " + context.getPath());
    }
...