Project

Profile

Help

Revision 00082f6f

Added by O'Neil Delpratt 8 months ago

Saxon/C bug fixes

View differences:

src/main/c/Saxon.C.API/Xslt30Processor.cpp
22 22
Xslt30Processor::Xslt30Processor(SaxonProcessor * p, std::string curr) {
23 23

  
24 24
	proc = p;
25
    tunnel = false;
26
    jitCompilation = false;
27
    exception = nullptr;
25 28

  
26 29
	/*
27 30
	 * Look for class.
......
37 40
	SaxonProcessor::sxn_environ->env->CallStaticVoidMethod(cppClass, debugMID, (jboolean)true);
38 41
    
39 42
#endif
40
	tunnel = false;
41
	jitCompilation = false;
42
	exception = nullptr;
43

  
44
	if(cppXT == nullptr) {
45
	    exception = proc->checkAndCreateException(cppClass);
46
	}
43 47

  
44 48
	if(!(proc->cwd.empty()) && curr.empty()){
45 49
		cwdXT = proc->cwd;
......
83 87

  
84 88

  
85 89
bool Xslt30Processor::exceptionOccurred() {
86
	return proc->exceptionOccurred();
90
	return proc->exceptionOccurred() || exception != nullptr;
87 91
}
88 92

  
89 93
const char * Xslt30Processor::getErrorCode() {
......
198 202
					"(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;)V");
199 203
	}
200 204
	if (!cAndSNodemID) {
201
		std::cerr << "Error: "<<getDllname() << ".compileFromStringAndSave"
202
				<< " not found\n" << std::endl;
205
		std::cerr<<"Error: "<<getDllname<<"compileFromStringAndSave funtion not found"<<std::endl;
203 206

  
204 207
	} else {
205

  
208
        if(cppXT == nullptr) {
209
#if defined(DEBUG)
210
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
211
#endif
212
            return;
213
        }
206 214
		
207 215
		SaxonProcessor::sxn_environ->env->CallObjectMethod(cppXT, cAndSNodemID,
208 216
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
......
224 232
					"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
225 233
	}
226 234
	if (!cAndSStringmID) {
227
		std::cerr << "Error: "<<getDllname() << ".compileFromStringAndSave"
228
				<< " not found\n" << std::endl;
235
		exception = new SaxonApiException("Error: compileFromStringAndSave function not found\n");
229 236

  
230 237
	} else {
231

  
238
        if(cppXT == nullptr) {
239
#if defined(DEBUG)
240
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
241
#endif
242
            return;
243
        }
232 244
		
233 245
		SaxonProcessor::sxn_environ->env->CallObjectMethod(cppXT, cAndSStringmID,
234 246
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
......
251 263
					"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
252 264
	}
253 265
	if (!cAndFStringmID) {
254
		std::cerr << "Error: "<<getDllname() << ".compileFromFileAndSave"
255
				<< " not found\n" << std::endl;
266
		exception = new SaxonApiException("Error: compileFromFileAndSave function not found");
256 267

  
257 268
	} else {
258 269

  
259
		
270
        if(cppXT == nullptr) {
271
#if defined(DEBUG)
272
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
273
#endif
274
            return;
275
        }
260 276
		SaxonProcessor::sxn_environ->env->CallObjectMethod(cppXT, cAndFStringmID,
261 277
						SaxonProcessor::sxn_environ->env->NewStringUTF(cwdXT.c_str()),
262 278
						SaxonProcessor::sxn_environ->env->NewStringUTF(xslFilename),SaxonProcessor::sxn_environ->env->NewStringUTF(filename));
......
276 292
	}
277 293
					
278 294
	if (cStringmID== nullptr) {
279
		std::cerr << "Error: "<<getDllname() << ".compileFromString"
280
				<< " not found\n" << std::endl;
295
		exception = new SaxonApiException(strcat(getDllname(), ".compileFromString funtion not found"));
281 296
		return nullptr;
282 297

  
283 298
	} else {
284

  
299
        if(cppXT == nullptr) {
300
#if defined(DEBUG)
301
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
302
#endif
303
            return nullptr;
304
        }
285 305
		JParameters comboArrays;
286 306
		comboArrays = SaxonProcessor::createParameterJArray2(parameters);
287 307
		jobject executableObject = (jobject)(
......
317 337
		return nullptr;
318 338

  
319 339
	} else {
340
	    if(node == nullptr) {
341
	        exception = new SaxonApiException("Error in compileFromXdmNode - node argument is NULL");
342
	        return nullptr;
343
	    }
344
        if(cppXT == nullptr) {
345
#if defined(DEBUG)
346
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
347
#endif
348
            return nullptr;
349
        }
320 350
		JParameters comboArrays;
321 351
		comboArrays = SaxonProcessor::createParameterJArray2(parameters);
322 352
		jobject executableObject = (jobject)(
......
354 384
	} else {
355 385
		
356 386
		if(source == nullptr) {
357
			std::cerr << "Error in compileFromFile method - The Stylesheet file is nullptr" <<std::endl;
387
			exception = new SaxonApiException("Error in compileFromFile method - The Stylesheet file is NULL");
358 388
			return nullptr;
359 389
		}
390
        if(cppXT == nullptr) {
391
#if defined(DEBUG)
392
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
393
#endif
394
            return nullptr;
395
        }
360 396
		JParameters comboArrays;
361 397
		comboArrays = SaxonProcessor::createParameterJArray2(parameters);
362 398
		jobject executableObject = (jobject)(
......
387 423
					"compileFromFile",
388 424
					"(Ljava/lang/String;Ljava/lang/String;Z[Ljava/lang/String;[Ljava/lang/Object;)Lnet/sf/saxon/s9api/XsltExecutable;");
389 425
	}
426

  
390 427
	if (!cFilemID) {
391 428
		std::cerr << "Error: "<<getDllname() << ".compileFromFile"
392 429
				<< " not found\n" << std::endl;
430
        std::cerr<<"cp0 -testCatalog"<<std::endl;
393 431
		return nullptr;
394 432

  
395 433
	} else {
396

  
397 434
        if (stylesheet == nullptr) {
398
            std::cerr << "Error in compileFromFile method - The Stylesheet file is nullptr" << std::endl;
435
            exception = new SaxonApiException("Error in compileFromFile method - The Stylesheet file is nullptr");
436
            return nullptr;
437
        }
438
        if(cppXT == nullptr) {
439
#if defined(DEBUG)
440
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
441
#endif
442

  
399 443
            return nullptr;
400 444
        }
445

  
401 446
        JParameters comboArrays;
402 447
        comboArrays = SaxonProcessor::createParameterJArray2(parameters);
403 448
        jobject executableObject = (jobject) (
......
453 498
					"(Ljava/lang/String;Lnet/sf/saxon/option/cpp/Xslt30Processor;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)Lnet/sf/saxon/s9api/XdmValue;");
454 499
	}
455 500
	if (!mtvID) {
456
		std::cerr << "Error: "<< getDllname() << ".transformtoValue" << " not found\n"
457
				<< std::endl;
501
        std::cerr<<"Error: "<<getDllname<<".transformtoValue function not found"<<std::endl;
458 502

  
459 503
	} else {
504
        if(cppXT == nullptr) {
505
#if defined(DEBUG)
506
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
507
#endif
508
            return nullptr;
509
        }
460 510
	    JParameters comboArrays;
461 511
		comboArrays = SaxonProcessor::createParameterJArray2(parameters);
462 512

  
......
537 587
					"(Ljava/lang/String;Lnet/sf/saxon/option/cpp/Xslt30Processor;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)V");
538 588
	}
539 589
	if (!mtfID) {
540
		std::cerr << "Error: "<<getDllname() << "transformToFile" << " not found\n"
541
				<< std::endl;
590
        std::cerr<<"Error: "<<getDllname<<".transformToFile function not found"<<std::endl;
542 591

  
543 592
	} else {
593
        if(cppXT == nullptr) {
594
#if defined(DEBUG)
595
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
596
#endif
597
            return;
598
        }
544 599
	    JParameters comboArrays;
545 600
        comboArrays = SaxonProcessor::createParameterJArray2(parameters);
546 601

  
......
579 634
					"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;");
580 635
	}
581 636
	if (!mtsID) {
582
		std::cerr << "Error: "<<getDllname() << "transformFileToString" << " not found\n"
583
				<< std::endl;
637
        std::cerr<<"Error: "<<getDllname<<".transformFileToString not found"<<std::endl;
584 638

  
585 639
	} else {
640
        if(cppXT == nullptr) {
641
#if defined(DEBUG)
642
            std::cerr << "The Java Xslt30Processor object (i.e. cppXT) is NULL - Possible exception thrown" << std::endl;
643
#endif
644
            return nullptr;
645
        }
586 646
    JParameters comboArrays;
587 647
    comboArrays = SaxonProcessor::createParameterJArray2(parameters);
588 648

  

Also available in: Unified diff