Project

Profile

Help

Revision a62ac781

Added by Michael Kay about 12 years ago

Fix bug 2859861 NPE calling overloaded extension function in saxon:evaluate

View differences:

latest9.1/bj/net/sf/saxon/dotnet/DotNetExtensionLibrary.java
936 936
    private class UnresolvedExtensionFunction extends CompileTimeFunction {
937 937

  
938 938
        private List candidateMethods;
939
        private StructuredQName functionName;
940 939
        private cli.System.Type theClass;
941 940

  
942 941

  
943 942
        public UnresolvedExtensionFunction(StructuredQName functionName, cli.System.Type theClass, List candidateMethods, Expression[] staticArgs) {
944 943
            setArguments(staticArgs);
945
            this.functionName = functionName;
944
            setFunctionName(functionName);
946 945
            this.theClass = theClass;
947 946
            this.candidateMethods = candidateMethods;
948 947
        }
......
962 961
            MemberInfo method = getBestFit(candidateMethods, argument, theClass);
963 962
            if (method == null) {
964 963
                XPathException err = new XPathException("There is more than one method matching the function call " +
965
                        functionName.getDisplayName() +
964
                        getFunctionName().getDisplayName() +
966 965
                        ", and there is insufficient type information to determine which one should be used");
967 966
                err.setLocator(this);
968 967
                throw err;
969 968
            } else {
970 969
                DotNetExtensionFunctionFactory factory =
971 970
                        (DotNetExtensionFunctionFactory)config.getExtensionFunctionFactory("clitype");
972
                Expression call = factory.makeExtensionFunctionCall(functionName, theClass, method, argument);
971
                Expression call = factory.makeExtensionFunctionCall(getFunctionName(), theClass, method, argument);
973 972
                ExpressionTool.copyLocationInfo(this, call);
974 973
                return call;
975 974
            }
latest9.1/bj/net/sf/saxon/functions/JavaExtensionLibrary.java
872 872
    private class UnresolvedExtensionFunction extends CompileTimeFunction {
873 873

  
874 874
        private List candidateMethods;
875
        private StructuredQName functionName;
876 875
        private Class theClass;
877 876

  
878 877

  
879 878
        public UnresolvedExtensionFunction(StructuredQName functionName, Class theClass,
880 879
                                           List candidateMethods, Expression[] staticArgs) {
881 880
            setArguments(staticArgs);
882
            this.functionName = functionName;
881
            setFunctionName(functionName);
883 882
            this.theClass = theClass;
884 883
            this.candidateMethods = candidateMethods;
885 884
        }
......
899 898
            AccessibleObject method = getBestFit(candidateMethods, argument, theClass);
900 899
            if (method == null) {
901 900
                XPathException err = new XPathException("There is more than one method matching the function call " +
902
                        functionName.getDisplayName() +
901
                        getFunctionName().getDisplayName() +
903 902
                        ", and there is insufficient type information to determine which one should be used");
904 903
                err.setLocator(this);
905 904
                throw err;
906 905
            } else {
907 906
                JavaExtensionFunctionFactory factory =
908 907
                        (JavaExtensionFunctionFactory)config.getExtensionFunctionFactory("java");
909
                Expression call = factory.makeExtensionFunctionCall(functionName, theClass, method, argument);
908
                Expression call = factory.makeExtensionFunctionCall(getFunctionName(), theClass, method, argument);
910 909
                ExpressionTool.copyLocationInfo(this, call);
911 910
                return call.typeCheck(visitor, contextItemType);
912 911
            }

Also available in: Unified diff