This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: "apply not implemented for PrimProcedure" while attempting to use JNDI
- From: Per Bothner <per at bothner dot com>
- To: Valtteri Vuorikoski <vuori at puuhamaa dot magenta dot net>
- Cc: kawa at sources dot redhat dot com
- Date: Wed, 14 Nov 2001 15:22:10 -0800
- Subject: Re: "apply not implemented for PrimProcedure" while attempting to use JNDI
- References: <x47kst9x9y.fsf@puuhamaa.magenta.net>
Valtteri Vuorikoski wrote:
>Attempting to instantiate javax.naming.InitialContext with a Hashtable
>parameter runs into a runtime exception as in the following session
>(some lines have been removed for brevity):
>
>#|kawa:1|# (define env (make <java.util.Hashtable>))
>#|kawa:5|# (require <javax.naming.Context>)
>#|kawa:6|# (invoke env 'put INITIAL_CONTEXT_FACTORY "com.sun.jndi.ldap.LdapCtxFactory")
>#!null
>#|kawa:9|# env
>{java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory}
>#|kawa:10|# (define ctx (make <javax.naming.InitialContext> env))
>java.lang.RuntimeException: apply not implemented for PrimProcedure javax.naming.InitialContext javax.naming.InitialContext.<init>(boolean) - java.lang.NoSuchMethodException
>
The appended patch should fix the problem. (You got a quick response partly
because it seemed like your problem might be related to that of a
customer, and
partly because you provided a nice simple testcase!)
--Per
Index: gnu/kawa/lispexpr/LangPrimType.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/kawa/lispexpr/LangPrimType.java,v
retrieving revision 1.4
diff -u -r1.4 LangPrimType.java
--- LangPrimType.java 2001/09/21 17:33:36 1.4
+++ LangPrimType.java 2001/11/14 23:10:25
@@ -178,15 +178,11 @@
return 0;
if (sig1 == 'V')
return 1;
- if (sig2 == 'V')
+ if (sig2 == 'V' || sig2 == 'Z')
return -1;
- if (sig2 == 'Z')
- return 0;
}
- if (sig1 == 'V')
+ if (sig1 == 'V' || sig1 == 'Z')
return 1;
- if (sig1 == 'Z')
- return 0;
return super.compare(other);
}
}
Index: gnu/expr/GenericProc.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/GenericProc.java,v
retrieving revision 1.9
diff -u -r1.9 GenericProc.java
--- GenericProc.java 2001/10/20 21:05:41 1.9
+++ GenericProc.java 2001/11/14 23:10:25
@@ -92,21 +92,43 @@
public int match (CallContext ctx, Object[] args)
{
- int code = 0;
- CallContext mvars = new CallContext();
+ if (count == 1)
+ return methods[0].match(ctx, args);
+ MethodProc best = null;
+ CallContext vars = null;
+ CallContext bestVars = null;
for (int i = count; --i >= 0; )
{
MethodProc method = methods[i];
- code = method.match(mvars, args);
- if (code == 0)
+ if (vars == null)
+ vars = new CallContext();
+ int code = method.match(vars, args);
+ if (code == 0)
{
- ctx.value1 = method;
- ctx.value2 = mvars;
- return 0;
+ if (best == null)
+ {
+ best = method;
+ bestVars = vars;
+ vars = null;
+ }
+ else
+ {
+ best = MethodProc.mostSpecific(best, method);
+ if (best == method)
+ {
+ bestVars = vars;
+ vars = null;
+ }
+ }
+
}
}
- if (count == 1)
- return code;
+ if (best != null)
+ {
+ ctx.value1 = best;
+ ctx.value2 = bestVars;
+ return 0;
+ }
return NO_MATCH;
}