Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
SystemAdmin
SystemAdmin
746 Posts
ACCEPTED ANSWER

Pinned topic Possible to use XPath?

‏2012-04-26T12:50:07Z |
Hi,

I am using PMD and will implement a new rule. The rule needs to make sure that if we have the following line:

if(Logger.enabled()){
Logger.fine();
}

The rule needs to make sure that when we have a Logger.fine() the previous line must be:

if(Logger.enabled())

Is it possible to check this with an xpath expression? I have no problems in matching the Logger.fine() - method.

//MethodDeclaration//StatementExpression//PrimaryExpression//PrimaryPrefix

Then when this condition is fullfilled I need to check if the previous line is a if(Logger.enabled()). Is even possible?

All advice is appreciated.

br,

//mike