comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 5290:394841a66c14

MainValuesArtifact: Possible NPE fix.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 14 Mar 2013 12:34:40 +0100
parents ce7d8e2a7e02
children d3f170484455
comparison
equal deleted inserted replaced
5289:f6478773a5bb 5290:394841a66c14
173 @Override 173 @Override
174 protected void initialize(Artifact artifact, Object context, CallMeta meta) { 174 protected void initialize(Artifact artifact, Object context, CallMeta meta) {
175 logger.debug("MainValuesArtifact.initialize"); 175 logger.debug("MainValuesArtifact.initialize");
176 FLYSArtifact winfo = (FLYSArtifact) artifact; 176 FLYSArtifact winfo = (FLYSArtifact) artifact;
177 RangeAccess rangeAccess = new RangeAccess(winfo, null); 177 RangeAccess rangeAccess = new RangeAccess(winfo, null);
178 double [] locations = rangeAccess.getLocations(); 178 double [] locations = rangeAccess.getKmRange();
179
179 if (locations != null) { 180 if (locations != null) {
180 double location = locations[0]; 181 double location = locations[0];
181 addData("ld_locations", new DefaultStateData("ld_locations", null, null, 182 addData("ld_locations", new DefaultStateData("ld_locations", null, null,
182 String.valueOf(location))); 183 String.valueOf(location)));
183 } 184 }
184 else { 185 else {
185 logger.warn("No location for mainvalues given."); 186 logger.error("No location for mainvalues given.");
186 } 187 }
187 importData(winfo, "river"); 188 importData(winfo, "river");
188 } 189 }
189 190
190 191
245 River river = FLYSUtils.getRiver(this); 246 River river = FLYSUtils.getRiver(this);
246 247
247 // TODO use helper to get location as double 248 // TODO use helper to get location as double
248 String locationStr = getDataAsString("ld_locations"); 249 String locationStr = getDataAsString("ld_locations");
249 250
250 if (river == null || locationStr == null) { 251 if (river == null) {
252 logger.error("River is null");
253 return null;
254 }
255
256 if (locationStr == null) {
257 logger.error("Locationstr is null");
251 return null; 258 return null;
252 } 259 }
253 260
254 double location = Double.parseDouble(locationStr); 261 double location = Double.parseDouble(locationStr);
255 262

http://dive4elements.wald.intevation.org