changeset 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 d0a39efbfd96
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Fri Mar 26 09:21:31 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Fri Mar 26 09:55:28 2010 +0000
@@ -1,3 +1,8 @@
+2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java: Avoid danger to get
+	  a NullPointerException if no time to live is served by CallContext.
+
 2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	  Issue197
--- 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