Perhaps I should take a better look at my code though. Maybe the tool is telling me something.
I don't know your tool or development environment, but I highly doubth there's a mechanism for handling warnings at compile or runtime, although I do enjoy being proven wrong (it happens fairly often).
But warnings aren't a standard mechanism in Java, so we need to know how those warnings are produced to give you more useful hints.
[ January 01, 2007: Message edited by: Jim Yingst ]
Thanks for your inputs. I am trying to implement JBoss cache in my project. Warning is thrown by class file from JBoss, when it is unable to find a particular node. Though I was catching the exception, when there is some problem in deleting the node by JBOSS. it is not reaching the catch block, it just throws a warning and continues. I need some help on it.
it just throws a warning and continues.
Seems to me that no "warning" object is "thrown" - a warning message is written.
Therefore the question is: WHERE is the message written and can you intercept and parse it? What do the JBoss cache docs have to say?
[ January 03, 2007: Message edited by: William Brogden ]
Originally posted by Neeraj Vij:
Though I was catching the exception, when there is some problem in deleting the node by JBOSS. it is not reaching the catch block, it just throws a warning and continues.
AFAIK, JBossCache uses log4j to log messages. Why would you want to rely on those warning messages? Instead there's a API in JBossCache named
which tells you whether a node exists or not
However, for readers' interest, I thought I'd point out that other languages do have a programmatic mechanism for dealing with warnings. My boss was telling me about it, so it was probably in some flavours of Lisp. I believe that handling of warnings is optional and execution resumes from the same point after any handler has run. Sounds a Good Thing (TM). If anyone can tell me more, I'd be (somewhat) interested to know.
Originally posted by Peter Chase:
It seems that the Original Poster is mis-using terms like "catch", which have a very specific meaning in Java.
Exactly. Not only that, the word Warning is also being misunderstood in this context. The Warning that the poster is refering to is just a level in log4j to log messages. Also relying on those messages (which can be turned off anytime using log4j configurations) for doing some business logic does not seem right. Just my thoughts.