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

HtmlCompressor.java depends on Rhino unnecessarily #77

Open
GoogleCodeExporter opened this issue Aug 26, 2015 · 0 comments
Open

HtmlCompressor.java depends on Rhino unnecessarily #77

GoogleCodeExporter opened this issue Aug 26, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

When running the following code:
  String html = " <h1>  A  String </h1>";
  HtmlCompressor compressor = new HtmlCompressor();
  String compressedHtml = compressor.compress(html);

We get the following stacktrace:
  Caused by: java.lang.ClassNotFoundException: org.mozilla.javascript.ErrorReporter
    at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
    at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass(GrailsRootLoader.java:43)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

This is due to the fact that HtmlCompressor.java is relying on Rhino.
The Java ClassLoader doesn't seem to complain if the portion of code is not 
used, but Groovy does.

All the code related to Rhino on this class is actually dead code, so it could 
be removed and solve our problem.
Right now, our workaround is to include a dependency to Rhino, which is a bit a 
shame.

Please find attached the patch removing the dead code.
The tests are still passing after patching.

Original issue reported on code.google.com by [email protected] on 18 Sep 2012 at 11:33

Attachments:

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

No branches or pull requests

1 participant