Skip to content
Permalink
Browse files
[FIXED JENKINS-14255] java.io.InvalidClassException
  • Loading branch information
Karsten Brandt authored and Karsten Brandt committed Jul 3, 2012
1 parent 510d0a7 commit f2577af289dcd5d4fa6d114b9b2ccedc7d2e5629
Showing 2 changed files with 25 additions and 27 deletions.
@@ -46,33 +46,32 @@ protected boolean canContinue(final Result result) {

@Override
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener){

SloccountResult result;

FilePath workspace = build.getWorkspace();
PrintStream logger = listener.getLogger();
SloccountReport report = new SloccountReport();
SloccountParser parser = new SloccountParser(this.getRealEncoding(), this.getRealPattern(), logger, report);
SloccountParser parser = new SloccountParser(this.getRealEncoding(), this.getRealPattern(), logger);
SloccountReport report;

if(this.canContinue(build.getResult())){

try{
FilePath workspace = build.getWorkspace();
try{
if(this.canContinue(build.getResult())){
report = workspace.act(parser);

}catch(IOException ioe){
ioe.printStackTrace(logger);
return false;

}catch(InterruptedException ie){
ie.printStackTrace(logger);
return false;
}else{
// generate an empty report
// TODO: Replace this empty report with the last valid one?
report = new SloccountReport();
}

}else{

// continue with empty report object
}catch(IOException ioe){
ioe.printStackTrace(logger);
return false;

}catch(InterruptedException ie){
ie.printStackTrace(logger);
return false;
}

result = new SloccountResult(report, build);

SloccountBuildAction buildAction = new SloccountBuildAction(build, result);
@@ -21,27 +21,26 @@ public class SloccountParser implements FilePath.FileCallable<SloccountReport> {
private final String encoding;
private final String filePattern;
private transient PrintStream logger = null;
private transient SloccountReport report = null;

public SloccountParser(String encoding, String filePattern, PrintStream logger, SloccountReport report){
this.report = report;
public SloccountParser(String encoding, String filePattern, PrintStream logger){
this.logger = logger;
this.filePattern = filePattern;
this.encoding = encoding;
}


public SloccountReport invoke(java.io.File workspace, VirtualChannel channel) throws IOException {
SloccountReport report = new SloccountReport();

FileFinder finder = new FileFinder(this.filePattern);
String[] found = finder.find(workspace);

for(String fileName : found){
this.parse(workspace, fileName, this.report);
this.parse(workspace, fileName, report);
}

this.report.simplifyNames();
return this.report;
report.simplifyNames();
return report;
}

private void parse(java.io.File workspace, String fileName, SloccountReport report) throws IOException {
@@ -86,9 +85,9 @@ private void parseLine(String line, SloccountReport report){
if(LOG_ENABLED && (this.logger != null)){
logger.println("lineCount: " + lineCount);
logger.println("language : " + languageName);
logger.println("file : " + filePath);
logger.println("file : " + filePath);
}

report.add(filePath, languageName, lineCount);
}
}
}

0 comments on commit f2577af

Please sign in to comment.