I’m starting in Sonar and I need to create a rule that verify if a throw statement is launched with a message passed as argument or not, as example, “throw new ServiceException (e)”. I’m trying to use ThrowStatementTree, but there isn’t a method to get the argument. How can I do it? I’m using Sonar 5.6.7. Thank you.
Hi, Godin. Thank you for answer. Sorry for my inexperience. I used expression method and tried to manipulate it but I only get the object. I tried to use IdentifierTree to get the value of the expression, but without sucess. I tried to use arguments with NewClassTree but without sucess too. How can I get the argument value?
Yes, Michael. It’s what I wanted. I already got it. As I hadn’t a more detailed explanation before, I searched internet and I saw a post from you in another site about a similar question. Then I followed it to based my research and I was able to develop the rule.