Antisamy 1.5.3 span标记样式属性异常

时间:2013-09-30 20:00:55

标签: java html antisamy

我正在使用antisamy 1.5.3以及以下依赖项

  1. batik-1.5-fop-0.20-5.jar
  2. nekohtml-1.9.6.jar
  3. xercesImpl-2.9.1.jar
  4. 您好我有输入html字符串

    str = "<p><ul>
                  <li><span style=\"font-family: Arial, Helvetica, Verdana, Tahoma, sans-serif; font-size: 13px; line-height: 1.4em;\">Sample Output</span></li>
              </ul>
           </p>"
    

    我希望antisamy的输出是相同的。但我得到以下异常,有人可以告诉我哪里出错了,是否有针对此问题的解决方法。

    ERROR:  ''
    org.owasp.validator.html.ScanException: javax.xml.transform.TransformerException: java.lang.IllegalStateException
        at org.owasp.validator.html.scan.AntiSamySAXScanner.scan(AntiSamySAXScanner.java:135)
        at org.owasp.validator.html.AntiSamy.scan(AntiSamy.java:101)
        at com.tibbr.antisamy.TibbrAntisamy.getCleancontent(TibbrAntisamy.java:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:470)
        at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:328)
        at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:71)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
        at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59)
        at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
        at org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
        at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
        at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
        at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
        at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
        at org.jruby.ast.RootNode.interpret(RootNode.java:129)
        at org.jruby.evaluator.ASTInterpreter.INTERPRET_EVAL(ASTInterpreter.java:96)
        at org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:175)
        at org.jruby.RubyKernel.evalCommon(RubyKernel.java:1103)
        at org.jruby.RubyKernel.eval(RubyKernel.java:1061)
    

1 个答案:

答案 0 :(得分:0)

我通过更新antisamy.jar的依赖jar修复了这个问题 从属罐子如下

  1. xercesImpl.jar
  2. XML-apis.jar
  3. nekohtml.jar
  4. sac.jar
  5. 公地HttpClient的-3.1.jar