in src/main/java/org/apache/maven/plugins/jira/JiraHelper.java [104:143]
public static String getPidFromJira( Log log, String issueManagementUrl, HttpClient client )
{
String jiraId = null;
GetMethod gm = new GetMethod( issueManagementUrl );
String projectPage;
try
{
client.executeMethod( gm );
log.debug( "Successfully reached JIRA." );
projectPage = gm.getResponseBodyAsString();
}
catch ( Exception e )
{
if ( log.isDebugEnabled() )
{
log.error( "Unable to reach the JIRA project page:", e );
}
else
{
log.error( "Unable to reach the JIRA project page. Cause is: " + e.getLocalizedMessage() );
}
return null;
}
int pidIndex = projectPage.indexOf( PID );
if ( pidIndex == -1 )
{
log.error( "Unable to extract a JIRA pid from the page at the url " + issueManagementUrl );
}
else
{
NumberFormat nf = NumberFormat.getInstance();
Number pidNumber = nf.parse( projectPage, new ParsePosition( pidIndex + PID.length() ) );
jiraId = Integer.toString( pidNumber.intValue() );
log.debug( "Found the pid " + jiraId + " at " + issueManagementUrl );
}
return jiraId;
}