Mercurial > dive4elements > river
changeset 8703:e4f9e2316e92
Avoid NPE: fixRes is null if wqkms.lenght==0.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 23 Apr 2015 19:06:41 +0200 |
parents | 582aaac447ad |
children | 93a31cfb18c0 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java |
diffstat | 1 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java Thu Apr 23 16:42:42 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java Thu Apr 23 19:06:41 2015 +0200 @@ -136,22 +136,24 @@ } } - DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); - DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm"); - - Collection<Date> reds = fixRes.getReferenceEventsDates(); - UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); + if (wqkms.length > 0) { + DateFormat df = Formatter.getDateFormatter(context.getMeta(), + "dd.MM.yyyy"); + DateFormat lf = Formatter.getDateFormatter(context.getMeta(), + "dd.MM.yyyy'T'HH:mm"); - int i = 0; - for (Date d: reds) { - facets.add(new FixReferenceEventsFacet( - (1 << 9) | i, - FIX_EVENTS, - cf.format(d))); - i++; - } + Collection<Date> reds = fixRes.getReferenceEventsDates(); + UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); - if (wqkms.length > 0) { + int i = 0; + for (Date d: reds) { + facets.add(new FixReferenceEventsFacet( + (1 << 9) | i, + FIX_EVENTS, + cf.format(d))); + i++; + } + facets.add( new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));