Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Dockerized Testing Toolkit
Testrunner OpenJDK11 JUnit5-Jupiter
Commits
8edb730a
Commit
8edb730a
authored
Oct 11, 2023
by
Lückemeyer
Browse files
fixed pattern matching for path removal in not compilable result
parent
5bb8c5af
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/hftstuttgart/dtt/Testrunner.java
View file @
8edb730a
...
...
@@ -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"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment