@@ -414,24 +414,29 @@ private static void createPriorityTable() throws SQLException {
414414 try (Statement statement = getStatement ("cache" )) {
415415 int row = statement .executeUpdate ("CREATE TABLE IF NOT EXISTS priority(SUFFIX text unique, PRIORITY INT);" );
416416 if (row == 0 ) {
417- int count = 10 ;
418- HashMap <String , Integer > map = new HashMap <>();
419- map .put ("lnk" , count --);
420- map .put ("exe" , count --);
421- map .put ("bat" , count --);
422- map .put ("cmd" , count --);
423- map .put ("txt" , count --);
424- map .put ("docx" , count --);
425- map .put ("zip" , count --);
426- map .put ("rar" , count --);
427- map .put ("7z" , count --);
428- map .put ("html" , count );
429- map .put ("defaultPriority" , 0 );
417+ HashMap <String , Integer > map = generateSuffixPriorityMap ();
430418 insertAllSuffixPriority (map , statement );
431419 }
432420 }
433421 }
434422
423+ private static HashMap <String , Integer > generateSuffixPriorityMap () {
424+ int count = 10 ;
425+ HashMap <String , Integer > map = new HashMap <>();
426+ map .put ("lnk" , count --);
427+ map .put ("exe" , count --);
428+ map .put ("bat" , count --);
429+ map .put ("cmd" , count --);
430+ map .put ("txt" , count --);
431+ map .put ("docx" , count --);
432+ map .put ("zip" , count --);
433+ map .put ("rar" , count --);
434+ map .put ("7z" , count --);
435+ map .put ("html" , count );
436+ map .put ("defaultPriority" , 0 );
437+ return map ;
438+ }
439+
435440 private static void createCacheTable () throws SQLException {
436441 try (PreparedStatement pStmt = getPreparedStatement ("CREATE TABLE IF NOT EXISTS cache(PATH text unique);" , "cache" )) {
437442 pStmt .executeUpdate ();
0 commit comments