camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravivadgaonkar <>
Subject A bean method called from route throws error when accessing JMSTimestamp
Date Tue, 01 Mar 2016 17:03:11 GMT
I had below method where I was forwarding message body and headers from camel
It was all working fine until I started fetching JMSTimestamp from header.

It threw an exception - can not cast Long to String. below is how the code
was written.

public void handleMessage(String message, Map<String, String> headers)
			throws Exception {


I was able to figure out though that before fetching the value from Map, it
tries to convert it to string and that is when it fails. The question, I
have is,

Should this not have given exception while the function is invoked itself
since it would create the map as soon as the function is invoked and it will
change the long type to string then itself.
This sounds like Lazy type conversion, am I right ?

Trying to understand if this is an issue or normal behaviour? If it is
normal behaviour then it will add up some knowledge about Map to me, hence
the question.

I changed the map to <String, Object> and did the type conversion as and
when needed and it works fine.

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message