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,21 +333,17 @@ public class LicenseReport
private static String replaceParts( String html, String baseURL, String serverURL, String tagPattern, private static String replaceParts( String html, String baseURL, String serverURL, String tagPattern,
String attributePattern ) String attributePattern )
{ {
Pattern anchor = Pattern Pattern anchor = Pattern.compile(
.compile( "(<\\s*" + tagPattern + "\\s+[^>]*" + attributePattern + "\\s*=\\s*\")([^\"]*)\"([^>]*>)" ); "(<\\s*" + tagPattern + "\\s+[^>]*" + attributePattern + "\\s*=\\s*\")([^\"]*)\"([^>]*>)" );
StringBuffer sb = new StringBuffer( html ); StringBuffer sb = new StringBuffer( html );
int indx = 0; int indx = 0;
do boolean done = false;
while ( !done )
{ {
Matcher mAnchor = anchor.matcher( sb ); Matcher mAnchor = anchor.matcher( sb );
mAnchor.region( indx, sb.length() ); if ( mAnchor.find( indx ) )
if ( !mAnchor.find() )
{ {
System.err.println( "No more matches" );
break; // no more matches
}
indx = mAnchor.end( 3 ); indx = mAnchor.end( 3 );
if ( mAnchor.group( 2 ).startsWith( "#" ) ) if ( mAnchor.group( 2 ).startsWith( "#" ) )
@ -367,7 +363,11 @@ public class LicenseReport
indx += baseURL.length(); indx += baseURL.length();
} }
} }
while ( true ); else
{
done = true;
}
}
return sb.toString(); return sb.toString();
} }