I'm working on plugin for JDeveloper 10.1.3.1 and 10.1.3.2, when using following rules with pmd 4.0
pmd.rule.BooleanGetMethodName
pmd.rule.EmptyCatchBlock
pmd.rule.LongVariable
pmd.rule.ProperLogger
pmd.rule.UncommentedEmptyConstructor
I get following error:
org.jaxen.XPathSyntaxException: Expected: (identifier)
at org.jaxen.BaseXPath.<init>(BaseXPath.java:136)
at org.jaxen.BaseXPath.<init>(BaseXPath.java:159)
at net.sourceforge.pmd.rules.XPathRule.createXPath(XPathRule.java:201)
at net.sourceforge.pmd.rules.XPathRule.initializeXPathExpression(XPathRule.java:152)
at net.sourceforge.pmd.rules.XPathRule.getRuleChainVisits(XPathRule.java:84)
The error happens deeply when calling
org.jaxen.exp.DefaultStep.getText, this raise UnsupportedAxisException for this rules. This is the related call for line
BaseXPath xpath = createXPath(relativeLocationPath.getText());
in net.sourceforge.pmd.rules.XPathRule.initializeXPathExpression
Regards
Torsten
Logged In: YES
user_id=342470
Originator: NO
Hi Torsten,
Can you verify for me that your plugin is using the version of Jaxen which ships with PMD, and not some other version which might be in the JDeveloper environment?
Thanks,
Ryan
Logged In: YES
user_id=1836297
Originator: YES
I deliver the jaxen version from pmd 4.0 with the plugin, but could be that some other plugin contains jaxen too.
How can I check this when debugging? Is it possible to output the whole classpath?
Logged In: YES
user_id=342470
Originator: NO
JVMs often provide options for verbose classloader output. You'll get a ton of output to dig through. For example Sun provides:
java -verbose:class
One can also try the following snippet in your code, sometimes you get some interesting .toString() results on the ClassLoader instances:
System.out.println(org.jaxen.BaseXPath.class.getClassLoader());
I've also worked on custom code that crawls the Classloader heirarchy via getParent() asking each ClassLoader to find a given resource. If one did that and printed out the URL of the resource, you could find where things are in the classpath.
It would be nice if Java had the equivalent of Unix which/whereis command(s):
ClassLoader.which(String resource)
I'm sure there's better ways to find out. I just don't know what they are. :)
Ryan
Logged In: YES
user_id=1836297
Originator: YES
Thank you, java -verbose:class shows me that jaxen-1.1-beta-4.jar is loaded from another JDeveloper extension path instead delivered jaxen-1.1.jar. Will check, which plugin installs this and how I can force the pmd plugin to use jaxen-1.1.jar in any case.
Logged In: YES
user_id=342470
Originator: NO
I'd close this given it's not a PMD problem, but the Tracker is not letting me do it. I'm definitely logged in.
Tom, are my settings okay?
Thanks,
Ryan
Logged In: YES
user_id=1836297
Originator: YES
Thank you, java -verbose:class shows me that jaxen-1.1-beta-4.jar is loaded from another JDeveloper extension path instead delivered jaxen-1.1.jar. Will check, which plugin installs this and how I can force the pmd plugin to use jaxen-1.1.jar in any case.
Logged In: YES
user_id=555114
Originator: NO
Closed for Ryan.