SV2016 정적분석보고서 201214262 라가영 201313250 서지혁 June 9, 2016 1
Contents Contents 2 1 Abstract 3 2 Infer 3 2.1 Checkers................................ 3 2.2 Eradicate............................... 3 2.3 Infer.................................. 8 2.4 Tracing................................ 9 3 PMD 10 3.1 Design................................. 10 3.2 Optimizations............................. 11 3.3 Imports................................ 16 3.4 Unnecessary.............................. 16 3.5 Unused Code............................. 17 3.6 Strings................................. 17 4 FindBugs 17 4.1 Results................................. 17 References 18 2
1 Abstract 이 문서는 2016년 봄 건국대학교 소프트웨어 검증[1] 과목의 과제로 작성되었다. 이 보고서에서는 소프트웨어 모델링 및 분석[2] 과목의 과제로 개발되는, 다 수의 C 프로그램을 대상으로 상호 cheating 여부를 정량적으로 판단하고, 해당 내용을 OOO 하게 알려주는 프로그램 에 대한 정적 분석을 진행한다. 2 2.1 Infer Eradicate $ i n f e r -analyzer e r a d i c a t e -gradle j a r Running and c a p t u r i n g g r a d l e c o m p i l a t i o n... S t a r t i n g a n a l y s i s ( I n f e r v e r s i o n v0. 8. 1 ) FFFFF.................................................. Analyzed 5 f i l e s Found 19 i s s u e s s r c /main/ j a v a / Analyze. j a v a : 1 6 : e r r o r : F i e l d Analyze. tempfolderpath i s not i n i t i a l i z e d i n t h e 14. A r r a y L i s t <S t r i n g > l i s t T y p e = new ArrayList () ; 15. 16. > p u b l i c Analyze ( A r r a y L i s t <S t r i n g > s o u r c e ) { 17. this. source = source ; 18. t h i s. l i s t T y p e. add ( v o i d ) ; 19. s r c /main/ j a v a / C a l c u l a t e. j a v a : 1 3 : e r r o r : F i e l d C a l c u l a t e. SyncRate i s not i n i t i a l i z e d i n t h e 11. A r r a y L i s t <F i l e s > f i l e s = new A r r a y L i s t ( ) ; 12. 13. > p u b l i c C a l c u l a t e ( A r r a y L i s t <F i l e s > f i l e s ) 14. { 15. this. f i l e s = f i l e s ; 16. s r c /main/ j a v a / C o n t r o l l e r. j a v a : 2 0 : e r r o r : ERADICATE FIELD NOT NULLABLE 3
F i e l d C o n t r o l l e r. filename can be n u l l but i s not d e c l a r e d @Nullable. ( Origin : n u l l constant at l i n e 20) 18. { 19. p r i v a t e S t r i n g f o l d e r P a t h ; 20. > p r i v a t e S t r i n g filename = n u l l ; 21. p r i v a t e ArrayList<F i l e s > f i l e s = new ArrayList ( ) ; 22. ArrayList<String > source = new ArrayList ( ) ; 23. F i e l d C o n t r o l l e r. folderpath i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. pnresult i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. ct i s not i n i t i a l i z e d in the 4
F i e l d C o n t r o l l e r. lbchoosefile i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. l b C e n t e r C i r c l e i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. btfolder i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. pncloud i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. btstart i s not i n i t i a l i z e d in the 5
F i e l d C o n t r o l l e r. lblogosmall i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. p n F i l e L i s t i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. l b L i s t i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. pnmain i s not i n i t i a l i z e d in the 6
F i e l d C o n t r o l l e r. l t F i l e i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. lbtip i s not i n i t i a l i z e d in the F i e l d C o n t r o l l e r. lblogo i s not i n i t i a l i z e d in the s r c /main/ java / C o n t r o l l e r. java : 3 9 1 : e r r o r : F i e l d C o n t r o l l e r $ 5. lbtemptotalsyncrate i s not i n i t i a l i z e d in the c o n s t r u c t o r and i s not d e c l a r e d @Nullable 389. { 390. sw = true 7
; 391. > lbtempcloud. setbounds (new Random ( ). nextint (800 -(i n t ) sizetempname. getwidth ( ) ) + 100, new Random ( ). nextint (350 -(( i n t ) sizetempname. getheight ( ) + 12) ) + 70, 392. ( i n t ) sizetempname. getwidth ( ), ( i n t ) sizetempname. getheight ( ) + ( i n t ) sizetemppercent. getheight ( ) + 3) ; 393. 394. Summary o f the r e p o r t s : 18 ERADICATE FIELD NOT NULLABLE: 1 2.2 Infer $ i n f e r -analyzer i n f e r -gradle j a r Running and capturing g r a d l e compilation... S t a r t i n g a n a l y s i s ( I n f e r v e r s i o n v0. 8. 1) FF.. FF. F................................................................................ Analyzed 5 f i l e s Found 1 i s s u e s r c /main/ java / C o n t r o l l e r. java : 4 8 : e r r o r : NULL DEREFERENCE o b j e c t f i l e L i s t l a s t a s s i g n e d on l i n e 46 could be n u l l and i s d e r e f e r e n c e d at l i n e 48 46. F i l e [ ] f i l e L i s t = d i r. l i s t F i l e s ( ) ; 47. 48. > f o r ( F i l e f : f i l e L i s t ) 49. { 50. i f (! f. ishidden ( ) && f. getname ( ). endswith (. c ) ) 51. Summary o f the r e p o r t s NULL DEREFERENCE: 1 2.3 Tracing 8
$ i n f e r -analyzer t r a c i n g -gradle j a r Running and capturing g r a d l e compilation... S t a r t i n g a n a l y s i s ( I n f e r v e r s i o n v0. 8. 1) FFFF.. F................................................................................. Analyzed 5 f i l e s Found 3 i s s u e s s r c /main/ java / C a l c u l a t e. java : 2 4 : warning : PRECONDITION NOT MET in c a l l to c a l L i n e ( ) at l i n e 24 22. f o r ( filenum =0; filenum<t h i s. numoffile ; filenum++) 23. { 24. > c a l L i n e ( ) ; 25. calfunction ( ) ; 26. c a l V a r i a b l e ( ) ; 27. s r c /main/ java / C o n t r o l l e r. java : 4 8 : e r r o r : NULL DEREFERENCE o b j e c t f i l e L i s t l a s t a s s i g n e d on l i n e 46 could be n u l l and i s d e r e f e r e n c e d at l i n e 48 46. F i l e [ ] f i l e L i s t = d i r. l i s t F i l e s ( ) ; 47. 48. > f o r ( F i l e f : f i l e L i s t ) 49. { 50. i f (! f. ishidden ( ) && f. getname ( ). endswith (. c ) ) 51. s r c /main/ java / C o n t r o l l e r. java : 3 6 6 : warning : PRECONDITION NOT MET in c a l l to gettotalsync (... ) at l i n e 366 364. f i n a l JLabel lbtempcloud = lbcloud. get ( i ) ; 365. 366. > i f ( i!= pointernum && ( i n t ) c a l. gettotalsync ( i ) > 52) { 367. temp = + f i l e s. get ( i ). getname ( ) ; 368. f i n a l JLabel lbtempname = new JLabel ( temp. s u b s t r i n g ( 0, 9) ) ; 369. I 9
Summary o f the r e p o r t s PRECONDITION NOT MET: 2 NULL DEREFERENCE: 1 3 PMD 3.1 Design $ pmd pmd -dir s r c /main/ java / -R java -design Analyze. java : 1 : P o s s i b l e God c l a s s (WMC=66, ATFD=19, TCC =0. 09090909090909091) Analyze. java : 6 2 : Deeply nested i f.. then statements are hard to read C a l c u l a t e. java : 1 0 : Perhaps numoffile could be r e p l a c e d by a l o c a l v a r i a b l e. C o n t r o l l e r. java : 1 : P o s s i b l e God c l a s s (WMC=63, ATFD =204, TCC=0. 05789473684210526) C o n t r o l l e r. java : 2 1 : Private f i e l d f i l e s could be made f i n a l ; i t i s only i n i t i a l i z e d in the d e c l a r a t i o n or c o n s t r u c t o r. C o n t r o l l e r. java : 4 0 : Overridable method DisplayMain c a l l e d during o b j e c t c o n s t r u c t i o n C o n t r o l l e r. java : 9 9 : Avoid unnecessary comparisons in boolean e x p r e s s i o n s C o n t r o l l e r. java : 2 5 7 : Avoid unnecessary comparisons in boolean e x p r e s s i o n s C o n t r o l l e r. java : 3 2 7 : New e x c e p t i o n i s thrown in catch block, o r i g i n a l stack t r a c e may be l o s t C o n t r o l l e r. java : 3 3 1 : New e x c e p t i o n i s thrown in catch block, o r i g i n a l stack t r a c e may be l o s t C o n t r o l l e r. java : 3 3 5 : New e x c e p t i o n i s thrown in catch block, o r i g i n a l stack t r a c e may be l o s t C o n t r o l l e r. java : 3 3 8 : New e x c e p t i o n i s thrown in catch block, o r i g i n a l stack t r a c e may be l o s t C o n t r o l l e r. java : 3 4 4 : Avoid unnecessary comparisons in boolean e x p r e s s i o n s C o n t r o l l e r. java : 3 9 4 : Avoid unnecessary comparisons in boolean e x p r e s s i o n s C o n t r o l l e r. java : 3 9 9 : Avoid unnecessary comparisons in boolean e x p r e s s i o n s C o n t r o l l e r. java : 4 0 4 : Avoid unnecessary comparisons in boolean e x p r e s s i o n s C o n t r o l l e r. java : 4 1 3 : Avoid unnecessary comparisons in boolean e x p r e s s i o n s 10
C o n t r o l l e r. java : 4 5 7 : Avoid r e a s s i g n i n g parameters such a s lbtemptotalsyncrate C o n t r o l l e r. java : 4 5 7 : Consider using varargs f o r methods or c o n s t r u c t o r s which take an array the l a s t parameter. Main. java : 2 : All methods are s t a t i c. Consider using a u t i l i t y c l a s s i n s t e a d. A l t e r n a t i v e l y, you could add a p r i v a t e c o n s t r u c t o r or make the c l a s s a b s t r a c t to s i l e n c e t h i s warning. Main. java : 4 : Consider using varargs f o r methods or c o n s t r u c t o r s which take an array the l a s t parameter. 3.2 Optimizations $ pmd pmd -dir s r c /main/ java / -R java -optimizations Analyze. java : 6 : Avoid using redundant f i e l d i n i t i a l i z e r f o r numofline Analyze. java : 7 : Avoid using redundant f i e l d i n i t i a l i z e r f o r numoffunction Analyze. java : 8 : Avoid using redundant f i e l d i n i t i a l i z e r f o r numofvariable Analyze. java : 9 : Avoid using redundant f i e l d i n i t i a l i z e r f o r numofpreprocessor Analyze. java : 1 0 : Avoid using redundant f i e l d i n i t i a l i z e r f o r numofannotation Analyze. java : 1 6 : Parameter source i s not Analyze. java : 2 8 : Parameter f i l e i s not a s s i g n e d and C a l c u l a t e. java : 8 : Avoid using redundant f i e l d i n i t i a l i z e r f o r centernum C a l c u l a t e. java : 9 : Avoid using redundant f i e l d i n i t i a l i z e r f o r filenum C a l c u l a t e. java : 1 0 : Avoid using redundant f i e l d i n i t i a l i z e r f o r numoffile C a l c u l a t e. java : 1 3 : Parameter f i l e s i s not a s s i g n e d and C a l c u l a t e. java : 8 5 : Avoid i n s t a n t i a t i n g new o b j e c t s C a l c u l a t e. java : 8 5 : Local v a r i a b l e str1 could be C a l c u l a t e. java : 8 9 : Avoid i n s t a n t i a t i n g new o b j e c t s C a l c u l a t e. java : 8 9 : Local v a r i a b l e str2 could be C a l c u l a t e. java : 1 4 7 : Avoid i n s t a n t i a t i n g new o b j e c t s 11
C a l c u l a t e. java : 1 4 7 : Local v a r i a b l e str1 could be C a l c u l a t e. java : 1 5 1 : Avoid i n s t a n t i a t i n g new o b j e c t s C a l c u l a t e. java : 1 5 1 : Local v a r i a b l e str2 could be C a l c u l a t e. java : 2 0 3 : Local v a r i a b l e PreDiff could be C a l c u l a t e. java : 2 0 4 : Local v a r i a b l e PreDiff1 could be C a l c u l a t e. java : 2 2 1 : Avoid i n s t a n t i a t i n g new o b j e c t s C a l c u l a t e. java : 2 2 1 : Local v a r i a b l e str1 could be C a l c u l a t e. java : 2 2 5 : Avoid i n s t a n t i a t i n g new o b j e c t s C a l c u l a t e. java : 2 2 5 : Local v a r i a b l e str2 could be C a l c u l a t e. java : 2 9 8 : Parameter pointernum i s not C a l c u l a t e. java : 3 0 2 : Parameter pointernum i s not C a l c u l a t e. java : 3 0 6 : Parameter pointernum i s not C a l c u l a t e. java : 3 1 0 : Parameter pointernum i s not C a l c u l a t e. java : 3 1 4 : Parameter pointernum i s not C a l c u l a t e. java : 3 1 8 : Parameter pointernum i s not C a l c u l a t e. java : 3 2 2 : Parameter pointernum i s not C o n t r o l l e r. java : 2 0 : Avoid using redundant f i e l d i n i t i a l i z e r f o r filename C o n t r o l l e r. java : 2 3 : Avoid using redundant f i e l d i n i t i a l i z e r f o r pointernum C o n t r o l l e r. java : 2 4 : Avoid using redundant f i e l d i n i t i a l i z e r f o r filenum C o n t r o l l e r. java : 2 5 : Avoid using redundant f i e l d i n i t i a l i z e r f o r numoffile C o n t r o l l e r. java : 4 5 : Local v a r i a b l e dir could be C o n t r o l l e r. java : 4 6 : Local v a r i a b l e f i l e L i s t could be C o n t r o l l e r. java : 4 8 : Local v a r i a b l e f could be 12
C o n t r o l l e r. java : 8 0 : Local v a r i a b l e f could be C o n t r o l l e r. java : 8 5 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 8 5 : Local v a r i a b l e f i l e could be C o n t r o l l e r. java : 9 7 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 9 7 : Local v a r i a b l e br could be C o n t r o l l e r. java : 1 0 5 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 1 0 5 : Local v a r i a b l e analyze could be C o n t r o l l e r. java : 1 5 4 : Local v a r i a b l e alfolder could be C o n t r o l l e r. java : 1 5 5 : Parameter e i s not a s s i g n e d and C o n t r o l l e r. java : 1 7 0 : Local v a r i a b l e a l S t a r t could be C o n t r o l l e r. java : 1 7 1 : Parameter e i s not a s s i g n e d and C o n t r o l l e r. java : 2 0 7 : Do not add empty s t r i n g s C o n t r o l l e r. java : 2 3 5 : Local v a r i a b l e f i l e L i s t could be C o n t r o l l e r. java : 2 3 7 : Local v a r i a b l e temp could be C o n t r o l l e r. java : 2 5 2 : Local v a r i a b l e renderer could be C o n t r o l l e r. java : 2 5 4 : Local v a r i a b l e mlfile could be C o n t r o l l e r. java : 2 5 5 : Parameter e i s not a s s i g n e d and C o n t r o l l e r. java : 2 6 3 : Local v a r i a b l e k l F i l e could be C o n t r o l l e r. java : 2 6 4 : Parameter e i s not a s s i g n e d and C o n t r o l l e r. java : 3 4 3 : Parameter temppointernum i s not C o n t r o l l e r. java : 3 5 5 : Do not add empty s t r i n g s C o n t r o l l e r. java : 3 6 3 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 6 7 : Do not add empty s t r i n g s C o n t r o l l e r. java : 3 6 8 : Avoid i n s t a n t i a t i n g new o b j e c t s 13
C o n t r o l l e r. java : 3 6 9 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 6 9 : Local v a r i a b l e lbtemppercent C o n t r o l l e r. java : 3 7 1 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 7 2 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 7 3 : Local v a r i a b l e sizetempname C o n t r o l l e r. java : 3 7 6 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 7 7 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 7 8 : Local v a r i a b l e sizetemppercent C o n t r o l l e r. java : 3 8 2 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 9 1 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 9 1 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 3 9 8 : Local v a r i a b l e lbanothercloud C o n t r o l l e r. java : 4 0 6 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 4 0 6 : Local v a r i a b l e mltempname could be C o n t r o l l e r. java : 4 1 2 : Parameter e i s not a s s i g n e d and C o n t r o l l e r. java : 4 2 6 : Parameter e i s not a s s i g n e d and C o n t r o l l e r. java : 4 4 0 : Parameter e i s not a s s i g n e d and C o n t r o l l e r. java : 4 5 7 : Parameter cal i s not a s s i g n e d and C o n t r o l l e r. java : 4 5 7 : Parameter lbtempsync i s not C o n t r o l l e r. java : 4 5 7 : Parameter pointernum i s not C o n t r o l l e r. java : 4 7 7 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 4 7 8 : Avoid i n s t a n t i a t i n g new o b j e c t s C o n t r o l l e r. java : 4 8 7 : Parameter lbtempa i s not 14
C o n t r o l l e r. java : 4 8 7 : Parameter lbtempb i s not C o n t r o l l e r. java : 4 8 8 : Local v a r i a b l e lbtempc could be C o n t r o l l e r. java : 4 9 1 : Local v a r i a b l e areaa could be C o n t r o l l e r. java : 4 9 2 : Local v a r i a b l e areab could be C o n t r o l l e r. java : 5 0 1 : Parameter c i s not a s s i g n e d and C o n t r o l l e r. java : 5 0 1 : Parameter g i s not a s s i g n e d and C o n t r o l l e r. java : 5 0 6 : Parameter c i s not a s s i g n e d and C o n t r o l l e r. java : 5 0 6 : Parameter g i s not a s s i g n e d and C o n t r o l l e r. java : 5 0 6 : Parameter height i s not C o n t r o l l e r. java : 5 0 6 : Parameter width i s not a s s i g n e d and C o n t r o l l e r. java : 5 0 6 : Parameter x i s not a s s i g n e d and C o n t r o l l e r. java : 5 0 6 : Parameter y i s not a s s i g n e d and C o n t r o l l e r. java : 5 0 7 : Local v a r i a b l e g2d could be C o n t r o l l e r. java : 5 1 3 : Parameter c i s not a s s i g n e d and C o n t r o l l e r. java : 5 1 7 : Parameter c i s not a s s i g n e d and C o n t r o l l e r. java : 5 1 7 : Parameter i n s e t s i s not F i l e s. java : 1 5 : Parameter filename i s not a s s i g n e d and F i l e s. java : 5 7 : Parameter tempname i s not a s s i g n e d and F i l e s. java : 6 1 : Parameter tempnumofline i s not a s s i g n e d and F i l e s. java : 6 5 : Parameter tempnumoffunction i s not F i l e s. java : 6 9 : Parameter tempnumofvariable i s not F i l e s. java : 7 3 : Parameter tempnumofpreprocessor i s not F i l e s. java : 7 7 : Parameter tempnumofannotation i s not 15
F i l e s. java : 8 1 : Parameter tempfunctionname i s not F i l e s. java : 8 5 : Parameter tempvariablename i s not F i l e s. java : 8 9 : Parameter temppreprocessorname i s not Main. java : 4 : Parameter args i s not a s s i g n e d and 3.3 Imports $ pmd pmd -dir s r c /main/ java / -R java -imports C o n t r o l l e r. java : 7 : Avoid d u p l i c a t e imports such as java. i o. BufferedReader C o n t r o l l e r. java : 8 : Avoid d u p l i c a t e imports such as java. i o. F ile C o n t r o l l e r. java : 9 : Avoid d u p l i c a t e imports such as java. i o. FileNotFoundException C o n t r o l l e r. java : 1 0 : Avoid d u p l i c a t e imports such as java. i o. FileReader C o n t r o l l e r. java : 1 1 : Avoid d u p l i c a t e imports such as java. i o. IOException C o n t r o l l e r. java : 1 2 : Avoid importing anything from the package java. lang C o n t r o l l e r. java : 1 9 8 : Unnecessary use o f f u l l y q u a l i f i e d name java. i o. File due to e x i s t i n g import java. i o. 3.4 Unnecessary $ pmd pmd -dir s r c /main/ java / -R java -unnecessary Analyze. java : 8 4 : U s e l e s s p a r e n t h e s e s. C a l c u l a t e. java : 1 0 0 : U s e l e s s p a r e n t h e s e s. C a l c u l a t e. java : 1 0 3 : U s e l e s s p a r e n t h e s e s. C a l c u l a t e. java : 1 7 0 : U s e l e s s p a r e n t h e s e s. C a l c u l a t e. java : 1 7 3 : U s e l e s s p a r e n t h e s e s. C a l c u l a t e. java : 2 3 6 : U s e l e s s p a r e n t h e s e s. C a l c u l a t e. java : 2 3 9 : U s e l e s s p a r e n t h e s e s. C o n t r o l l e r. java : 3 7 1 : U s e l e s s p a r e n t h e s e s. C o n t r o l l e r. java : 3 7 9 : U s e l e s s p a r e n t h e s e s. C o n t r o l l e r. java : 4 3 5 : U s e l e s s p a r e n t h e s e s. C o n t r o l l e r. java : 5 1 4 : U s e l e s s p a r e n t h e s e s. 3.5 Unused Code $ pmd pmd -dir s r c /main/ java / -R java -unusedcode 16
C a l c u l a t e. java : 2 0 3 : Avoid unused l o c a l v a r i a b l e s such as PreDiff. C a l c u l a t e. java : 2 0 4 : Avoid unused l o c a l v a r i a b l e s such as PreDiff1. 3.6 Strings $ pmd pmd -dir s r c /main/ java / -R java -strings Analyze. java : 8 4 : S t r i n g. indexof ( char ) i s f a s t e r than S t r i n g. indexof ( S t r i n g ). Analyze. java : 8 5 : S t r i n g. indexof ( char ) i s f a s t e r than S t r i n g. indexof ( S t r i n g ). Analyze. java : 2 1 9 : S t r i n g. indexof ( char ) i s f a s t e r than S t r i n g. indexof ( S t r i n g ). Analyze. java : 2 2 2 : S t r i n g. indexof ( char ) i s f a s t e r than S t r i n g. indexof ( S t r i n g ). Analyze. java : 2 2 9 : S t r i n g. indexof ( char ) i s f a s t e r than S t r i n g. indexof ( S t r i n g ). Analyze. java : 2 5 6 : The S t r i n g l i t e r a l s t r u c t appears 5 times in t h i s f i l e ; the f i r s t o c c u rrence i s on l i n e 256 C o n t r o l l e r. java : 1 4 3 : The S t r i n g l i t e r a l Malgun Gothic appears 8 times in t h i s f i l e ; the f i r s t o ccurrence i s on l i n e 143 C o n t r o l l e r. java : 2 3 8 : S t r i n g. indexof ( char ) i s f a s t e r than S t r i n g. indexof ( S t r i n g ). C o n t r o l l e r. java : 3 2 5 : Use e q u a l s ( ) to compare s t r i n g s i n s t e a d o f == or!= C o n t r o l l e r. java : 3 2 9 : Use e q u a l s ( ) to compare s t r i n g s i n s t e a d o f == or!= C o n t r o l l e r. java : 3 3 3 : Use e q u a l s ( ) to compare s t r i n g s i n s t e a d o f == or!= 4 FindBugs 4.1 Results $ findbugs -textui b u i l d / l i b s / c l o n e -checker. j a r M P Dm: C a l c u l a t e. calfunction ( ) invokes i n e f f i c i e n t new S t r i n g ( S t r i n g ) c o n s t r u c t o r At C a l c u l a t e. java : [ l i n e 8 5 ] M P Dm: C a l c u l a t e. c a l V a r i a b l e ( ) invokes i n e f f i c i e n t new S t r i n g ( S t r i n g ) c o n s t r u c t o r At C a l c u l a t e. java : [ l i n e 147] M P Dm: C a l c u l a t e. c a l P r e p r o c e s s o r ( ) invokes i n e f f i c i e n t new S t r i n g ( S t r i n g ) c o n s t r u c t o r At C a l c u l a t e. java : [ 17
l i n e 221] M D NP: P o s s i b l e n u l l p o i n t e r d e r e f e r e n c e in C o n t r o l l e r. mkfileinstance ( ) due to return value o f c a l l e d method Dereferenced at C o n t r o l l e r. java : [ l i n e 4 8 ] M B Nm: The method name C o n t r o l l e r. DisplayMain ( ) doesn t s t a r t with a lower case l e t t e r At C o n t r o l l e r. java : [ l i n e s 119-189] M B Nm: The method name C o n t r o l l e r. DisplayResult ( ) doesn t s t a r t with a lower case l e t t e r At C o n t r o l l e r. java : [ l i n e s 213-289] H I Dm: Found r e l i a n c e on d e f a u l t encoding in C o n t r o l l e r. mkfileinstance ( ) : new java. i o. FileReader ( S t r i n g ) At C o n t r o l l e r. java : [ l i n e 9 7 ] M C UwF: Unwritten f i e l d : C o n t r o l l e r $ 5. lbtemptotalsyncrate At C o n t r o l l e r. java : [ l i n e 437] M P SIC : Should Controller$RoundedBorder be a s t a t i c i n n e r c l a s s? At C o n t r o l l e r. java : [ l i n e s 501-523] M P UuF: Unused f i e l d : Analyze. tempfolderpath In Analyze. java Warnings generated : 10 References [1] Junbeom Yoo, Eui-Sub Kim, Software Verification Introduction to Software Testing & Static Analysis, http://dslab.konkuk.ac.kr/class/2016/ 16SV/16SV.htm, 2016. [2] Junbeom Yoo, Sejin Jung, Software Modeling & Analysis, http://dslab. konkuk.ac.kr/class/2016/16sma/16sma.htm, 2016. [3] Junbeom Yoo, Jaeyoeb Kim, Programming Project, http://dslab.konkuk. ac.kr/class/2016/16pp/16pp.htm, 2016. [4] Facebook, Infer, http://fbinfer.com 2016. [5] PMD, PMD, https://pmd.github.io, 2016. [6] Bill Pugh, Andrey Loskutov, FindBugs, http://findbugs.sourceforge. net, 2016. 18