Project

Profile

Help

Revision 4e3fba42

Added by O'Neil Delpratt over 5 years ago

Saxon/C bug fix relating to static sxn_environ

View differences:

latest9.6/hec/Saxon.C.API/XdmAtomicValue.cpp
30 30
	}
31 31
	
32 32
	if(proc != NULL) {
33
		jclass xdmUtilsClass = lookForClass(sxn_environ->env, "net/sf/saxon/option/cpp/XdmUtils");
34
		jmethodID xmID = (jmethodID) sxn_environ->env->GetStaticMethodID(xdmUtilsClass,"getPrimitiveTypeName",
33
		jclass xdmUtilsClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/XdmUtils");
34
		jmethodID xmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(xdmUtilsClass,"getPrimitiveTypeName",
35 35
					"(Lnet/sf/saxon/s9api/XdmAtomicValue;)Ljava/lang/String;");
36 36
		if (!xmID) {
37 37
			std::cerr << "Error: SaxonDll." << "getPrimitiveTypeName"
38 38
				<< " not found\n" << std::endl;
39 39
			return "";
40 40
		}
41
		jstring result = (jstring)(sxn_environ->env->CallStaticObjectMethod(xdmUtilsClass, xmID,value->xdmvalue));
41
		jstring result = (jstring)(SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(xdmUtilsClass, xmID,value->xdmvalue));
42 42
		if(result) {
43
			const char * stri = sxn_environ->env->GetStringUTFChars(result,
43
			const char * stri = SaxonProcessor::sxn_environ->env->GetStringUTFChars(result,
44 44
					NULL);
45 45
		
46
		//sxn_environ->env->DeleteLocalRef(result);
46
		//SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
47 47

  
48 48
			return stri;
49 49
		}
......
55 55

  
56 56
    bool XdmAtomicValue::getBooleanValue(){
57 57
	if(proc != NULL) {
58
		jclass xdmNodeClass = lookForClass(sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
59
		jmethodID bmID = (jmethodID) sxn_environ->env->GetMethodID(xdmNodeClass,
58
		jclass xdmNodeClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
59
		jmethodID bmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmNodeClass,
60 60
					"getBooleanValue",
61 61
					"()Z");
62 62
		if (!bmID) {
......
64 64
				<< " not found\n" << std::endl;
65 65
			return false;
66 66
		} else {
67
			jboolean result = (jboolean)(sxn_environ->env->CallBooleanMethod(value->xdmvalue, bmID));
67
			jboolean result = (jboolean)(SaxonProcessor::sxn_environ->env->CallBooleanMethod(value->xdmvalue, bmID));
68 68
			if(result) {
69 69
				return (bool)result;
70 70
			}
......
77 77

  
78 78
    double XdmAtomicValue::getDoubleValue(){
79 79
	if(proc != NULL) {
80
		jclass xdmNodeClass = lookForClass(sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
81
		jmethodID bmID = (jmethodID) sxn_environ->env->GetMethodID(xdmNodeClass,
80
		jclass xdmNodeClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
81
		jmethodID bmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmNodeClass,
82 82
					"getDoubleValue",
83 83
					"()D");
84 84
		if (!bmID) {
......
86 86
				<< " not found\n" << std::endl;
87 87
			return 0;
88 88
		} else {
89
			jdouble result = (jdouble)(sxn_environ->env->CallDoubleMethod(value->xdmvalue, bmID));
89
			jdouble result = (jdouble)(SaxonProcessor::sxn_environ->env->CallDoubleMethod(value->xdmvalue, bmID));
90 90
			if(result) {
91 91
				return (double)result;
92 92
			}
93
checkForException(*(sxn_environ), xdmNodeClass, NULL);
93
checkForException(*(SaxonProcessor::sxn_environ), xdmNodeClass, NULL);
94 94
		}
95 95
	} else {
96 96
		std::cerr<<"Error: Processor not set in XdmAtomicValue"<<std::endl;
......
109 109

  
110 110
    long XdmAtomicValue::getLongValue(){
111 111
		if(proc != NULL) {
112
		jclass xdmNodeClass = lookForClass(sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
113
		jmethodID bmID = (jmethodID) sxn_environ->env->GetMethodID(xdmNodeClass,
112
		jclass xdmNodeClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmAtomicValue");
113
		jmethodID bmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(xdmNodeClass,
114 114
					"getLongValue",
115 115
					"()J");
116 116
		if (!bmID) {
......
118 118
				<< " not found\n" << std::endl;
119 119
			return 0;
120 120
		} else {
121
			jlong result = (jlong)(sxn_environ->env->CallObjectMethod(value->xdmvalue, bmID));
121
			jlong result = (jlong)(SaxonProcessor::sxn_environ->env->CallObjectMethod(value->xdmvalue, bmID));
122 122
			if(result) {
123 123
				return (long)result;
124 124
			}

Also available in: Unified diff