You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 31, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 31, 2022. It is now read-only.
Duplicate contexts do not throw IllegalArgumentException [EXTERNAL ISSUE] #86
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
Duplicate contexts do not throw IllegalArgumentException. Issue is caused by HttpServer; this is not a SimpleHttpServer issue.
Expected Behavior
Explain what was supposed to happen
Duplicate contexts should throw IllegalArgumentException.
Steps To Reproduce
Explain how and/or when the error occurred
Use createContext on same context using HttpServer.
Multiple tests have been run against the #create method in the sun http server library; but the illargs exception is only thrown for specific contexts, not all. This is a dependency issue and can not be resolved by SimpleHttpServer
Activity
Fix #86
Unfixed #86
Katsute commentedon Aug 27, 2020
Multiple tests have been run against the
#createmethod in the sun http server library; but the illargs exception is only thrown for specific contexts, not all. This is a dependency issue and can not be resolved by SimpleHttpServerKatsute commentedon Sep 29, 2020
According to the source code an
IllegalArgumentExceptionis never thrown for duplicate contexts. The documentation on this method is invalid.sun.net.httpserver.ServerImpl... public synchronized HttpContextImpl createContext (String path, HttpHandler handler) { if (handler == null || path == null) { throw new NullPointerException ("null handler, or path parameter"); } HttpContextImpl context = new HttpContextImpl (protocol, path, handler, this); contexts.add (context); logger.log (Level.DEBUG, "context created: " + path); return context; } ...sun.net.httpserver.HttpContextImpl... HttpContextImpl (String protocol, String path, HttpHandler cb, ServerImpl server) { if (path == null || protocol == null || path.length() < 1 || path.charAt(0) != '/') { throw new IllegalArgumentException ("Illegal value for path or protocol"); } this.protocol = protocol.toLowerCase(); this.path = path; if (!this.protocol.equals ("http") && !this.protocol.equals ("https")) { throw new IllegalArgumentException ("Illegal value for protocol"); } this.handler = cb; this.server = server; authfilter = new AuthFilter(null); sfilters.add (authfilter); } ...