Error using v1.1 with Java 6

36 views
Skip to first unread message

arju...@gmail.com

unread,
Jan 23, 2016, 7:32:19 PM1/23/16
to OWASP Java HTML Sanitizer Support
Hello all

I see the following exception when using v1.1 and the latest v20151202.2 of this project. The same code used to work with the earlier version (r239). It appears like the AutoCloseable interface was introduced in Java 7 and isn't available in Java 6. Is there something that could be done to get this project to work with Java 6?

java.lang.NoClassDefFoundError: java/lang/AutoCloseable
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
        at org.owasp.html.PolicyFactory.sanitize(PolicyFactory.java:123)
        at org.owasp.html.PolicyFactory.sanitize(PolicyFactory.java:101)


Following is the snippet of the code I'm using.
PolicyFactory _policy =
    Sanitizers.BLOCKS
      .and(Sanitizers.FORMATTING)
      .and(Sanitizers.IMAGES)
      .and(Sanitizers.LINKS)
      .and(Sanitizers.TABLES)
      .and(Sanitizers.STYLES);
_policy.sanitize(toSanitize);


Thanks
Arjun

Mike Samuel

unread,
Jan 25, 2016, 3:23:43 PM1/25/16
to owasp-java-html-...@googlegroups.com
Thanks for the bug report.

https://github.com/OWASP/java-html-sanitizer/issues/58 tracks this.
> --
> You received this message because you are subscribed to the Google Groups
> "OWASP Java HTML Sanitizer Support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to owasp-java-html-saniti...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages