comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java @ 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 e4606eae8ea5
children 42c15e2f95fb 0a5239a1e46e
comparison
equal deleted inserted replaced
8702:582aaac447ad 8703:e4f9e2316e92
134 134
135 facets.add(c); 135 facets.add(c);
136 } 136 }
137 } 137 }
138 138
139 DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); 139 if (wqkms.length > 0) {
140 DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm"); 140 DateFormat df = Formatter.getDateFormatter(context.getMeta(),
141 "dd.MM.yyyy");
142 DateFormat lf = Formatter.getDateFormatter(context.getMeta(),
143 "dd.MM.yyyy'T'HH:mm");
141 144
142 Collection<Date> reds = fixRes.getReferenceEventsDates(); 145 Collection<Date> reds = fixRes.getReferenceEventsDates();
143 UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); 146 UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds);
144 147
145 int i = 0; 148 int i = 0;
146 for (Date d: reds) { 149 for (Date d: reds) {
147 facets.add(new FixReferenceEventsFacet( 150 facets.add(new FixReferenceEventsFacet(
148 (1 << 9) | i, 151 (1 << 9) | i,
149 FIX_EVENTS, 152 FIX_EVENTS,
150 cf.format(d))); 153 cf.format(d)));
151 i++; 154 i++;
152 } 155 }
153 156
154 if (wqkms.length > 0) {
155 facets.add( 157 facets.add(
156 new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); 158 new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
157 159
158 facets.add( 160 facets.add(
159 new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id)); 161 new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id));

http://dive4elements.wald.intevation.org