Skip to content

Commit

Permalink
Merge pull request #2172 from jplag/check-report-viewer-exists
Browse files Browse the repository at this point in the history
Warning when report viewer not included
  • Loading branch information
tsaglam authored Feb 13, 2025
2 parents a93c6c0 + dd08bb8 commit 2d6d2e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/src/main/java/de/jplag/cli/JPlagRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public static JPlagResult runJPlag(JPlagOptions options) throws ExitException {
* @throws IOException If the internal server throws an exception
*/
public static void runInternalServer(File zipFile, int port) throws IOException {
if (!ReportViewer.hasCompiledViewer()) {
logger.warn("The report viewer is not available. Check whether you compiled JPlag with the report viewer.");
return;
}
ReportViewer reportViewer = new ReportViewer(zipFile, port);
int actualPort = reportViewer.start();
logger.info("ReportViewer started on port http://localhost:{}", actualPort);
Expand Down
4 changes: 4 additions & 0 deletions cli/src/main/java/de/jplag/cli/server/ReportViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,8 @@ public void handle(HttpExchange exchange) throws IOException {
RoutingTree getRoutingTree() {
return routingTree;
}

public static boolean hasCompiledViewer() {
return ResponseData.fromResourceUrl("/" + REPORT_VIEWER_RESOURCE_PREFIX + "/index.html") != null;
}
}

0 comments on commit 2d6d2e8

Please sign in to comment.