Skip to content

Commit

Permalink
Fix problem with redundant Optional and return immutable set in WebSo…
Browse files Browse the repository at this point in the history
…cketApplication.
  • Loading branch information
spericas committed Jan 10, 2023
1 parent d4f44a9 commit dfa8657
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.helidon.microprofile.tyrus;

import java.util.Collections;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
Expand Down Expand Up @@ -63,10 +64,10 @@ public Optional<Class<? extends ServerApplicationConfig>> applicationClass() {
/**
* Get access to all application classes. Possibly an empty set.
*
* @return Set of application classes.
* @return Immutable set of application classes.
*/
public Set<Class<? extends ServerApplicationConfig>> applicationClasses() {
return applicationClasses;
return Collections.unmodifiableSet(applicationClasses);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,8 @@ private void registerWebSockets() {

if (appClasses.isEmpty()) {
// Direct registration without calling application class
Optional<String> contextRoot = Optional.empty();
String rootPath = contextRoot.orElse(DEFAULT_WEBSOCKET_PATH);
app.annotatedEndpoints().forEach(aClass -> wsRoutingBuilder.endpoint(rootPath, aClass));
app.programmaticEndpoints().forEach(wsCfg -> wsRoutingBuilder.endpoint(rootPath, wsCfg));
app.annotatedEndpoints().forEach(aClass -> wsRoutingBuilder.endpoint(DEFAULT_WEBSOCKET_PATH, aClass));
app.programmaticEndpoints().forEach(wsCfg -> wsRoutingBuilder.endpoint(DEFAULT_WEBSOCKET_PATH, wsCfg));
app.extensions().forEach(wsRoutingBuilder::extension);

// Create routing wsRoutingBuilder
Expand Down

0 comments on commit dfa8657

Please sign in to comment.