From 6840edfac12f98e0f02c3ece1aad7a1794fca20d Mon Sep 17 00:00:00 2001 From: Stephan Krusche Date: Fri, 27 Sep 2024 14:06:43 +0200 Subject: [PATCH] Development: Update server dependencies Development: Update server dependencies --- .../Artemis__Server__Aeolus_.xml | 13 -------- .../Artemis__Server__GitLabCI___Gitlab_.xml | 13 -------- .../Artemis__Server__Jenkins___Gitlab_.xml | 13 -------- ...> Artemis__Server__LocalVC___Jenkins_.xml} | 5 ++- ...emis__Server__LocalVC___LocalCI__IRIS_.xml | 13 -------- build.gradle | 12 +++---- gradle.properties | 10 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- .../localci/scaparser/ReportParser.java | 3 +- .../localci/scaparser/strategy/PMDParser.java | 31 +++++++++---------- 10 files changed, 30 insertions(+), 85 deletions(-) delete mode 100644 .idea/runConfigurations/Artemis__Server__Aeolus_.xml delete mode 100644 .idea/runConfigurations/Artemis__Server__GitLabCI___Gitlab_.xml delete mode 100644 .idea/runConfigurations/Artemis__Server__Jenkins___Gitlab_.xml rename .idea/runConfigurations/{Artemis__Server__Jenkins___LocalVC_.xml => Artemis__Server__LocalVC___Jenkins_.xml} (80%) delete mode 100644 .idea/runConfigurations/Artemis__Server__LocalVC___LocalCI__IRIS_.xml diff --git a/.idea/runConfigurations/Artemis__Server__Aeolus_.xml b/.idea/runConfigurations/Artemis__Server__Aeolus_.xml deleted file mode 100644 index 13c00126a34e..000000000000 --- a/.idea/runConfigurations/Artemis__Server__Aeolus_.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/.idea/runConfigurations/Artemis__Server__GitLabCI___Gitlab_.xml b/.idea/runConfigurations/Artemis__Server__GitLabCI___Gitlab_.xml deleted file mode 100644 index 9c36e532820f..000000000000 --- a/.idea/runConfigurations/Artemis__Server__GitLabCI___Gitlab_.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/.idea/runConfigurations/Artemis__Server__Jenkins___Gitlab_.xml b/.idea/runConfigurations/Artemis__Server__Jenkins___Gitlab_.xml deleted file mode 100644 index 7ffecef4daef..000000000000 --- a/.idea/runConfigurations/Artemis__Server__Jenkins___Gitlab_.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/.idea/runConfigurations/Artemis__Server__Jenkins___LocalVC_.xml b/.idea/runConfigurations/Artemis__Server__LocalVC___Jenkins_.xml similarity index 80% rename from .idea/runConfigurations/Artemis__Server__Jenkins___LocalVC_.xml rename to .idea/runConfigurations/Artemis__Server__LocalVC___Jenkins_.xml index 47dd1c05a2fa..217477ace79d 100644 --- a/.idea/runConfigurations/Artemis__Server__Jenkins___LocalVC_.xml +++ b/.idea/runConfigurations/Artemis__Server__LocalVC___Jenkins_.xml @@ -1,13 +1,12 @@ - + - + \ No newline at end of file diff --git a/.idea/runConfigurations/Artemis__Server__LocalVC___LocalCI__IRIS_.xml b/.idea/runConfigurations/Artemis__Server__LocalVC___LocalCI__IRIS_.xml deleted file mode 100644 index 1e5bda2c16f7..000000000000 --- a/.idea/runConfigurations/Artemis__Server__LocalVC___LocalCI__IRIS_.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/build.gradle b/build.gradle index dff55628b0fc..ff065674558f 100644 --- a/build.gradle +++ b/build.gradle @@ -290,7 +290,7 @@ dependencies { implementation "org.apache.sshd:sshd-sftp:${sshd_version}" // https://mvnrepository.com/artifact/net.sourceforge.plantuml/plantuml - implementation "net.sourceforge.plantuml:plantuml:1.2024.5" + implementation "net.sourceforge.plantuml:plantuml:1.2024.7" implementation "org.jasypt:jasypt:1.9.3" implementation "me.xdrop:fuzzywuzzy:1.4.0" implementation("org.yaml:snakeyaml") { @@ -368,7 +368,7 @@ dependencies { implementation "javax.cache:cache-api:1.1.1" implementation "org.hibernate.orm:hibernate-core:${hibernate_version}" - implementation "com.zaxxer:HikariCP:5.1.0" + implementation "com.zaxxer:HikariCP:6.0.0" implementation "org.apache.commons:commons-text:1.12.0" implementation "org.apache.commons:commons-math3:3.6.1" @@ -447,7 +447,7 @@ dependencies { implementation "org.apache.maven:maven-model:3.9.9" // NOTE: 3.0.2 is broken for splitting lecture specific PDFs implementation "org.apache.pdfbox:pdfbox:3.0.1" - implementation "org.apache.commons:commons-csv:1.11.0" + implementation "org.apache.commons:commons-csv:1.12.0" implementation "org.commonmark:commonmark:0.23.0" implementation "commons-fileupload:commons-fileupload:1.5" implementation "net.lingala.zip4j:zip4j:2.11.5" @@ -457,7 +457,7 @@ dependencies { implementation "org.apfloat:apfloat:1.14.0" // use newest version of guava to avoid security issues through outdated dependencies - implementation "com.google.guava:guava:33.3.0-jre" + implementation "com.google.guava:guava:33.3.1-jre" implementation "com.sun.activation:jakarta.activation:2.0.1" // use newest version of gson to avoid security issues through outdated dependencies @@ -531,7 +531,7 @@ dependencies { testImplementation "io.github.classgraph:classgraph:4.8.176" testImplementation "org.awaitility:awaitility:4.2.2" testImplementation "org.apache.maven.shared:maven-invoker:3.3.0" - testImplementation "org.gradle:gradle-tooling-api:8.10.1" + testImplementation "org.gradle:gradle-tooling-api:8.10.2" testImplementation "org.apache.maven.surefire:surefire-report-parser:3.5.0" testImplementation "com.opencsv:opencsv:5.9" testImplementation("io.zonky.test:embedded-database-spring-test:2.5.1") { @@ -613,7 +613,7 @@ tasks.withType(Test).configureEach { } wrapper { - gradleVersion = "8.10.1" + gradleVersion = "8.10.2" } tasks.register("stage") { diff --git a/gradle.properties b/gradle.properties index 0ddd8b8f3fdc..fc54fad2849b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ node_version=20.16.0 npm_version=10.8.0 # Dependency versions -jhipster_dependencies_version=8.7.0 +jhipster_dependencies_version=8.7.1 spring_boot_version=3.3.4 spring_security_version=6.3.3 # TODO: upgrading to 6.6.0 currently leads to issues due to internal changes in Hibernate and potentially wrong use in Artemis server code @@ -16,26 +16,26 @@ opensaml_version=4.3.2 jwt_version=0.12.6 jaxb_runtime_version=4.0.5 hazelcast_version=5.5.0 -fasterxml_version=2.17.2 +fasterxml_version=2.18.0 jgit_version=7.0.0.202409031743-r sshd_version=2.13.2 checkstyle_version=10.18.1 jplag_version=5.1.0 # not really used in Artemis, nor Jplag, nor the used version of Stanford CoreNLP, but we use the latest to avoid security vulnerabilities # NOTE: we do not need to use the latest version 9.x here as long as Stanford CoreNLP does not reference it -lucene_version=8.11.3 +lucene_version=8.11.4 slf4j_version=2.0.16 sentry_version=7.14.0 liquibase_version=4.29.2 docker_java_version=3.4.0 logback_version=1.5.8 java_parser_version=3.26.2 -byte_buddy_version=1.15.1 +byte_buddy_version=1.15.3 # testing # make sure both versions are compatible junit_version=5.11.0 -junit_platform_version=1.11.0 +junit_platform_version=1.11.1 mockito_version=5.13.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0aaefbcaf0f1..df97d72b8b91 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/ReportParser.java b/src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/ReportParser.java index 74f53cb16f64..9b8f59766ac2 100644 --- a/src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/ReportParser.java +++ b/src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/ReportParser.java @@ -21,6 +21,8 @@ */ public class ReportParser { + private final ObjectMapper mapper = new ObjectMapper(); + // Reports that are bigger then the threshold will not be parsed // and an issue will be generated. The unit is in megabytes. private static final int STATIC_CODE_ANALYSIS_REPORT_FILESIZE_LIMIT_IN_MB = 1; @@ -36,7 +38,6 @@ public class ReportParser { public String transformToJSONReport(File file) throws ParserException { try { StaticCodeAnalysisReportDTO report = transformToReport(file); - ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(report); } catch (Exception e) { diff --git a/src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/PMDParser.java b/src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/PMDParser.java index 4c19428da9c9..ee7ce091b37b 100644 --- a/src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/PMDParser.java +++ b/src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/PMDParser.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; @@ -25,22 +26,18 @@ record FileViolation(@JacksonXmlProperty(isAttribute = true, localName = "name") } @JsonIgnoreProperties(ignoreUnknown = true) -record Violation(@JacksonXmlProperty(isAttribute = true, localName = "rule") String rule, - - @JacksonXmlProperty(isAttribute = true, localName = "ruleset") String ruleset, - - @JacksonXmlProperty(isAttribute = true, localName = "priority") String priority, - - @JacksonXmlProperty(isAttribute = true, localName = "beginline") int beginLine, - - @JacksonXmlProperty(isAttribute = true, localName = "endline") int endLine, - - @JacksonXmlProperty(isAttribute = true, localName = "begincolumn") int beginColumn, - - @JacksonXmlProperty(isAttribute = true, localName = "endcolumn") int endColumn, - - @JacksonXmlProperty(localName = "") @JacksonXmlText String message // inner text -) { +record Violation(String rule, String ruleset, String priority, int beginLine, int endLine, int beginColumn, int endColumn, String message) { + + // NOTE: we need the json creator here, otherwise parsing does not work with the newest version of Jackson (2.18.0) + @JsonCreator + public static Violation createViolation(@JacksonXmlProperty(isAttribute = true, localName = "rule") String rule, + @JacksonXmlProperty(isAttribute = true, localName = "ruleset") String ruleset, @JacksonXmlProperty(isAttribute = true, localName = "priority") String priority, + @JacksonXmlProperty(isAttribute = true, localName = "beginline") int beginLine, @JacksonXmlProperty(isAttribute = true, localName = "endline") int endLine, + @JacksonXmlProperty(isAttribute = true, localName = "begincolumn") int beginColumn, @JacksonXmlProperty(isAttribute = true, localName = "endcolumn") int endColumn, + @JacksonXmlProperty(localName = "") @JacksonXmlText String message // inner text + ) { + return new Violation(rule, ruleset, priority, beginLine, endLine, beginColumn, endColumn, message); + } } class PMDParser implements ParserStrategy { @@ -54,7 +51,7 @@ public StaticCodeAnalysisReportDTO parse(String xmlContent) { return createReportFromPMDReport(pmdReport); } catch (IOException e) { - throw new RuntimeException("Failed to parse XML", e); + throw new RuntimeException("Failed to parse XML: " + e.getMessage(), e); } }