Skip to content

Commit

Permalink
Merge pull request #1 from mlinnosk/master
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Nov 24, 2011
2 parents 950f601 + f5b5a5d commit bec07a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,5 @@ work
*.iml
*.ipr
*.iws
.classpath
.project
Expand Up @@ -135,17 +135,17 @@ private static CategoryDataset buildDataset(CcccBuildAction lastAction) throws C
CcccReport report = result.getReport();
NumberOnlyBuildLabel buildLabel = new NumberOnlyBuildLabel(action.getBuild());

try {
Class projectSummaryClass = ProjectSummary.class;
Method method = projectSummaryClass.getMethod("nbNodules");
Number n = (Number) method.invoke(report.getStructuralSummaryModuleList());
} catch (NoSuchMethodException nse) {
throw new CCCCException(nse);
} catch (IllegalAccessException iae) {
throw new CCCCException(iae);
} catch (InvocationTargetException ite) {
throw new CCCCException(ite);
}
// try {
// Class projectSummaryClass = ProjectSummary.class;
// Method method = projectSummaryClass.getMethod("nbNodules");
// Number n = (Number) method.invoke(report.getStructuralSummaryModuleList());
// } catch (NoSuchMethodException nse) {
// throw new CCCCException(nse);
// } catch (IllegalAccessException iae) {
// throw new CCCCException(iae);
// } catch (InvocationTargetException ite) {
// throw new CCCCException(ite);
// }
if (report.getProjectSummary() == null)
builder.add(0, "Number of module", buildLabel);
else
Expand Down

1 comment on commit bec07a3

@mlinnosk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check the code through? I've been going through the older code base and the same code snippet is in them too, only difference being that the exceptions are not re-thrown, so the code does not crash. I just can't figure out whats the point of the code inside the try block.

First of all, theres no such method as "nbNodules". Second, looks to me that the method.invoke() is illformed. The first parameter passed to invoke should be the object the method is invoked on and in the example code a list is passed to it. Third, the number is local to the try block. Fourth, why is reflection used here? So only thing that would make sense is that there is some side effect that the call should cause.

My consern is that commenting out the block causes the graph to be drawn wrong. My test project shows only the number of modules line, but it is possible that the other two are drawn under it so it might be ok.

Please sign in to comment.