Add a warning for all moves (temporary or not)

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@390276 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier
2006-03-30 23:11:50 +00:00
parent 70ad9ee73a
commit f392e3f8ad

View File

@@ -138,7 +138,10 @@ public final class OnlineHTTPLinkValidator
}
else
{
if ( hm.getStatusCode() == HttpStatus.SC_MOVED_PERMANENTLY )
// If there's a redirection ... add a warning
if ( hm.getStatusCode() == HttpStatus.SC_MOVED_PERMANENTLY
|| hm.getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY
|| hm.getStatusCode() == HttpStatus.SC_TEMPORARY_REDIRECT )
{
LOG.warn( "Received: [" + hm.getStatusCode() + "] for [" + lvi.getLink() + "] in page ["
+ lvi.getSource() + "]" );
@@ -264,11 +267,11 @@ public final class OnlineHTTPLinkValidator
}
HttpMethod oldHm = hm;
LOG.info( "[" + link + "] is redirected to [" + newLink + "]" );
hm.releaseConnection();
oldHm.releaseConnection();
hm = checkLink( cl, newLink, nbRedirect + 1 );
// Restore the hm to "Moved permanently" if the new location is found to allow us to report it
if ( oldHm.getStatusCode() == HttpStatus.SC_MOVED_PERMANENTLY
&& hm.getStatusCode() == HttpStatus.SC_OK )
// Restore the hm to "Moved permanently" | "Moved temporarily" | "Temporary redirect"
// if the new location is found to allow us to report it
if ( hm.getStatusCode() == HttpStatus.SC_OK && nbRedirect == 0)
{
return oldHm;
}