1717# Ensure the report directory exists
1818mkdir -p " $REPORT_DIR "
1919
20- # Find all jacoco-ut.exec files dynamically
21- EXEC_FILES=( $( find " $PROJECT_ROOT " -name " jacoco-ut.exec" -type f) )
20+ # Issue 1: Simplified find command (avoiding array initialization)
21+ EXEC_FILES=$( find " $PROJECT_ROOT " -name " jacoco-ut.exec" -type f)
2222
23- # Check if any execution data files were found
24- if [ ${ # EXEC_FILES[@]} -eq 0 ]; then
23+ # Issue 2: Simplified check for empty results using -z
24+ if [ -z " $EXEC_FILES " ]; then
2525 echo " Error: No jacoco-ut.exec files found in $PROJECT_ROOT "
2626 exit 1
2727fi
2828
29- # Check if all execution data files exist
30- for exec_file in " ${EXEC_FILES[@]} " ; do
31- if [ ! -f " $exec_file " ]; then
32- echo " Error: Execution data file not found at $exec_file "
33- exit 1
34- fi
35- done
36-
3729# Merge execution data files
3830echo " Merging execution data files..."
39- java -jar " $JACOCO_CLI_JAR " merge " ${EXEC_FILES[@]} " --destfile " $MERGED_EXEC "
31+ # Issue 4: Passing the string directly
32+ java -jar " $JACOCO_CLI_JAR " merge ${EXEC_FILES} --destfile " $MERGED_EXEC "
4033
4134if [ $? -ne 0 ]; then
4235 echo " Error: Failed to merge execution data files"
@@ -50,10 +43,11 @@ echo "Generating coverage report..."
5043CLASSFILES_ARGS=()
5144SOURCEFILES_ARGS=()
5245
53- for exec_file in " ${EXEC_FILES[@]} " ; do
46+ # Issue 5: Iterating over the string list instead of an array
47+ for exec_file in ${EXEC_FILES} ; do
5448 # Extract module path (e.g., core, dlm, rquota) from the exec file path
5549 module_path=$( dirname " $( dirname " $( dirname " $exec_file " ) " ) " )
56- module_name= $( basename " $module_path " )
50+
5751 # Add classfiles and sourcefiles arguments
5852 CLASSFILES_ARGS+=(" --classfiles" " $module_path /target/classes" )
5953 SOURCEFILES_ARGS+=(" --sourcefiles" " $module_path /src/main/java" )
0 commit comments