use a static logger

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@369113 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier 2006-01-14 23:15:14 +00:00
parent 838f2129a8
commit 18c27b8a23

View File

@ -55,7 +55,7 @@ public final class JiraDownloader
/** /**
* Log for debug output. * Log for debug output.
*/ */
private static Log log = LogFactory.getLog( JiraDownloader.class ); private static final Log LOG = LogFactory.getLog( JiraDownloader.class );
/** Mapping containing all JIRA status values. */ /** Mapping containing all JIRA status values. */
private static Map statusMap = new HashMap(); private static Map statusMap = new HashMap();
@ -109,16 +109,16 @@ public final class JiraDownloader
/** The component to show. */ /** The component to show. */
private String component; private String component;
/** The username to log into JIRA. */ /** The username to LOG into JIRA. */
private String jiraUser; private String jiraUser;
/** The password to log into JIRA. */ /** The password to LOG into JIRA. */
private String jiraPassword; private String jiraPassword;
/** The username to log into webserver. */ /** The username to LOG into webserver. */
private String webUser; private String webUser;
/** The password to log into webserver. */ /** The password to LOG into webserver. */
private String webPassword; private String webPassword;
/** The maven project. */ /** The maven project. */
@ -268,7 +268,7 @@ public final class JiraDownloader
jiraUrl = jiraUrl.substring( 0, jiraUrl.lastIndexOf( "/" ) ); jiraUrl = jiraUrl.substring( 0, jiraUrl.lastIndexOf( "/" ) );
} }
log.info( "Jira lives at: " + jiraUrl ); LOG.info( "Jira lives at: " + jiraUrl );
doAuthentication( cl, jiraUrl ); doAuthentication( cl, jiraUrl );
String projectPage = ""; String projectPage = "";
@ -282,17 +282,17 @@ public final class JiraDownloader
try try
{ {
cl.executeMethod( gm ); cl.executeMethod( gm );
log.info( "Succesfully reached JIRA." ); LOG.info( "Succesfully reached JIRA." );
} }
catch ( Exception e ) catch ( Exception e )
{ {
if ( log.isDebugEnabled() ) if ( LOG.isDebugEnabled() )
{ {
log.error( "Unable to reach JIRA project page:", e ); LOG.error( "Unable to reach JIRA project page:", e );
} }
else else
{ {
log.error( LOG.error(
"Unable to reach JIRA project page. Cause is: " "Unable to reach JIRA project page. Cause is: "
+ e.getLocalizedMessage() ); + e.getLocalizedMessage() );
} }
@ -303,7 +303,7 @@ public final class JiraDownloader
if ( id == null ) if ( id == null )
{ {
log.info( "Jira URL " + url LOG.info( "Jira URL " + url
+ " doesn't include a pid, trying to get it" ); + " doesn't include a pid, trying to get it" );
int pidIndex = projectPage.indexOf( "pid=" ); // @todo, a safer way to get the PID int pidIndex = projectPage.indexOf( "pid=" ); // @todo, a safer way to get the PID
@ -311,7 +311,7 @@ public final class JiraDownloader
if ( pidIndex == -1 ) if ( pidIndex == -1 )
{ {
// fail // fail
log.error( "Unable to get JIRA pid using url " LOG.error( "Unable to get JIRA pid using url "
+ project.getIssueTrackingUrl() ); + project.getIssueTrackingUrl() );
return; return;
@ -342,7 +342,7 @@ public final class JiraDownloader
if ( fixforIndex == -1 ) if ( fixforIndex == -1 )
{ {
// fail // fail
log.error( "Unable to get JIRA roadmap using url " LOG.error( "Unable to get JIRA roadmap using url "
+ project.getIssueTrackingUrl() ); + project.getIssueTrackingUrl() );
return; return;
@ -373,7 +373,7 @@ public final class JiraDownloader
} }
catch ( Exception e ) catch ( Exception e )
{ {
log.error( "Error accessing " + project.getIssueTrackingUrl(), e ); LOG.error( "Error accessing " + project.getIssueTrackingUrl(), e );
} }
} }
@ -395,13 +395,13 @@ public final class JiraDownloader
Credentials defaultcreds = Credentials defaultcreds =
new UsernamePasswordCredentials( webUser, webPassword ); new UsernamePasswordCredentials( webUser, webPassword );
log.info( "Using username: " + webUser LOG.info( "Using username: " + webUser
+ " for Basic Authentication against the webserver at " + " for Basic Authentication against the webserver at "
+ jiraUrl ); + jiraUrl );
client.getState().setCredentials( null, null, defaultcreds ); client.getState().setCredentials( null, null, defaultcreds );
} }
// log into JIRA if we have to // LOG into JIRA if we have to
String loginUrl = null; String loginUrl = null;
if ( ( jiraUser != null ) && ( jiraUser.length() > 0 ) if ( ( jiraUser != null ) && ( jiraUser.length() > 0 )
@ -411,7 +411,7 @@ public final class JiraDownloader
loginLink.append( "/login.jsp?os_destination=/secure/" ); loginLink.append( "/login.jsp?os_destination=/secure/" );
loginLink.append( "&os_username=" ).append( jiraUser ); loginLink.append( "&os_username=" ).append( jiraUser );
log.info( "Login URL: " + loginLink + "&os_password=*******" ); LOG.info( "Login URL: " + loginLink + "&os_password=*******" );
loginLink.append( "&os_password=" ).append( jiraPassword ); loginLink.append( "&os_password=" ).append( jiraPassword );
loginUrl = loginLink.toString(); loginUrl = loginLink.toString();
} }
@ -424,17 +424,17 @@ public final class JiraDownloader
try try
{ {
client.executeMethod( loginGet ); client.executeMethod( loginGet );
log.info( "Succesfully logged in into JIRA." ); LOG.info( "Succesfully logged in into JIRA." );
} }
catch ( Exception e ) catch ( Exception e )
{ {
if ( log.isDebugEnabled() ) if ( LOG.isDebugEnabled() )
{ {
log.error( "Error trying to login into JIRA:", e ); LOG.error( "Error trying to login into JIRA:", e );
} }
else else
{ {
log.error( "Error trying to login into JIRA. Cause is: " LOG.error( "Error trying to login into JIRA. Cause is: "
+ e.getLocalizedMessage() ); + e.getLocalizedMessage() );
} }
@ -454,7 +454,7 @@ public final class JiraDownloader
// see whether there is any proxy defined in maven // see whether there is any proxy defined in maven
if ( project == null ) if ( project == null )
{ {
log.error( "No project set. No proxy info available." ); LOG.error( "No project set. No proxy info available." );
return; return;
} }
@ -463,7 +463,7 @@ public final class JiraDownloader
if ( ctx == null ) if ( ctx == null )
{ {
log.error( "Maven project has no context. No proxy info available." ); LOG.error( "Maven project has no context. No proxy info available." );
return; return;
} }
@ -476,13 +476,13 @@ public final class JiraDownloader
client.getHostConfiguration().setProxy( proxyHost, client.getHostConfiguration().setProxy( proxyHost,
Integer.parseInt( proxyPort ) ); Integer.parseInt( proxyPort ) );
log.info( "Using proxy: " + proxyHost + " at port " + proxyPort ); LOG.info( "Using proxy: " + proxyHost + " at port " + proxyPort );
String proxyUser = ctx.getProxyUserName(); String proxyUser = ctx.getProxyUserName();
if ( proxyUser != null ) if ( proxyUser != null )
{ {
log.info( "Using proxy user: " + proxyUser ); LOG.info( "Using proxy user: " + proxyUser );
String proxyPass = ctx.getProxyPassword(); String proxyPass = ctx.getProxyPassword();
@ -510,7 +510,7 @@ public final class JiraDownloader
{ {
GetMethod gm = new GetMethod( link ); GetMethod gm = new GetMethod( link );
log.info( "Downloading " + link ); LOG.info( "Downloading " + link );
gm.setFollowRedirects( true ); gm.setFollowRedirects( true );
cl.executeMethod( gm ); cl.executeMethod( gm );
@ -526,7 +526,7 @@ public final class JiraDownloader
if ( sl == null ) if ( sl == null )
{ {
log.info( "Unknown error validating link : " + link ); LOG.info( "Unknown error validating link : " + link );
return; return;
} }
@ -538,50 +538,50 @@ public final class JiraDownloader
if ( locationHeader == null ) if ( locationHeader == null )
{ {
log.info( "Site sent redirect, but did not set Location header" ); LOG.info( "Site sent redirect, but did not set Location header" );
} }
else else
{ {
String newLink = locationHeader.getValue(); String newLink = locationHeader.getValue();
log.debug( "Following redirect to " + newLink ); LOG.debug( "Following redirect to " + newLink );
download( cl, newLink, outFile ); download( cl, newLink, outFile );
} }
} }
if ( gm.getStatusCode() != HttpStatus.SC_OK ) if ( gm.getStatusCode() != HttpStatus.SC_OK )
{ {
log.warn( "Received: [" + gm.getStatusCode() + "]" ); LOG.warn( "Received: [" + gm.getStatusCode() + "]" );
} }
} }
catch ( HttpException e ) catch ( HttpException e )
{ {
if ( log.isDebugEnabled() ) if ( LOG.isDebugEnabled() )
{ {
log.error( "Error downloading issues from JIRA:", e ); LOG.error( "Error downloading issues from JIRA:", e );
} }
else else
{ {
log.error( "Error downloading issues from JIRA. Cause is: " LOG.error( "Error downloading issues from JIRA. Cause is: "
+ e.getLocalizedMessage() ); + e.getLocalizedMessage() );
} }
} }
catch ( IOException e ) catch ( IOException e )
{ {
if ( log.isDebugEnabled() ) if ( LOG.isDebugEnabled() )
{ {
log.error( "Error downloading issues from JIRA:", e ); LOG.error( "Error downloading issues from JIRA:", e );
} }
else else
{ {
log.error( "Error downloading issues from JIRA. Cause is: " LOG.error( "Error downloading issues from JIRA. Cause is: "
+ e.getLocalizedMessage() ); + e.getLocalizedMessage() );
} }
} }
} }
/** /**
* Set the output file for the log. * Set the output file for the LOG.
* *
* @param thisOutput * @param thisOutput
* the output file * the output file
@ -669,7 +669,7 @@ public final class JiraDownloader
} }
/** /**
* Sets the password to log into a secured JIRA. * Sets the password to LOG into a secured JIRA.
* *
* @param thisJiraPassword * @param thisJiraPassword
* The password for JIRA * The password for JIRA
@ -680,7 +680,7 @@ public final class JiraDownloader
} }
/** /**
* Sets the username to log into a secured JIRA. * Sets the username to LOG into a secured JIRA.
* *
* @param thisJiraUser * @param thisJiraUser
* The username for JIRA * The username for JIRA