Skip to content

Commit

Permalink
[JENKINS-31679] Convert System.err.println() to Logger.log()
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigc committed Dec 21, 2015
1 parent 4a7b031 commit 57fb5e7
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -7,6 +7,9 @@

import java.io.IOException;
import java.util.regex.Pattern;
import java.util.logging.Logger;
import static java.util.logging.Level.WARNING;
import static java.util.logging.Level.FINEST;

import jenkins.plugins.clangscanbuild.ClangScanBuildUtils;
import jenkins.plugins.clangscanbuild.history.ClangScanBuildBugSummary;
Expand All @@ -24,7 +27,8 @@
* @author Josh Kennedy
*/
public class ClangScanBuildAction implements Action, StaplerProxy, ModelObject{

private static final Logger LOGGER = Logger.getLogger(ClangScanBuildAction.class.getName());

public static final String BUILD_ACTION_URL_NAME = "clangScanBuildBugs";
private int bugThreshold;
private FilePath bugSummaryXML;
Expand Down Expand Up @@ -74,10 +78,10 @@ public ClangScanBuildBugSummary loadBugSummary(){
return null;
}
}catch( java.lang.InterruptedException ie ){
System.err.println( ie );
LOGGER.log(FINEST, "", ie);
return null;
}catch( IOException ioe ){
System.err.println( ioe );
LOGGER.log(FINEST, "", ioe);
return null;
}
}
Expand Down Expand Up @@ -132,7 +136,7 @@ public void doBrowse( StaplerRequest req, StaplerResponse rsp ) throws IOExcepti
if( requestedPath == null ) rsp.sendError( 404 );

if( !APPROVED_REPORT_REQUEST_PATTERN.matcher( requestedPath ).matches() ){
System.err.println( "Someone is requesting unapproved content: " + requestedPath );
LOGGER.log(FINEST, "Someone is requesting unapproved content: %s", requestedPath);
rsp.sendError( 404 );
return;
}
Expand All @@ -142,13 +146,13 @@ public void doBrowse( StaplerRequest req, StaplerResponse rsp ) throws IOExcepti

try{
if( !requestedFile.exists() ){
System.err.println( "Unable to locate report: " + req.getRestOfPath() );
LOGGER.log(FINEST, "Unable to locate report: %s", req.getRestOfPath());
rsp.sendError( 404 );
return;
}
rsp.serveFile( req, requestedFile.toURI().toURL() );
}catch( Exception e ){
System.err.println( "FAILED TO SERVE FILE: " + req.getRestOfPath() + " -> " + e.getLocalizedMessage() );
LOGGER.log(FINEST, "FAILED TO SERVE FILE: %s -> %s", new Object[]{req.getRestOfPath(), e.getLocalizedMessage()});
rsp.sendError( 500 );
}

Expand Down

0 comments on commit 57fb5e7

Please sign in to comment.