File tree Expand file tree Collapse file tree 5 files changed +64
-0
lines changed
src/main/java/com/baeldung/infer Expand file tree Collapse file tree 5 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
4+ <modelVersion >4.0.0</modelVersion >
5+ <artifactId >infer</artifactId >
6+
7+ <parent >
8+ <groupId >com.baeldung</groupId >
9+ <artifactId >static-analysis</artifactId >
10+ <version >1.0-SNAPSHOT</version >
11+ </parent >
12+
13+ </project >
Original file line number Diff line number Diff line change 1+ package com .baeldung .infer ;
2+
3+ public class DivideByZero {
4+
5+ public static void main (String [] args ) {
6+ DivideByZero .divideByZero ();
7+ }
8+
9+ private static void divideByZero () {
10+ int dividend = 5 ;
11+ int divisor = 0 ;
12+ int result = dividend / divisor ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ package com .baeldung .infer ;
2+
3+ public class NullPointerDereference {
4+
5+ public static void main (String [] args ) {
6+ NullPointerDereference .nullPointerDereference ();
7+ }
8+
9+ private static void nullPointerDereference () {
10+ String str = null ;
11+ int length = str .length ();
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ package com .baeldung .infer ;
2+
3+ import java .io .File ;
4+ import java .io .FileOutputStream ;
5+ import java .io .IOException ;
6+
7+ public class ResourceLeak {
8+
9+ public static void main (String [] args ) throws IOException {
10+ ResourceLeak .resourceLeak ();
11+ }
12+
13+ private static void resourceLeak () throws IOException {
14+ FileOutputStream stream ;
15+ try {
16+ File file = new File ("randomName.txt" );
17+ stream = new FileOutputStream (file );
18+ } catch (IOException e ) {
19+ return ;
20+ }
21+ stream .write (0 );
22+ }
23+ }
Original file line number Diff line number Diff line change 3434 <module >pmd</module >
3535 <module >my-bugchecker-plugin</module >
3636 <module >error-prone-project</module >
37+ <module >infer</module >
3738 </modules >
3839
3940 <properties >
You can’t perform that action at this time.
0 commit comments