Skip to content

Commit

Permalink
Merge pull request mysticfall#219 from argustelecom/master
Browse files Browse the repository at this point in the history
fix for mysticfall#218 Correct support for non-numeric measure values
  • Loading branch information
mysticfall authored Aug 13, 2017
2 parents 8a7dd05 + d58ef5e commit bec59ff
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pivot4j-core/src/main/java/org/pivot4j/ui/table/TableRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,29 +200,36 @@ protected String getLabel(TableRenderContext context) {
@Override
protected Double getValue(TableRenderContext context) {
Double value = null;
boolean nonNumericValue = false;

Aggregator aggregator = context.getAggregator();

Cell cell = context.getCell();


try {
if (aggregator == null) {
if (cell != null && !cell.isEmpty()) {
try {
value = cell.getDoubleValue();
} catch (OlapException e) {
throw new PivotException(e);
nonNumericValue = true;
//#218 do nothing: cell.getDoubleValue() throws OlapException if this cell does not have a numeric value
}
}
} else {
value = aggregator.getValue(context);
}
} catch (NumberFormatException e) {
if (logger.isTraceEnabled()) {
logger.trace("Non-numeric cell value : {}", cell.getValue());
}
nonNumericValue = true;
//#147 do nothing: XmlaOlap4jCell.getDoubleValue throws NumberFormatException if this cell does not have a numeric value
}

if (nonNumericValue && logger.isTraceEnabled()) {
logger.trace("Non-numeric cell value : {}", cell.getValue());
}


return value;
}

Expand Down

0 comments on commit bec59ff

Please sign in to comment.