Errors parsing methods that throw custom exceptions
Brought to you by:
henri_tremblay
I am using JBCS 2.0 in JBuilder 2005 update 4 on WinXP.
JBCS reports the following error for all classes that
contain methods which throw custom exceptions:
0: Got an exception - java.lang.RuntimeException:
Unable to get class information for
IlvGanttReaderException.
The error is always reported for line 0 of the class. I
use the exact same CheckStyle configuration file for my
Maven builds with no such problem. IOW, I have JBCS
pointing at the config file I use with the Maven
CheckStyle plugin.
Logged In: YES
user_id=893525
I didn't tried to reproduce yet but I'll just check
something. JBCS is by default using checkstyle 4.0 beta 4.
Last version is beta 6 and according to the release notes
they fixed some issues on the RedundantThrowsCheck (which is
causing your error). Can you check which version maven is
using? If versions are different, just try to update the
jbcs version (by copying checkstyle jars in JBuilder lib/ext
dir) to see how it goes. Please tell me if everything starts
to work. I'll close the bug.
Logged In: YES
user_id=893525
My previous comment is still valid but on a second thought,
I think you have a classpath issue. Maven is probably giving
to checkstyle a classpath using the project dependencies.
JBCS doesn't. I'll have a look and fix it probably by adding
the JBuilder project classpath to Checkstyle.
Logged In: YES
user_id=729031
Per your suggestion, I deleted the checkstyle 4.0-beta4 jars
from my JBuilder2005/lib/ext directory and added the new
checkstyle 4.0-beta6 jars. However, no change. I am still
getting the same error when JBCS parses certain files.
Additional bits of info that may be helpful:
The custom exception class is public and is in the same
package and source directory as the class throwing the
exception and that is being checkstyled. Therefore, I would
think that there should not be any classpath issues?
I am using Maven v1.0.2 with CheckStyle plugin v2.5. This
version of the plugin is using CheckStyle v3.4.
JBuilder 2005 Test Project
Logged In: YES
user_id=729031
I have uploaded an extremely simple JBuilder 2005 project
that reproduces the problem for me.
Logged In: YES
user_id=893525
Ok, the problem is as I said a classpath issue. Usually,
checkstyle checks are not dependant on the classpath.
However, some checks like RedundantThrows are. When
checkstyle is ran with maven, maven gaves to the ant task
the project classpath, so the exception class
IlvGanttReaderException is correctly found. The problem is
that my plugin is taking JBuilder execution classpath. Which
doesn't include your project classpath. It doesn't matter
where the exception is from the checked class, the thing is
that it's not in checkstyle classpath when ran from my
plugin. A dirty workaround for you would be to add your
project classpath to JBuilder in the jbuilder.config in
JBuilder bin directory. Meanwhile, I'll see what I can do...
but it causes a lot of changes and I don't really have the
time right now.
Logged In: YES
user_id=729031
FYI, it seems that the Maven Checkstyle Plugin v3.0 snapshot
currently under development suffers from a very similar bug:
http://jira.codehaus.org/browse/MPCHECKSTYLE-20. However, I
still can find nothing related in the bug database of
CheckStyle itself.
Logged In: YES
user_id=893525
Thanks, same kind of issue indeed. It is not related to
checkstyle. Or in fact it is a checkstyle feature. Some
checks require to have the checked project and its
dependencies in the checkstyle execution classpath. Which is
easy to do if you are using ant or maven but not if you are
using JBuilder.