# HG changeset patch # User Felix Wolfsteller # Date 1324044352 0 # Node ID 5b6ba54d488a4f6f362a571dcb40c33ef2fd92fa # Parent b47d0464f0dbfc11e001408c0eec8837242c5b09 Never return null from a function which is documented to do so. artifacts/trunk@3443 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b47d0464f0db -r 5b6ba54d488a ChangeLog --- 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 + + * artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java: + (getDataProvider): Never return null. + 2011-12-16 Ingo Weinzierl * artifact-database/src/main/java/de/intevation/artifactdatabase/state/Output.java, diff -r b47d0464f0db -r 5b6ba54d488a artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.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 getDataProvider(Object key) { - return dataProviders != null - ? dataProviders.get(key) - : java.util.Collections.emptyList(); + if (dataProviders != null) { + List list = dataProviders.get(key); + return list != null + ? list + : java.util.Collections.emptyList(); + } + return java.util.Collections.emptyList(); } + /** * Let a DataProvider register itself with given key. * Multiple DataProvider can register under the same key.