Re: [Quickfix-developers] Java methods setString() etc. should catch null values
Brought to you by:
orenmnero
|
From: Oren M. <ore...@ya...> - 2003-04-25 21:02:16
|
Agreed. Both with the idea and method of execution.
Joerg Thoennes <Joe...@ma...> wrote:Hi Oren,
if I set a String field with a Java null value, this is handed through to the C++
code as a NULL pointer. Here it leads to core dumps...
152 JNIEXPORT void JNICALL Java_org_quickfix_Message_setString0
153 ( JNIEnv *pEnv, jobject obj, jint field, jstring value )
154 { QF_STACK_TRY
155
156 JVM::set( pEnv );
157 FIX::Message* pMessage = getCPPMessage( obj );
158 setString( *pMessage, field, value );
^^^^^ = NULL for Java null
159
160 QF_STACK_CATCH
161 }
162
IMHO, all such places where Java nulls could occur should be appropriately handling,
eg by throwing a runtime exception java.lang.NullPointerException. This is what Java
programmers expect.
Most easily the checks could be added into org/quickfix/Message.java:
if ( null == value ) {
throw new NullPointerException( "...detail message..." );
}
Cheers, Jörg
--
Joerg Thoennes
http://macd.com
Tel.: +49 (0)241 44597-24 Macdonald Associates GmbH
Fax : +49 (0)241 44597-10 Lothringer Str. 52, D-52070 Aachen
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Quickfix-developers mailing list
Qui...@li...
https://lists.sourceforge.net/lists/listinfo/quickfix-developers
---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo. |