Skip to content

Commit

Permalink
Fix NPE during ContextHandler.toString() on vhosts
Browse files Browse the repository at this point in the history
  • Loading branch information
joakime committed Jan 24, 2024
1 parent a1e0e04 commit d92230d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ public void removeVirtualHosts(String... virtualHosts)
@ManagedAttribute(value = "Virtual hosts accepted by the context", readonly = true)
public List<String> getVirtualHosts()
{
if (_vhosts == null)
return null;
return _vhosts.stream().map(VHost::getName).collect(Collectors.toList());
}

Expand Down Expand Up @@ -1040,7 +1042,7 @@ public String toString()
b.append(",b=").append(getBaseResource());
b.append(",a=").append(_availability.get());

if (!vhosts.isEmpty())
if (vhosts != null && !vhosts.isEmpty())
{
b.append(",vh=[");
b.append(String.join(",", vhosts));
Expand Down

0 comments on commit d92230d

Please sign in to comment.