diff 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
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java	Fri Mar 26 09:21:31 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java	Fri Mar 26 09:55:28 2010 +0000
@@ -189,7 +189,7 @@
             ArtifactNamespaceContext.NAMESPACE_PREFIX);
 
         Long time  = callContext.getTimeToLive();
-        time      += new Date().getTime();
+        time       = time != null ? time + new Date().getTime() : null;
         String ttl = time != null ? time.toString() : null;
 
         logger.debug("Artifacts time to live: " + ttl);
@@ -234,7 +234,7 @@
             ArtifactNamespaceContext.NAMESPACE_PREFIX);
 
         Long time  = context.getTimeToLive();
-        time      += new Date().getTime();
+        time       = time != null ? time + new Date().getTime() : null;
         String ttl = time != null ? time.toString() : null;
 
         logger.debug("Artifacts time to live: " + ttl);
@@ -283,7 +283,7 @@
             ArtifactNamespaceContext.NAMESPACE_PREFIX);
 
         Long time  = context.getTimeToLive();
-        time      += new Date().getTime();
+        time       = time != null ? time + new Date().getTime() : null;
         String ttl = time != null ? time.toString() : null;
 
         logger.debug("Artifacts time to live: " + ttl);

http://dive4elements.wald.intevation.org