Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3452

Analysis fails when transpiling JSP with jar stripped of code

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.5.1, 6.6
    • Component/s: JSP
    • Labels:
      None

      Description

      When project is using certain Java EE dependencies with absent code, we will fail analysis with ClassFormatError when transpiling JSP files

      Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/jsp/jstl/core/ConditionalTagSupport
          at java.lang.ClassLoader.defineClass1 (Native Method)
          at java.lang.ClassLoader.defineClass (ClassLoader.java:1017)
          at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:174)
          at java.net.URLClassLoader.defineClass (URLClassLoader.java:550)
          at java.net.URLClassLoader$1.run (URLClassLoader.java:458)
          at java.net.URLClassLoader$1.run (URLClassLoader.java:452)
          at java.security.AccessController.doPrivileged (Native Method)
          at java.net.URLClassLoader.findClass (URLClassLoader.java:451)
          at java.lang.ClassLoader.loadClass (ClassLoader.java:589)
          at java.lang.ClassLoader.loadClass (ClassLoader.java:522)
          at java.lang.ClassLoader.defineClass1 (Native Method)
          at java.lang.ClassLoader.defineClass (ClassLoader.java:1017)
          at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:174)
          at java.net.URLClassLoader.defineClass (URLClassLoader.java:550)
          at java.net.URLClassLoader$1.run (URLClassLoader.java:458)
          at java.net.URLClassLoader$1.run (URLClassLoader.java:452)
          at java.security.AccessController.doPrivileged (Native Method)
          at java.net.URLClassLoader.findClass (URLClassLoader.java:451)
          at java.lang.ClassLoader.loadClass (ClassLoader.java:589)
          at java.lang.ClassLoader.loadClass (ClassLoader.java:522)
          at org.apache.jasper.compiler.Parser.parseCustomTag (Parser.java:1238)
          at org.apache.jasper.compiler.Parser.parseElements (Parser.java:1470)
          at org.apache.jasper.compiler.Parser.parse (Parser.java:144)
      

      Because we are catching Exception type, this will fail whole analysis, because ClassFormatError is subclass of Error and not Exception.

      See https://developer.jboss.org/docs/DOC-15019 which explains a bit the reason why some dependencies have absent code.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael.gumowski Michael Gumowski
                Reporter:
                tibor.blenessy Tibor Blenessy
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: