-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catch exceptions and show error message.
- Loading branch information
Showing
8 changed files
with
271 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package edu.hm.hafner.grading; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.NoSuchElementException; | ||
|
||
import edu.hm.hafner.util.FilteredLog; | ||
|
||
/** | ||
* A base class for all report factories. Provides common functionality to find report files. | ||
* | ||
* @author Ullrich Hafner | ||
*/ | ||
abstract class ReportFactory { | ||
protected List<Path> findFiles(final ToolConfiguration tool, final FilteredLog log) { | ||
log.logInfo("Searching for %s results matching file name pattern %s", | ||
tool.getDisplayName(), tool.getPattern()); | ||
List<Path> files = new ReportFinder().find("glob:" + tool.getPattern()); | ||
|
||
if (files.isEmpty()) { | ||
throw new NoSuchElementException(String.format("No matching report files found when using pattern '%s'! " | ||
+ "Configuration error for '%s'?", tool.getPattern(), tool.getDisplayName())); | ||
} | ||
|
||
Collections.sort(files); | ||
return files; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.