Skip to content

Commit ee1a946

Browse files
authored
Merge pull request #50 from utPLSQL/bugfix/coverage_html_reporter
CoverageHTMLReporter: Overwrite assets and handle NULL ProjectName
2 parents 0a13dd1 + 771b02c commit ee1a946

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/main/java/org/utplsql/api/reporter/CoverageHTMLReporter.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import java.io.IOException;
66
import java.io.InputStream;
77
import java.net.URISyntaxException;
8-
import java.nio.file.Files;
9-
import java.nio.file.Path;
10-
import java.nio.file.Paths;
8+
import java.nio.file.*;
119
import java.util.List;
1210
import java.util.function.Consumer;
1311

@@ -33,8 +31,15 @@ protected void setAttributes(Object[] attributes) {
3331
super.setAttributes(attributes);
3432

3533
if ( attributes != null ) {
36-
projectName = String.valueOf(attributes[3]);
37-
assetsPath = String.valueOf(attributes[4]);
34+
if ( attributes[3] != null )
35+
projectName = String.valueOf(attributes[3]);
36+
else
37+
projectName = null;
38+
39+
if ( attributes[4] != null )
40+
assetsPath = String.valueOf(attributes[4]);
41+
else
42+
assetsPath = null;
3843
}
3944
}
4045

@@ -82,7 +87,7 @@ private static void copyFileFromClasspath( Path assetPath, Path targetDirectory,
8287
try (InputStream is = CoverageHTMLReporter.class.getClassLoader()
8388
.getResourceAsStream(assetPath.toString())
8489
) {
85-
Files.copy( is, targetAssetPath );
90+
Files.copy( is, targetAssetPath, StandardCopyOption.REPLACE_EXISTING);
8691
}
8792
}
8893

0 commit comments

Comments
 (0)