Project

Profile

Help

Revision 50e062ec

Added by O'Neil Delpratt almost 6 years ago

Saxon/C update to C++ code

View differences:

latest9.6/hec/Saxon.C.API/SaxonProcessor.cpp
51 51

  
52 52

  
53 53

  
54
//TODO - Exception handling in Saxon/C on both Java side and C++ side does not correctly handle multiple exceptions
55
//This needs working on in the next release
56 54
SaxonApiException * SaxonProcessor::checkForExceptionCPP(JNIEnv* env, jclass callingClass,  jobject callingObject){
57 55

  
58 56
    if (env->ExceptionCheck()) {
......
76 74
	if(getMessage) {
77 75

  
78 76
		jstring message(static_cast<jstring>(env->CallObjectMethod(exc, getMessage)));
79
        	char const* utfMessage(env->GetStringUTFChars(message, 0));
77
		char const* utfMessage = NULL;		
78
		if(!message) {
79
			utfMessage = "";
80
			return NULL;
81
		} else {
82
        		utfMessage = (env->GetStringUTFChars(message, 0));
83
		}
80 84
		if(utfMessage != NULL) {
81 85
			result1 = (result1 + " : ") + utfMessage;
82
		}
83
		//cout<<"ExceptionMessage ZZZ: "<<result1<<endl;
86
		} 
87
		
84 88
		//env->ReleaseStringUTFChars(message,utfMessage);
85
		if(callingObject != NULL && result1.compare(0,36, "net.sf.saxon.s9api.SaxonApiException", 36) == 0){
86
			jmethodID  getErrorCodeID(env->GetMethodID(callingClass, "getExceptions", "()[Lnet/sf/saxon/option/cpp/SaxonExceptionForCpp;"));
87
			jclass saxonExceptionClass(env->FindClass("net/sf/saxon/option/cpp/SaxonExceptionForCpp"));
89
		if(callingObject != NULL && result1.compare(0,36, "net.sf.saxon.option.cpp.SaxonCException", 36) == 0){
90
			jmethodID  getErrorCodeID(env->GetMethodID(callingClass, "getExceptions", "()[Lnet/sf/saxon/option/cpp/SaxonCException;"));
91
			jclass saxonExceptionClass(env->FindClass("net/sf/saxon/option/cpp/SaxonCException"));
88 92
				if(getErrorCodeID){	
89 93
					jobjectArray saxonExceptionObject((jobjectArray)(env->CallObjectMethod(callingObject, getErrorCodeID)));
90 94
					if(saxonExceptionObject) {
latest9.6/hec/Saxon.C.API/XsltProcessor.cpp
248 248
						proc->environ->env->NewStringUTF(stylesheet)));
249 249
		if (!stylesheetObject) {
250 250
			if(exceptionOccurred()) {
251
				cerr<<"Error in compile of Stylesheet"<<endl;
251
				
252 252
				if(proc->exception != NULL) {
253 253
					delete proc->exception;
254 254
				}

Also available in: Unified diff