PR: MNG-903

fix another JDK 5 only method

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@293255 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-03 05:27:52 +00:00
parent f36a813594
commit f1db00f372
1 changed files with 24 additions and 24 deletions

View File

@ -333,41 +333,41 @@ public class LicenseReport
private static String replaceParts( String html, String baseURL, String serverURL, String tagPattern,
String attributePattern )
{
Pattern anchor = Pattern
.compile( "(<\\s*" + tagPattern + "\\s+[^>]*" + attributePattern + "\\s*=\\s*\")([^\"]*)\"([^>]*>)" );
Pattern anchor = Pattern.compile(
"(<\\s*" + tagPattern + "\\s+[^>]*" + attributePattern + "\\s*=\\s*\")([^\"]*)\"([^>]*>)" );
StringBuffer sb = new StringBuffer( html );
int indx = 0;
do
boolean done = false;
while ( !done )
{
Matcher mAnchor = anchor.matcher( sb );
mAnchor.region( indx, sb.length() );
if ( !mAnchor.find() )
if ( mAnchor.find( indx ) )
{
System.err.println( "No more matches" );
break; // no more matches
}
indx = mAnchor.end( 3 );
indx = mAnchor.end( 3 );
if ( mAnchor.group( 2 ).startsWith( "#" ) )
{
// relative link - don't want to alter this one!
if ( mAnchor.group( 2 ).startsWith( "#" ) )
{
// relative link - don't want to alter this one!
}
if ( mAnchor.group( 2 ).startsWith( "/" ) )
{
// root link
sb.insert( mAnchor.start( 2 ), serverURL );
indx += serverURL.length();
}
else if ( mAnchor.group( 2 ).indexOf( ':' ) < 0 )
{
// relative link
sb.insert( mAnchor.start( 2 ), baseURL );
indx += baseURL.length();
}
}
if ( mAnchor.group( 2 ).startsWith( "/" ) )
else
{
// root link
sb.insert( mAnchor.start( 2 ), serverURL );
indx += serverURL.length();
}
else if ( mAnchor.group( 2 ).indexOf( ':' ) < 0 )
{
// relative link
sb.insert( mAnchor.start( 2 ), baseURL );
indx += baseURL.length();
done = true;
}
}
while ( true );
return sb.toString();
}