3838
3939import org .acra .ACRA ;
4040import org .acra .ACRAConfiguration ;
41+ import org .apache .commons .compress .utils .IOUtils ;
4142import org .csploit .android .R ;
4243import org .csploit .android .WifiScannerActivity ;
4344import org .csploit .android .gui .dialogs .FatalDialog ;
@@ -151,10 +152,10 @@ public static void init(Context context) throws Exception{
151152 mStoragePath = getSettings ().getString ("PREF_SAVE_PATH" , Environment .getExternalStorageDirectory ().toString ());
152153 mSessionName = "csploit-session-" + java .lang .System .currentTimeMillis ();
153154 mKnownIssues = new KnownIssues ();
154- mPlugins = new ArrayList <Plugin >();
155+ mPlugins = new ArrayList <>();
155156 mOpenPorts = new SparseIntArray (3 );
156- mServices = new HashMap <String , String >();
157- mPorts = new HashMap <String , String >();
157+ mServices = new HashMap <>();
158+ mPorts = new HashMap <>();
158159
159160 // if we are here, network initialization didn't throw any error, lock wifi
160161 WifiManager wifiManager = (WifiManager ) mContext .getSystemService (Context .WIFI_SERVICE );
@@ -520,15 +521,14 @@ public static void unregisterSettingListener(SettingReceiver receiver) {
520521 }
521522
522523 public static void preloadServices (){
523- if (mServices .size () > 0 && mPorts . size () > 0 )
524+ if (! mServices .isEmpty () )
524525 return ;
525526
526527 FileReader fr = null ;
527528 BufferedReader reader = null ;
528529 try {
529530 // preload network service and ports map
530531
531- //@SuppressWarnings("ConstantConditions")
532532 fr = new FileReader (mContext .getFilesDir ().getAbsolutePath () + "/tools/nmap/nmap-services" );
533533 reader = new BufferedReader (fr );
534534 String line ;
@@ -550,15 +550,9 @@ public static void preloadServices(){
550550 mPorts .clear ();
551551
552552 errorLogging (e );
553- }
554- finally {
555- try {
556- if (fr != null )
557- fr .close ();
558- if (reader != null )
559- reader .close ();
560- }
561- catch (Exception e ){}
553+ } finally {
554+ IOUtils .closeQuietly (reader );
555+ IOUtils .closeQuietly (fr );
562556 }
563557 }
564558
0 commit comments