Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing StringUtils dependency #106

Closed
RoiEXLab opened this issue Dec 18, 2017 · 3 comments
Closed

Missing StringUtils dependency #106

RoiEXLab opened this issue Dec 18, 2017 · 3 comments

Comments

@RoiEXLab
Copy link

Hi,
I noticed the following issue with your current master:
When building a jar file using ant: ant jar, the created css-validator.jar is missing a dependency resulting in a crash:

roiex@Robins-PC:/mnt/e/GitHub/css-validator$ java -jar css-validator.jar  http://localhost:4000
{output=text, profile=css3, vextwarning=false, warning=2, medium=all, lang=en}
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:161)
        at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:730)
        at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:263)
        at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:112)
        at org.apache.velocity.app.Velocity.init(Velocity.java:74)
        at org.w3c.css.css.StyleSheetGenerator.<clinit>(StyleSheetGenerator.java:92)
        at org.w3c.css.css.StyleReportFactory.getStyleReport(StyleReportFactory.java:18)
        at org.w3c.css.css.CssValidator.handleRequest(CssValidator.java:194)
        at org.w3c.css.css.CssValidator.main(CssValidator.java:163)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 9 more

Output of java -version:

openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

As you may notice this is not a direct dependency of css-validator, but an indirect dependency of apache velocity.
Given that you should perhaps consider updating your dependencies (all of them), (and maybe compile using java 8 because even java 8 got old/common by now), or even switch to gradle instead of using ant.

I opened this Repo in eclipse and for gods sake, please run a formatter on this codebase, the code is un-readable in some classes, not to mention a lot of dead code, if(true)/if("" != null), raw generics statements etc. etc. etc.

I'm assuming some code has been generated by a decompiler? Definitely looks like it.

Anyways, enough ranting,
TL;DR: Priority 1 should be to fix this dependency, priority 2 should be to make your code readable.

I'd be happy to support you with any of the potential tasks I mentioned, if you want me to run a formatter add a dependency/fix the current one, create a gradle script or something I would be happy to do that, just tell me :)

I really think this Project is worth maintaining, because it is indeed pretty useful to have as some sort of test for static (or dynamic) websites being developed under version control.

@RoiEXLab
Copy link
Author

Apache even offers a download link for all binaries: http://velocity.apache.org/download.cgi#tools
Replacing the lib directory with those contents is completely sufficient.

@ylafon
Copy link
Member

ylafon commented Dec 18, 2017

Should be fixed by 6fa0988
the ("" != null) statement are generated not by a decompiler but by javacc.
The non-generated code should be quite readable (although there are still lots of old/badly formatted code)

@ylafon ylafon closed this as completed Dec 18, 2017
@RoiEXLab
Copy link
Author

@ylafon Thanks! Worked fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants