Project

Profile

Help

Revision 01d6fdb6

Added by O'Neil Delpratt 5 months ago

Saxon/C development

View differences:

src/main/c/Saxon.C.API/Xslt30Processor.cpp
38 38
	cppClass = lookForClass(SaxonProcessor::sxn_environ->env,
39 39
			"net/sf/saxon/option/cpp/Xslt30Processor");
40 40

  
41
	cppXT = createSaxonProcessor2(SaxonProcessor::sxn_environ->env, cppClass,
41
	jobject tempcppXT = createSaxonProcessor2(SaxonProcessor::sxn_environ->env, cppClass,
42 42
			"(Lnet/sf/saxon/s9api/Processor;)V", proc->proc);
43
	if(tempcppXT) {
44
        cppXT = SaxonProcessor::sxn_environ->env->NewGlobalRef(tempcppXT);
45
    } else {
46
	    createException("Error: Failed to create the Xslt30Processor internal object");
47

  
48
	}
43 49

  
44 50
#ifdef DEBUG
45 51
	jmethodID debugMID = SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass, "setDebugMode", "(Z)V");
......
60 66

  
61 67
    Xslt30Processor::~Xslt30Processor(){
62 68
	    clearParameters();
63
	    SaxonProcessor::sxn_environ->env->DeleteLocalRef(cppXT);
69
	    SaxonProcessor::sxn_environ->env->DeleteGlobalRef(cppXT);
64 70
	    cwdXT.erase();
65 71
	    exceptionClear();
66 72
    }
......
193 199
}
194 200

  
195 201
void Xslt30Processor::createException(const char * message) {
196
    exceptionClear();
202
    if(exception != nullptr) {
203
        delete exception;
204
        exception = nullptr;
205
    }
197 206
    if(message == nullptr) {
198 207
        exception = proc->checkAndCreateException(cppClass);
199 208
    } else {
......
632 641
	    JParameters comboArrays;
633 642
        comboArrays = SaxonProcessor::createParameterJArray2(parameters);
634 643

  
635
		SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, mtfID,
644
		SaxonProcessor::sxn_environ->env->CallStaticVoidMethod(cppClass, mtfID,
636 645
								SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()), cppXT, nullptr,
637 646
								(source != nullptr ? SaxonProcessor::sxn_environ->env->NewStringUTF(source) : nullptr),
638 647
								SaxonProcessor::sxn_environ->env->NewStringUTF(stylesheet),	(outputfile != nullptr ? SaxonProcessor::sxn_environ->env->NewStringUTF(outputfile) :nullptr),

Also available in: Unified diff