Skip to content

Commit

Permalink
[Jimple2cpg] catch error caused by soot and asm (joernio#4198)
Browse files Browse the repository at this point in the history
Some times the annotationTag.getType returns a MethodRef and  Type.getType(s) will throw excpetions.
Just catch this for the moment.

---------

Co-authored-by: David Baker Effendi <davidbakereffendi@hotmail.com>
  • Loading branch information
Liyw979 and DavidBakerEffendi authored Mar 6, 2024
1 parent d33c98a commit 0ff0b61
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.joern.jimple2cpg.astcreation.statements.AstForStatementsCreator
import io.joern.x2cpg.Ast.storeInDiffGraph
import io.joern.x2cpg.datastructures.Global
import io.joern.x2cpg.utils.NodeBuilders
import io.joern.x2cpg.{Ast, AstCreatorBase, AstNodeBuilder, ValidationMode}
import io.joern.x2cpg.*
import io.shiftleft.codepropertygraph.generated.*
import io.shiftleft.codepropertygraph.generated.nodes.*
import org.objectweb.asm.Type
Expand Down Expand Up @@ -296,6 +296,7 @@ implicit class JvmStringOpts(s: String) {
* <code>I</code> to <code>int</code>.
* @return
*/
def parseAsJavaType: String = Type.getType(s).getClassName.replaceAll("/", ".")
def parseAsJavaType: String =
Try { Type.getType(s).getClassName.replaceAll("/", ".") }.getOrElse(Defines.Any)

}

0 comments on commit 0ff0b61

Please sign in to comment.