Author |
Message
|
christian witschel |
Posted: Fri Feb 08, 2008 1:51 am Post subject: createElementAsLastChildFromBitstream throws no exception |
|
|
Apprentice
Joined: 07 Dec 2005 Posts: 27
|
Hi,
Ich have the following Java Problem:
I use method createElementAsLastChildFromBitstream from MbElement to parse a byte array.
Works very nice, rather too nice. Even if the byte array content actually does not match the message set description I pass into the method.
How can I validate that createElementAsLastChildFromBitstream actually parsed a valid byte array.
For example I have a message set definition using a number of fixed length fields adding up to a line length of 124 characters. if I pass in the byte array of a string with 160 or 100 characters, the method still does not throw an Exception.
If I use a ApplyMessageSetNode with the same values on the other hand it will always throw an exception if the String was not 124 chars.
Any idea is welcome! |
|
Back to top |
|
 |
kimbert |
Posted: Fri Feb 08, 2008 4:04 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Interesting. Not sure about this one yet:
- What is an 'ApplyMessageSet' node. Is that another name for ResetContentDescriptor?
- What exception do you get when you use ApplyMessageSetNode?
- Did you have validation enabled in the messsage flow when using ApplyMessageSet?
If you are getting a validation exception, then you're stuck. You cannot enable validation via createElementAsLastChildFromBitstream. |
|
Back to top |
|
 |
christian witschel |
Posted: Fri Feb 08, 2008 7:35 am Post subject: |
|
|
Apprentice
Joined: 07 Dec 2005 Posts: 27
|
Hi,
Right, it is the ResetContentDescriptor node (just call it ApplyMessageSet all the time, my mistake).
The error message from the ResetContentDescriptior node will depend on what is wrong with the string. If it is too short then it will say for example:
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '2'
)
(0x01000000):ParserException = (
(0x03000000):File = '/build/S600_P/src/MTI/MTIforBroker/MtiImbParser2/MtiImbParser.cpp'
(0x03000000):Line = 614
(0x03000000):Function = 'MtiImbParser::parseRightSibling'
(0x03000000):Type = 'ComIbmResetContentDescriptorNode'
(0x03000000):Name = 'MCCSK_INTERFACES#FCMComposite_1_44'
(0x03000000):Label = 'MCCSK_INTERFACES.Apply_MSet_MCCSK_GMS_SCS_INVPAY'
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 5285
(0x03000000):Text = 'ImbRecoverableException caught from worker->parseNext.'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '2014_GMS_INV_PAY_INPUT'
)
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '1'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'TDS1'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'I2014_GMS_INV_PAY_INPUT'
)
(0x01000000):ParserException = (
(0x03000000):File = '/build/S600_P/src/cpi/pwf/nxd/nxdworker.cpp'
(0x03000000):Line = 456
(0x03000000):Function = 'NXDWorker::parseNext'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 1
(0x03000000):Number = 5421
(0x03000000):Text = 'TDS General Error'
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '113^TAX_AMOUNT'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = '/I2014_GMS_INV_PAY_INPUT/53^line/96^DETAIL/113^TAX_AMOUNT'
)
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '10818'
)
(0x01000000):ParserException = (
(0x03000000):File = '/build/S600_P/src/cpi/pwf/nxd/nxdscanner.cpp'
(0x03000000):Line = 103
(0x03000000):Function = 'NXDScanner::extractFixedLengthData'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Catalog = 'BIPv600'
(0x03000000):Severity = 3
(0x03000000):Number = 5426
(0x03000000):Text = 'Not enough data in bitstream'
) |
|
Back to top |
|
 |
kimbert |
Posted: Fri Feb 08, 2008 7:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
What happens if you specify the message format name incorrectly? ( just trying to find out whether you are getting *any* exceptions from the parser) |
|
Back to top |
|
 |
christian witschel |
Posted: Fri Feb 08, 2008 7:57 am Post subject: |
|
|
Apprentice
Joined: 07 Dec 2005 Posts: 27
|
one thought just came to me:
my createElementAsLastChildFromBitstream is within a try catch block just for this statement. I am catching java.lang.Exception. Could it be that a Parsing exception is a recoverable exception? Maybe recoverable exceptions are not thrown like normal exception in java but are working a different way? like MbNode.getRecoverableExceptions() (made up) |
|
Back to top |
|
 |
christian witschel |
Posted: Fri Feb 08, 2008 8:02 am Post subject: |
|
|
Apprentice
Joined: 07 Dec 2005 Posts: 27
|
kimbert wrote: |
What happens if you specify the message format name incorrectly? ( just trying to find out whether you are getting *any* exceptions from the parser) |
No exception is thrown. The element created is just empty (children or values).
could it be that I somehow turned something off? |
|
Back to top |
|
 |
kimbert |
Posted: Fri Feb 08, 2008 8:38 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I am catching java.lang.Exception |
Well, are you rethrowing the exception after catching it? If not, it will be discarded and the method will continue after the catch block. That could explain the symptoms. |
|
Back to top |
|
 |
christian witschel |
Posted: Fri Feb 08, 2008 8:45 am Post subject: |
|
|
Apprentice
Joined: 07 Dec 2005 Posts: 27
|
Thats not it.
I am rethrowing and also writing an entry to a log file.
Also the code after the method still within the same try catch is executed and then has a problem with an empty node.
Neither happens. So there must be no exception |
|
Back to top |
|
 |
kimbert |
Posted: Mon Feb 11, 2008 2:21 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I'm out of ideas - what you are describing sounds like a defect.
Unless anybody else has an idea, I suggest you open a PMR. If you do, please include the URL of this thread so that IBM service have the background. |
|
Back to top |
|
 |
christian witschel |
Posted: Wed Mar 26, 2008 4:32 am Post subject: |
|
|
Apprentice
Joined: 07 Dec 2005 Posts: 27
|
Hi,
problem solved.
The PMR clarified that the method truely does not throw an exception, because no parsing actually takes place within it.
Calling this method just tells the broker to ready itself for parsing. The actual parsing takes place when the result is accessed for the first time. They call this on demand parsing. While parsing then exceptions are thrown.
My problem was that at a later stage when the parsed data was used, there was a debug method that consumed all exceptions the parser threw without doing any log or else.
We removed this method and all other try catch blocks "below". Now all exceptions are caught at one higher central place in the java code.
Works fine now. |
|
Back to top |
|
 |
|