X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=test%2Fenterprise%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsupport%2Fjndi%2FStubInitialContext.java;fp=test%2Fenterprise%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsupport%2Fjndi%2FStubInitialContext.java;h=5300a8b6a5f230ca84ea375b28dcedd03723b50a;hb=74a6cd5b71b4f668ddac54c3237511ee11e8d84e;hp=4db8a1126f4a3358e3d3aacf20af7f59740d9d94;hpb=fb971e6eaeb259cab901c774e6b862755ab42c43;p=utils diff --git a/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContext.java b/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContext.java index 4db8a112..5300a8b6 100644 --- a/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContext.java +++ b/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContext.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.support.jndi; import java.util.HashMap; @@ -20,6 +20,7 @@ import java.util.Map; import javax.naming.InitialContext; import javax.naming.Name; +import javax.naming.NameNotFoundException; import javax.naming.NamingException; public class StubInitialContext extends InitialContext { @@ -36,11 +37,19 @@ public class StubInitialContext extends InitialContext { @Override public Object lookup(String aName) throws NamingException { - return bindings.get(aName); + Object value = bindings.get(aName); + if (value == null) { + throw new NameNotFoundException(aName); + } + return value; } @Override public Object lookup(Name aName) throws NamingException { - return super.lookup(aName.toString()); + Object value = super.lookup(aName.toString()); + if (value == null) { + throw new NameNotFoundException(aName.toString()); + } + return value; } }