NamingManager.java (getContinuationContext): Call getObjectInstance() with Object...
authorJulian Dolby <dolby@us.ibm.com>
Wed, 29 Oct 2003 14:54:00 +0000 (14:54 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Wed, 29 Oct 2003 14:54:00 +0000 (14:54 +0000)
2003-10-29  Julian Dolby  <dolby@us.ibm.com>

* javax/naming/spi/NamingManager.java (getContinuationContext): Call
getObjectInstance() with Object, Name, Context and environment
Hashtable from exception. Call fillInStackTrace() on exception when
rethrown.
* javax/naming/InitialContext.java (lookup(Name)): When a
CannotProceedException is thrown use the ContinuationContext.
(lookup(String)): Likewise.
(close): Clear myProps and defaultInitCtx.

From-SVN: r73041

libjava/ChangeLog
libjava/javax/naming/InitialContext.java
libjava/javax/naming/spi/NamingManager.java

index 07043ac856e9f5af34b6e740a3cd8eb7df77a9e9..bea41fc92b4acee7f8eb3918ad8f89eb536dd038 100644 (file)
@@ -1,3 +1,14 @@
+2003-10-29  Julian Dolby  <dolby@us.ibm.com>
+
+       * javax/naming/spi/NamingManager.java (getContinuationContext): Call
+       getObjectInstance() with Object, Name, Context and environment
+       Hashtable from exception. Call fillInStackTrace() on exception when
+       rethrown.
+       * javax/naming/InitialContext.java (lookup(Name)): When a
+       CannotProceedException is thrown use the ContinuationContext.
+       (lookup(String)): Likewise.
+       (close): Clear myProps and defaultInitCtx.
+
 2003-10-29  Michael Koch  <konqueror@gmx.de>
 
        * java/net/InetAddress.java
index 715f30ad5cd75f2357bc03a08d223b73927a644e..e2a1ac6b63f89c09e65ed54bebf2b356da93588b 100644 (file)
@@ -240,12 +240,28 @@ public class InitialContext implements Context
 
   public Object lookup (Name name) throws NamingException
   {
-    return getURLOrDefaultInitCtx (name).lookup (name);
+    try
+      {
+       return getURLOrDefaultInitCtx (name).lookup (name);
+      }
+    catch (CannotProceedException cpe)
+      {
+       Context ctx = NamingManager.getContinuationContext (cpe);
+       return ctx.lookup (cpe.getRemainingName());
+      }
   }
 
   public Object lookup (String name) throws NamingException
   {
-    return getURLOrDefaultInitCtx (name).lookup (name);
+      try
+       {
+         return getURLOrDefaultInitCtx (name).lookup (name);
+       }
+      catch (CannotProceedException cpe)
+       {
+         Context ctx = NamingManager.getContinuationContext (cpe);
+         return ctx.lookup (cpe.getRemainingName());
+       }
   }
 
   public void rebind (Name name, Object obj) throws NamingException
@@ -367,7 +383,8 @@ public class InitialContext implements Context
 
   public void close () throws NamingException
   {
-    throw new OperationNotSupportedException ();
+    myProps = null;
+    defaultInitCtx = null;
   }
 
   public String getNameInNamespace () throws NamingException
index 65ce2d23c23dff698e53c4d9db7221d94ee5dfdf..af9ddc36ca791cfb5c43cae1eba78c118c6b813f 100644 (file)
@@ -324,8 +324,10 @@ public class NamingManager
     // It is really unclear to me if this is right.
     try
       {
-       Object obj = getObjectInstance (null, cpe.getAltName (),
-                                       cpe.getAltNameCtx (), env);
+       Object obj = getObjectInstance (cpe.getResolvedObj(),
+                                       cpe.getAltName (),
+                                       cpe.getAltNameCtx (), 
+                                       env);
        if (obj != null)
          return (Context) obj;
       }
@@ -333,6 +335,9 @@ public class NamingManager
       {
       }
 
+    // fix stack trace for re-thrown exception (message confusing otherwise)
+    cpe.fillInStackTrace();
+
     throw cpe;
   }