Mercurial > dive4elements > framework
changeset 362:5b6ba54d488a
Never return null from a function which is documented to do so.
artifacts/trunk@3443 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 16 Dec 2011 14:05:52 +0000 |
parents | b47d0464f0db |
children | 4d3298295a64 |
files | ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java |
diffstat | 2 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Dec 16 09:14:14 2011 +0000 +++ b/ChangeLog Fri Dec 16 14:05:52 2011 +0000 @@ -1,3 +1,8 @@ +2011-12-16 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java: + (getDataProvider): Never return null. + 2011-12-16 Ingo Weinzierl <ingo@intevation.de> * artifact-database/src/main/java/de/intevation/artifactdatabase/state/Output.java,
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java Fri Dec 16 09:14:14 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java Fri Dec 16 14:05:52 2011 +0000 @@ -7,8 +7,11 @@ */ package de.intevation.artifactdatabase; +import org.apache.log4j.Logger; + import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.HashMap; import de.intevation.artifacts.ArtifactDatabase; @@ -25,6 +28,8 @@ */ public abstract class AbstractCallContext implements CallContext { + Logger logger = Logger.getLogger(AbstractCallContext.class); + /** * The ArtifactDatabase instance. */ @@ -115,11 +120,16 @@ * @return list (empty list if none found, never null). */ public List<DataProvider> getDataProvider(Object key) { - return dataProviders != null - ? dataProviders.get(key) - : java.util.Collections.<DataProvider>emptyList(); + if (dataProviders != null) { + List<DataProvider> list = dataProviders.get(key); + return list != null + ? list + : java.util.Collections.<DataProvider>emptyList(); + } + return java.util.Collections.<DataProvider>emptyList(); } + /** * Let a DataProvider register itself with given key. * Multiple DataProvider can register under the same key.