Skip to content

Commit

Permalink
Issue #11925 - Make error message "Base Resource should not be an ali…
Browse files Browse the repository at this point in the history
…as" more useful.
  • Loading branch information
joakime committed Jun 19, 2024
1 parent adb9f11 commit b70eb9c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,10 @@ public Resource resolve(String subUriPath)
return null;
return _resource.resolve(subUriPath);
}

@Override
public String toString()
{
return "(Maven) " + _resource.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,10 @@ public void copyTo(Path directory) throws IOException
}
}
}

@Override
public String toString()
{
return "(Selective Jar/Maven) " + _delegate.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,14 @@ protected void doStart() throws Exception
if (!Resources.isReadable(baseResource))
throw new IllegalArgumentException("Base Resource is not valid: " + baseResource);
if (baseResource.isAlias())
LOG.warn("Base Resource should not be an alias");
{
URI realUri = baseResource.getRealURI();
if (realUri == null)
LOG.warn("Base Resource should not be an alias (100% of requests to context are subject to Security/Alias Checks): {}", baseResource);
else
LOG.warn("Base Resource should not be an alias (100% of requests to context are subject to Security/Alias Checks): {} points to {}",
baseResource, realUri.toASCIIString());
}
}

_availability.set(Availability.STARTING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ public Collection<Resource> getAllResources()
@Override
public String toString()
{
return getName();
return "(Memory) " + _uri.toASCIIString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,13 @@ public boolean isSameFile(Path path)
}
return false;
}

public String toString()
{
String str = getName();
URI uri = getURI();
if (uri != null)
str = getURI().toASCIIString();
return "(" + this.getClass().getSimpleName() + ") " + str;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public URI getRealURI()
@Override
public String toString()
{
return String.format("URLResource@%X(%s)", this.uri.hashCode(), this.uri.toASCIIString());
return "(URL) " + this.uri.toASCIIString();
}

private static class InputStreamReference extends AtomicReference<InputStream> implements Runnable
Expand Down

0 comments on commit b70eb9c

Please sign in to comment.