File tree Expand file tree Collapse file tree 2 files changed +2
-1
lines changed
src/main/java/top/offsetmonkey538/meshlib Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public interface HttpHandlerRegistry {
24
24
*
25
25
* @param id your handler or mod's id
26
26
* @param handler the {@link HttpHandler} to be registered
27
- * @throws IllegalArgumentException when the provided id is empty
27
+ * @throws IllegalArgumentException when the provided id is empty or a handler with this id is already registered
28
28
* @see HttpHandler
29
29
*/
30
30
void register (@ NotNull String id , @ NotNull HttpHandler handler ) throws IllegalArgumentException ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ public class HttpHandlerRegistryImpl implements HttpHandlerRegistry {
16
16
@ Override
17
17
public void register (@ NotNull String id , @ NotNull HttpHandler handler ) throws IllegalArgumentException {
18
18
if (id .isEmpty ()) throw new IllegalArgumentException ("Id may not be empty!" );
19
+ if (handlers .containsKey (id )) throw new IllegalArgumentException ("Handler with id '" + id + "' already registered!" );
19
20
20
21
handlers .put (id , handler );
21
22
}
You can’t perform that action at this time.
0 commit comments