|
From: Steve B. <st...@te...> - 2007-09-14 11:15:47
|
Hello John,
The Session does not use the message string in the FieldNotFound exception.
It uses the "field" member to format a message in the business reject. The
constructor taking a string is there for compatibility with the C++ JNI
library. In recent versions of QFJ, a message string is created in the
integer-based constructor, which may be useful if the exception is printed.
However, the Session doesn't use the message.
You could modify your code to.
} catch (FieldNotFound ex) {
log.error(ex.field + " not found in message.");
.
}
You can also use the isSetField() methods to determine if the field is there
without raising an exception.
Regards,
Steve
_____
From: qui...@li...
[mailto:qui...@li...] On Behalf Of John
Coleman
Sent: Friday, September 14, 2007 6:17 AM
To: qui...@li...
Subject: [Quickfixj-users] FieldNotFound exceptions with null message
I am finding that newOrderSingle.getOrderQty() throws FieldNotFound, however
field 58 of the rejection message isn't passed back because the exception
message has no message text. I've had to rethrow the message with my own
text, see hacks below. I wonder how this occurs given that the exception is
supposed to be instantiated with either a field number or message string?
I'm using QFJ 1.04.
field = "OrderQty";
holder.setOrderQty(newOrderSingle.getOrderQty());
if (newOrderSingle.getOrderQty() != null &&
newOrderSingle.getOrderQty().getValue() == 0) {
throw new RuntimeException(
"OrderQty is zero in message with ClOrdID = " +
clOrdID.getValue());
}
field = "Symbol";
holder.setSymbol(newOrderSingle.getSymbol());
field = "SettlType";
holder.setSettlType(newOrderSingle.getSettlType());
field = "SettlDate";
holder.setSettlDate(newOrderSingle.getSettlDate());
} catch (FieldNotFound ex) {
log.error(
methodName + field + " not found in message "
+ "with ClOrdID = " + clOrdID.getValue());
throw new FieldNotFound("Field "+field+" was not found in
message.");
TIA
John Coleman, MSTA
Senior Java Developer
Eurobase Banking Solutions
Bury House, 31 Bury Street,
London EC3A 5AG, U.K.
Office: +44 (0)1245 496 706, Fax: +44 (0)20 7626 6203
Mobile: +44 (0)7734 506586
Eurobase International Limited and its subsidiaries (Eurobase) are unable to
exercise control over the content of information in E-Mails. Any views and
opinions expressed may be personal to the sender and are not necessarily
those of Eurobase. Eurobase will not enter into any contractual obligations
in respect of any part of its business in any E-mail.
Privileged / confidential information may be contained in this message and
/or any attachments. This E-mail is intended for the use of the addressee(s)
only and may contain confidential information. If you are not the / an
intended recipient, you are hereby notified that any use or dissemination of
this communication is strictly prohibited. If you receive this transmission
in error, please notify us immediately, and then delete this E-mail.
Neither the sender nor Eurobase accepts any liability whatsoever for any
defects of any kind either in or arising from this E-mail transmission.
E-Mail transmission cannot be guaranteed to be secure or error-free, as
messages can be intercepted, lost, corrupted, destroyed, contain viruses, or
arrive late or incomplete. Eurobase does not accept any responsibility for
viruses and it is your responsibility to scan any attachments.
Eurobase Systems Limited is the main trading company in the Eurobase
International Group; registered in England and Wales as company number
02251162; registered address: Essex House, 2 County Place, Chelmsford, Essex
CM2 0RE, UK.
|