Skip to content

Commit

Permalink
Fixed JENKINS-4584
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed May 16, 2011
1 parent 0421d67 commit 75c6c09
Show file tree
Hide file tree
Showing 21 changed files with 2,728 additions and 1,719 deletions.
Expand Up @@ -52,7 +52,7 @@ public class CcccChartBuilder extends Graph {

protected CcccChartBuilder(CcccBuildAction action, int width, int height) {
super(action.getBuild().getTimestamp(), width, height);
this.action=action;
this.action = action;
}


Expand Down Expand Up @@ -137,14 +137,11 @@ private static CategoryDataset buildDataset(CcccBuildAction lastAction) {
Class projectSummaryClass = ProjectSummary.class;
Method method = projectSummaryClass.getMethod("nbNodules");
Number n = (Number) method.invoke(report.getStructuralSummaryModuleList());
}
catch (NoSuchMethodException nsm) {
} catch (NoSuchMethodException nsm) {

}
catch (IllegalAccessException nsm) {
} catch (IllegalAccessException nsm) {

}
catch (InvocationTargetException ite) {
} catch (InvocationTargetException ite) {

}
if (report.getProjectSummary() == null)
Expand Down
Expand Up @@ -74,7 +74,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
build.setResult(Result.FAILURE);
return false;
}
CccccParser parser = new CccccParser();
CccccParser parser = new CccccParser(metricFile);
report = workspace.act(parser);

} catch (IOException ioe) {
Expand All @@ -86,6 +86,10 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
ie.printStackTrace(logger);
build.setResult(Result.FAILURE);
return false;
} catch (Throwable t) {
t.printStackTrace(logger);
build.setResult(Result.FAILURE);
return false;
}

CcccResult result = new CcccResult(report, build);
Expand Down
24 changes: 9 additions & 15 deletions src/main/java/com/thalesgroup/hudson/plugins/cccc/CccccParser.java
Expand Up @@ -23,7 +23,6 @@
package com.thalesgroup.hudson.plugins.cccc;

import com.thalesgroup.hudson.plugins.cccc.model.*;
import hudson.AbortException;
import hudson.FilePath;
import hudson.remoting.VirtualChannel;
import org.jdom.Document;
Expand All @@ -42,35 +41,30 @@

public class CccccParser implements FilePath.FileCallable<CcccReport> {

private static final long serialVersionUID = 1L;

private FilePath resultFilePath;
private static final Logger LOGGER = Logger.getLogger(CccccParser.class.getName());


public CccccParser() {
resultFilePath = null;
}
private FilePath resultFilePath;

public CccccParser(FilePath resultFilePath) {
this.resultFilePath = resultFilePath;
}

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

Document document = null;
Document document;
try {
SAXBuilder sxb = new SAXBuilder();
document = sxb.build(new InputStreamReader(new FileInputStream(new File(resultFilePath.toURI())), "UTF-8"));
}
catch (Exception e) {
FileInputStream fis = new FileInputStream(new File(resultFilePath.toURI()));
InputStreamReader reader = new InputStreamReader(fis, "UTF-8");
document = sxb.build(reader);
reader.close();
fis.close();
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Parsing file error :" + e.toString());
throw new AbortException("Parsing file error");
throw new RuntimeException("Parsing file error :" + e.toString());
}

Element root = document.getRootElement();

Element projectSummaryElt = root.getChild("project_summary");
if (projectSummaryElt != null) {
LOGGER.log(Level.INFO, "Process Project Summary element.");
Expand Down

0 comments on commit 75c6c09

Please sign in to comment.