Thread: [Quickfix-developers] problems with quickfix-1.4.1 - Java code
Brought to you by:
orenmnero
From: Mike H. <mi...@an...> - 2003-04-10 09:45:27
|
Hi All, we've found a couple of 'features' with the new release: (1) trying to (java) compile an application that cracks FIX4.3 messages (in Java) with quickfix 1.4.1 is slightly broken due to some missing throw specifiers in the socket initiator/acceptor classes (see Socket Acceptor, Initiator diff's below) (2) when calling the onRun() method, we get a crash in the native code due to some Exceptions not being initialised correctly. we've disabled the exception catching in this method to get things working again (see JavaApplication.ccp diffs below). The crash occurs when creating an Exception on the stack - the stack trace shows a class not found type of error - however jar -tvf on quickfix.jar shows the Exception class DoNotSend is there and available. Any ideas ?? Cheers Mike heres the stack trace: #0 0x40092851 in kill () from /lib/libc.so.6 (gdb) bt #0 0x40092851 in kill () from /lib/libc.so.6 #1 0x4001ee8d in raise () from /lib/libpthread.so.0 #2 0x40092504 in raise () from /lib/libc.so.6 #3 0x40093b3b in abort () from /lib/libc.so.6 #4 0x4d80bfb7 in __cxxabiv1::__terminate(void (*)()) ( handler=3D0x400939b0 <abort>) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47 #5 0x4d80c004 in std::terminate() () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57 #6 0x4d80c176 in __cxa_throw () at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:77 #7 0x4d6a6e3a in JVMClass (this=3D0xb91ffa9c,=20 name=3D0x4d73ef33 "DoNotSend;") at JVM.h:119 #8 0x4d6aa5e0 in Exceptions (this=3D0xb91ffa9c) at JavaApplication.h:92 #9 0x4d6a84b0 in JavaApplication::onRun() (this=3D0x8706af0) at JavaApplication.cpp:190 #10 0x4d6ff2b6 in __static_initialization_and_destruction_0 ( __initialize_p=3D142517072, __priority=3D-1189086092) at SessionSettings.h:66 #11 0x4001bf30 in pthread_detach () from /lib/libpthread.so.0 --- SocketAcceptor.java.bak 2003-04-09 13:51:36.000000000 +0100 +++ SocketAcceptor.java 2003-04-09 13:51:58.000000000 +0100 @@ -90,7 +90,7 @@ private native void create(); private native void destroy(); =20 - public void start() throws RuntimeError { + public void start() throws RuntimeError, ConfigError { doStart(); } =20 @@ -98,7 +98,7 @@ doStop(); } =20 - private native void doStart() throws RuntimeError; + private native void doStart() throws RuntimeError, ConfigError; =20 private native void doStop(); } --- SocketInitiator.java.bak 2003-04-09 13:54:48.000000000 +0100 +++ SocketInitiator.java 2003-04-09 13:52:33.000000000 +0100 @@ -90,15 +90,15 @@ private native void create(); private native void destroy(); =20 - public void start() throws RuntimeError { + public void start() throws RuntimeError, ConfigError { doStart(); } - =20 + public void stop() { doStop(); } =20 - private native void doStart() throws RuntimeError; + private native void doStart() throws RuntimeError, ConfigError; =20 private native void doStop(); } --- JavaApplication.cpp 2003-04-09 18:11:33.000000000 +0100 +++ /home/mike/src/quickfix.back/src/java/JavaApplication.cpp 2003-03-20 15:16:13.000000000 +0000 @@ -186,9 +178,7 @@ void JavaApplication::onRun() { JNIEnv * pEnv =3D ENV::get(); - // Exceptions e; pEnv->CallVoidMethod( m_object, onRunId ); - // handleException( pEnv, e ); JVM::get() ->DetachCurrentThread(); }; |
From: Joerg T. <Joe...@ma...> - 2003-04-10 17:43:14
|
> (1) trying to (java) compile an application that cracks FIX4.3 messages > (in Java) with quickfix 1.4.1 is slightly broken due to some missing > throw specifiers in the socket initiator/acceptor classes (see Socket > Acceptor, Initiator diff's below) Regarding exception names: Java has a naming standard here, and it would be nice if QuickFIX could also adhere to this standard: - Checked exceptions extend java.lang.Exception and must be specified in the throws clause. They are named XyzException. They should be used in all cases where the programmer could deal with the problem indicated, eg just retry or try some other way. - Unchecked exceptions extend java.lang.RuntimeException and can be left out of the throws clause. They normally indicate programming errors (ArrayOutOfBoundsException etc.) and the programmer is not expected to do any useful recovery. The program should terminate. - Errors extend java.lang.Error and indicate fatal runtime errors: "An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions." Examples are OutOfMemoryError, StackOverFlowError etc. It would be good if the exception naming of QuickFIX could reflect this, e.g. the ConfigError should be changed to the ConfigException, the UnsupportedMessageType to UnsupportedMessageTypeException. OK, this is a major change, but would make the API more consistent. 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 |