AndersDJohnson / AndersDJohnson/htmlcompressor

HtmlCompressor.java depends on Rhino unnecessarily

オープン
#77 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
auto-migrated Priority-Medium Type-Defect
主要言語
Java
スター
1
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

説明

```
When running the following code:
String html = "

A String

";
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 `pablo.t...@gmail.com` on 18 Sep 2012 at 11:33

Attachments:
- [rhino_dead_code.patch](https://storage.googleapis.com/google-code-attachments/htmlcompressor/issue-77/comment-0/rhino_dead_code.patch)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。