comparison gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java @ 773:5fb1ea68e19c

Avoid danger to get a NullPointerException if no time to live is served by CallContext. gnv-artifacts/trunk@832 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Mar 2010 09:55:28 +0000
parents cd64ab8a46a7
children 9a828e5a2390
comparison
equal deleted inserted replaced
772:cd64ab8a46a7 773:5fb1ea68e19c
187 document, 187 document,
188 ArtifactNamespaceContext.NAMESPACE_URI, 188 ArtifactNamespaceContext.NAMESPACE_URI,
189 ArtifactNamespaceContext.NAMESPACE_PREFIX); 189 ArtifactNamespaceContext.NAMESPACE_PREFIX);
190 190
191 Long time = callContext.getTimeToLive(); 191 Long time = callContext.getTimeToLive();
192 time += new Date().getTime(); 192 time = time != null ? time + new Date().getTime() : null;
193 String ttl = time != null ? time.toString() : null; 193 String ttl = time != null ? time.toString() : null;
194 194
195 logger.debug("Artifacts time to live: " + ttl); 195 logger.debug("Artifacts time to live: " + ttl);
196 196
197 Element layer = creator.create(LayerInfo.LAYER); 197 Element layer = creator.create(LayerInfo.LAYER);
232 document, 232 document,
233 ArtifactNamespaceContext.NAMESPACE_URI, 233 ArtifactNamespaceContext.NAMESPACE_URI,
234 ArtifactNamespaceContext.NAMESPACE_PREFIX); 234 ArtifactNamespaceContext.NAMESPACE_PREFIX);
235 235
236 Long time = context.getTimeToLive(); 236 Long time = context.getTimeToLive();
237 time += new Date().getTime(); 237 time = time != null ? time + new Date().getTime() : null;
238 String ttl = time != null ? time.toString() : null; 238 String ttl = time != null ? time.toString() : null;
239 239
240 logger.debug("Artifacts time to live: " + ttl); 240 logger.debug("Artifacts time to live: " + ttl);
241 241
242 Element layer = creator.create(LayerInfo.LAYER); 242 Element layer = creator.create(LayerInfo.LAYER);
281 document, 281 document,
282 ArtifactNamespaceContext.NAMESPACE_URI, 282 ArtifactNamespaceContext.NAMESPACE_URI,
283 ArtifactNamespaceContext.NAMESPACE_PREFIX); 283 ArtifactNamespaceContext.NAMESPACE_PREFIX);
284 284
285 Long time = context.getTimeToLive(); 285 Long time = context.getTimeToLive();
286 time += new Date().getTime(); 286 time = time != null ? time + new Date().getTime() : null;
287 String ttl = time != null ? time.toString() : null; 287 String ttl = time != null ? time.toString() : null;
288 288
289 logger.debug("Artifacts time to live: " + ttl); 289 logger.debug("Artifacts time to live: " + ttl);
290 290
291 Element layer = creator.create(LayerInfo.LAYER); 291 Element layer = creator.create(LayerInfo.LAYER);

http://dive4elements.wald.intevation.org