File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed
java/ql/src/semmle/code/java Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change 1- /**
2- * @name Missing catch of NumberFormatException
3- * @description Calling a string to number conversion method without handling
4- * 'NumberFormatException' may cause unexpected runtime exceptions.
5- * @kind problem
6- * @problem.severity recommendation
7- * @precision high
8- * @id java/uncaught-number-format-exception
9- * @tags reliability
10- * external/cwe/cwe-248
11- */
12-
131import java
142
153/** Calls a string to number conversion */
@@ -68,7 +56,7 @@ class NumberFormatException extends RefType {
6856 NumberFormatException ( ) { this .hasQualifiedName ( "java.lang" , "NumberFormatException" ) }
6957}
7058
71- /** Holds if NFE is caught */
59+ /** Holds if `java.lang.NumberFormatException` is caught */
7260predicate catchesNFE ( TryStmt t ) {
7361 exists ( CatchClause cc , LocalVariableDeclExpr v |
7462 t .getACatchClause ( ) = cc and
@@ -77,7 +65,7 @@ predicate catchesNFE(TryStmt t) {
7765 )
7866}
7967
80- /** Holds if NFE is thrown */
68+ /** Holds if `java.lang.NumberFormatException` is thrown */
8169predicate throwsNFE ( Expr e ) {
8270 e .( SpecialClassInstanceExpr ) .throwsNFE ( ) or e .( SpecialMethodAccess ) .throwsNFE ( )
8371}
You can’t perform that action at this time.
0 commit comments