Project

Profile

Help

Revision 250c5839

Added by O'Neil Delpratt 10 months ago

Saxon/C fixes

View differences:

latest10/hec/Saxon.C.API/SaxonProcessor.cpp
28 28
//jobject cpp;
29 29
const char * failure;
30 30
sxnc_environment * SaxonProcessor::sxn_environ = 0;
31
int SaxonProcessor::refCount = 0;
32 31
int SaxonProcessor::jvmCreatedCPP=0;
33 32

  
34 33
bool SaxonProcessor::exceptionOccurred(){
......
170 169
    cwd="";
171 170
    licensei = l;
172 171
    versionStr = NULL;
173
    SaxonProcessor::refCount++;
174 172

  
175 173
     if(SaxonProcessor::jvmCreatedCPP == 0){
176 174
	SaxonProcessor::jvmCreatedCPP=1;
......
201 199
    procClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/Processor");
202 200
    saxonCAPIClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/SaxonCAPI");
203 201
    
204
    proc = createSaxonProcessor (SaxonProcessor::sxn_environ->env, procClass, "(Z)V", NULL, licensei);
202
    jobject proci = createSaxonProcessor (SaxonProcessor::sxn_environ->env, procClass, "(Z)V", NULL, licensei);
203
    proc = SaxonProcessor::sxn_environ->env->NewGlobalRef(proci);
205 204
	if(!proc) {
206 205
		std::cout<<"proc is NULL in SaxonProcessor constructor"<<std::endl;
207 206
	}
......
216 215
SaxonProcessor::SaxonProcessor(const char * configFile){
217 216
    cwd="";
218 217
    versionStr = NULL;
219
    SaxonProcessor::refCount++;
220 218

  
221 219
    if(SaxonProcessor::jvmCreatedCPP == 0){
222 220
	SaxonProcessor::jvmCreatedCPP=1;
......
249 247
				<< " not found\n" << std::endl;
250 248
			return ;
251 249
		}
252
	proc = SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDcreateProc,SaxonProcessor::sxn_environ->env->NewStringUTF(configFile));
253
		
250
	jboject proci = SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(saxonCAPIClass, mIDcreateProc,SaxonProcessor::sxn_environ->env->NewStringUTF(configFile));
251
	proc = SaxonProcessor::sxn_environ->env->NewGlobalRef(proci);
254 252
	if(!proc) {
255 253
		checkAndCreateException(saxonCAPIClass);
256 254
		std::cerr << "Error: "<<getDllname() << ". processor is NULL in constructor(configFile)"<< std::endl;
......
267 265

  
268 266
    SaxonProcessor::~SaxonProcessor(){
269 267
	clearConfigurationProperties();
268
	SaxonProcessor::sxn_environ->env->NewDeleteGlobalRef(proc);
270 269
	if(versionStr != NULL) {
271 270
		delete versionStr;
272 271
	}
273
	SaxonProcessor::refCount--;	//This might be redundant due to the bug fix 2670
274 272
   }
275 273

  
276 274

  

Also available in: Unified diff