Commit 8edb730a authored by Lückemeyer's avatar Lückemeyer
Browse files

fixed pattern matching for path removal in not compilable result

parent 5bb8c5af
......@@ -163,9 +163,11 @@ public class Testrunner
options.add("-d"); // output dir
options.add(outputDir.getAbsolutePath());
options.add("-cp"); // custom classpath
String os=System.getProperty("os.name");
final String osSpecificCpDelim=(os.indexOf("Windows")>-1?";":":");
String cp = buildClassPath(classPathItems).stream()
.map(f -> f.getPath())
.reduce((s1, s2) -> s1 + ":" + s2).orElse("");
.reduce((s1, s2) -> s1 + osSpecificCpDelim + s2).orElse("");
LOG.info("classpath for compilation: " + cp);
options.add(cp);
......@@ -213,10 +215,12 @@ public class Testrunner
return compilationErrors.stream().map(e ->
{
Result result = new Result();
Pattern pattern = Pattern.compile(String.format("^.*%s(.*\\.java).*$", File.separator));
Matcher matcher = pattern.matcher(String.valueOf(e.getSource()));
result.name = (matcher.matches() && matcher.group(1) != null) ? matcher.group(1) : String.valueOf(e.getSource());
// Pattern pattern = Pattern.compile(String.format("^.*%s(.*\\.java).*$", File.separator));
// Matcher matcher = pattern.matcher(String.valueOf(e.getSource()));
//
// result.name = (matcher.matches() && matcher.group(1) != null) ? matcher.group(1) : String.valueOf(e.getSource());
String sourcePath=String.valueOf(e.getSource());
result.name=sourcePath.substring(sourcePath.lastIndexOf(File.separator)+1, sourcePath.length()-1);
result.state = Result.State.COMPILATIONERROR.ordinal();
result.failureReason = e.getMessage(Locale.ENGLISH);
result.failureType = "Compilation Failed";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment