Skip to content

Commit

Permalink
Fixed issue JENKINS-14522 again as the NULL pointer exception was sho…
Browse files Browse the repository at this point in the history
…wing up again.
  • Loading branch information
mambu committed Nov 12, 2012
1 parent d37420b commit a6fa71f
Showing 1 changed file with 12 additions and 3 deletions.
Expand Up @@ -70,7 +70,7 @@ public TestTrendChart(String name, int graphWidth, int graphHeight,
this.graphWidth = graphWidth;
this.graphHeight = graphHeight;
this.dateRange = dateRange;
this.displayStatus = DisplayStatus.valueOf(display);
this.displayStatus = display != null ? DisplayStatus.valueOf(display) : DisplayStatus.ALL;
DashboardLog.debug("TestTrendChart", "ctor");
}

Expand Down Expand Up @@ -98,6 +98,15 @@ public String getDisplayStatus() {
public void setDisplayStatus(String s) {
displayStatus = DisplayStatus.valueOf(s);
}

public DisplayStatus getDisplayStatusEnum() {
if (displayStatus == null)
{
displayStatus = DisplayStatus.ALL;
DashboardLog.info("TestTrendChart", "display is null - setting to ALL");
}
return displayStatus;
}

/**
* Graph of duration of tests over time.
Expand Down Expand Up @@ -208,7 +217,7 @@ protected JFreeChart createGraph() {
StackedAreaRenderer ar = new StackedAreaRenderer2();
plot.setRenderer(ar);

switch (displayStatus) {
switch (getDisplayStatusEnum()) {
case SUCCESS:
ar.setSeriesPaint(0, ColorPalette.BLUE);
break;
Expand Down Expand Up @@ -239,7 +248,7 @@ private CategoryDataset buildDataSet(
for (Map.Entry<LocalDate, TestResultSummary> entry : summaries.entrySet()) {
LocalDateLabel label = new LocalDateLabel(entry.getKey());

switch (displayStatus) {
switch (getDisplayStatusEnum()) {
case SUCCESS:
dsb.add(entry.getValue().getSuccess(),
Messages.Dashboard_Total(), label);
Expand Down

0 comments on commit a6fa71f

Please sign in to comment.