File tree Expand file tree Collapse file tree 2 files changed +17
-18
lines changed Expand file tree Collapse file tree 2 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -29,27 +29,26 @@ public static List<Integer> getChangedLineNumListInOldVersion(String diffStr) {
29
29
return changedLineNumList ;
30
30
}
31
31
32
- public static Integer getChangedLineCount (String diffStr , String mode ) {
32
+
33
+ /**
34
+ * the mode can only be "add" or "delete"
35
+ * @param diffStr
36
+ * @param mode
37
+ * @return
38
+ */
39
+ public static int getChangedLineCount (String diffStr , String mode ) {
33
40
34
41
int count = 0 ;
35
42
String symbol = null ;
36
- try {
37
- if ("delete" .equals (mode )) {
38
- symbol = "-" ;
39
- } else if ("add" .equals (mode )) {
40
- symbol = "+" ;
41
- } else {
42
- throw new Exception ("Only have delete or add mode!" );
43
- }
44
- for (String line : diffStr .split ("\n " )) {
45
- if (line .startsWith (symbol ) && !line .startsWith ("---" ) && !line .startsWith ("+++" )) {
46
- count ++;
47
- }
43
+ if ("delete" .equals (mode )) {
44
+ symbol = "-" ;
45
+ } else if ("add" .equals (mode )) {
46
+ symbol = "+" ;
47
+ }
48
+ for (String line : diffStr .split ("\n " )) {
49
+ if (line .startsWith (symbol ) && !line .startsWith ("---" ) && !line .startsWith ("+++" )) {
50
+ count ++;
48
51
}
49
- } catch (Exception e ) {
50
- // TODO: handle exception
51
- e .printStackTrace ();
52
- return null ;
53
52
}
54
53
return count ;
55
54
}
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ public static boolean deleteDirectory(String dirPath) {
166
166
return directoryToBeDeleted .delete ();
167
167
}
168
168
169
- public static void copyFolder (String srcDirStr , String destDirStr ) {
169
+ public static void copyDirectory (String srcDirStr , String destDirStr ) {
170
170
File source = new File (srcDirStr );
171
171
File dest = new File (destDirStr );
172
172
try {
You can’t perform that action at this time.
0 commit comments