Skip to content

Commit

Permalink
Fix upgrade org.gaul:modernizer-maven-plugin from 2.9.0 to 3.0.0 (#28325
Browse files Browse the repository at this point in the history
)
  • Loading branch information
qmonmert authored Dec 30, 2024
1 parent 4cb6a35 commit 2f96b5f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion generators/server/resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<maven-site-plugin.version>3.21.0</maven-site-plugin.version>
<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
<maven-war-plugin.version>3.4.0</maven-war-plugin.version>
<modernizer-maven-plugin.version>2.9.0</modernizer-maven-plugin.version>
<modernizer-maven-plugin.version>3.0.0</modernizer-maven-plugin.version>
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
<openapi-generator-maven-plugin.version>7.10.0</openapi-generator-maven-plugin.version>
<properties-maven-plugin.version>1.2.1</properties-maven-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import jakarta.servlet.*;
<%_ if (!skipClient) { _%>
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.nio.file.Path;

import static java.net.URLDecoder.decode;
<%_ } _%>
Expand Down Expand Up @@ -150,7 +150,7 @@ public class WebConfigurer implements <% if (!reactive) { %>ServletContextInitia
if (server instanceof ConfigurableServletWebServerFactory servletWebServer) {
File root;
String prefixPath = resolvePathPrefix();
root = new File(prefixPath + "<%= clientDistDir %>");
root = Path.of(prefixPath + "<%= clientDistDir %>").toFile();
if (root.exists() && root.isDirectory()) {
servletWebServer.setDocumentRoot(root);
}
Expand All @@ -162,7 +162,7 @@ public class WebConfigurer implements <% if (!reactive) { %>ServletContextInitia
*/
private String resolvePathPrefix() {
String fullExecutablePath = decode(this.getClass().getResource("").getPath(), StandardCharsets.UTF_8);
String rootPath = Paths.get(".").toUri().normalize().getPath();
String rootPath = Path.of(".").toUri().normalize().getPath();
String extractedPath = fullExecutablePath.replace(rootPath, "");
int extractionEndIndex = extractedPath.indexOf("<%= temporaryDir %>");
if (extractionEndIndex <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import jakarta.servlet.*;
<%_ if (!skipClient) { _%>
import java.io.File;
import java.nio.file.Path;
<%_ } _%>
import java.util.*;

Expand Down Expand Up @@ -82,7 +82,7 @@ class WebConfigurerTest {
assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html");
assertThat(container.getMimeMappings().get("json")).isEqualTo("application/json");
if (container.getDocumentRoot() != null) {
assertThat(container.getDocumentRoot()).isEqualTo(new File("<%= clientDistDir %>"));
assertThat(container.getDocumentRoot()).isEqualTo(Path.of("<%= clientDistDir %>").toFile());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import jakarta.mail.internet.MimeBodyPart;
import jakarta.mail.internet.MimeMessage;
import jakarta.mail.internet.MimeMultipart;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URL;
Expand Down Expand Up @@ -227,9 +227,9 @@ class MailServiceIT {

String propertyFilePath = "i18n/messages_" + getMessageSourceSuffixForLanguage(langKey) + ".properties";
URL resource = this.getClass().getClassLoader().getResource(propertyFilePath);
File file = new File(new URI(resource.getFile()).getPath());
Path filePath = Path.of(new URI(resource.getFile()).getPath());
Properties properties = new Properties();
properties.load(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
properties.load(new InputStreamReader(Files.newInputStream(filePath), Charset.forName("UTF-8")));

String emailTitle = (String) properties.get("email.test.title");
assertThat(message.getSubject()).isEqualTo(emailTitle);
Expand Down

0 comments on commit 2f96b5f

Please sign in to comment.