mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-10 18:00:11 +01:00
Define a constant for a literal string that is duplicated n times (Sonar) (#978)
Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
This commit is contained in:
parent
c16db14cd9
commit
1035a3be31
@ -129,7 +129,7 @@ public class EndpointConfiguration {
|
||||
addEndpointToGroup("Other", "sign");
|
||||
addEndpointToGroup("Other", "flatten");
|
||||
addEndpointToGroup("Other", "repair");
|
||||
addEndpointToGroup("Other", "remove-blanks");
|
||||
addEndpointToGroup("Other", REMOVE_BLANKS);
|
||||
addEndpointToGroup("Other", "remove-annotations");
|
||||
addEndpointToGroup("Other", "compare");
|
||||
addEndpointToGroup("Other", "add-page-numbers");
|
||||
@ -161,13 +161,13 @@ public class EndpointConfiguration {
|
||||
|
||||
// python
|
||||
addEndpointToGroup("Python", "extract-image-scans");
|
||||
addEndpointToGroup("Python", "remove-blanks");
|
||||
addEndpointToGroup("Python", REMOVE_BLANKS);
|
||||
addEndpointToGroup("Python", "html-to-pdf");
|
||||
addEndpointToGroup("Python", "url-to-pdf");
|
||||
|
||||
// openCV
|
||||
addEndpointToGroup("OpenCV", "extract-image-scans");
|
||||
addEndpointToGroup("OpenCV", "remove-blanks");
|
||||
addEndpointToGroup("OpenCV", REMOVE_BLANKS);
|
||||
|
||||
// LibreOffice
|
||||
addEndpointToGroup("LibreOffice", "repair");
|
||||
@ -217,7 +217,7 @@ public class EndpointConfiguration {
|
||||
addEndpointToGroup("Java", "split-by-size-or-count");
|
||||
addEndpointToGroup("Java", "overlay-pdf");
|
||||
addEndpointToGroup("Java", "split-pdf-by-sections");
|
||||
addEndpointToGroup("Java", "remove-blanks");
|
||||
addEndpointToGroup("Java", REMOVE_BLANKS);
|
||||
|
||||
// Javascript
|
||||
addEndpointToGroup("Javascript", "pdf-organizer");
|
||||
@ -244,4 +244,6 @@ public class EndpointConfiguration {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final String REMOVE_BLANKS = "remove-blanks";
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class UserController {
|
||||
// Logout using Spring's utility
|
||||
new SecurityContextLogoutHandler().logout(request, response, null);
|
||||
|
||||
return new RedirectView("/login?messageType=credsUpdated");
|
||||
return new RedirectView(LOGIN_MESSAGETYPE_CREDSUPDATED);
|
||||
}
|
||||
|
||||
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
|
||||
@ -130,7 +130,7 @@ public class UserController {
|
||||
// Logout using Spring's utility
|
||||
new SecurityContextLogoutHandler().logout(request, response, null);
|
||||
|
||||
return new RedirectView("/login?messageType=credsUpdated");
|
||||
return new RedirectView(LOGIN_MESSAGETYPE_CREDSUPDATED);
|
||||
}
|
||||
|
||||
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
|
||||
@ -163,7 +163,7 @@ public class UserController {
|
||||
// Logout using Spring's utility
|
||||
new SecurityContextLogoutHandler().logout(request, response, null);
|
||||
|
||||
return new RedirectView("/login?messageType=credsUpdated");
|
||||
return new RedirectView(LOGIN_MESSAGETYPE_CREDSUPDATED);
|
||||
}
|
||||
|
||||
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
|
||||
@ -291,4 +291,6 @@ public class UserController {
|
||||
}
|
||||
return ResponseEntity.ok(apiKey);
|
||||
}
|
||||
|
||||
private static final String LOGIN_MESSAGETYPE_CREDSUPDATED = "/login?messageType=credsUpdated";
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ public class ExtractImageScansController {
|
||||
// Create zip file if multiple images
|
||||
if (processedImageBytes.size() > 1) {
|
||||
String outputZipFilename =
|
||||
fileName.replaceFirst("[.][^.]+$", "") + "_processed.zip";
|
||||
fileName.replaceFirst(REPLACEFIRST, "") + "_processed.zip";
|
||||
tempZipFile = Files.createTempFile("output_", ".zip");
|
||||
|
||||
try (ZipOutputStream zipOut =
|
||||
@ -165,7 +165,7 @@ public class ExtractImageScansController {
|
||||
for (int i = 0; i < processedImageBytes.size(); i++) {
|
||||
ZipEntry entry =
|
||||
new ZipEntry(
|
||||
fileName.replaceFirst("[.][^.]+$", "")
|
||||
fileName.replaceFirst(REPLACEFIRST, "")
|
||||
+ "_"
|
||||
+ (i + 1)
|
||||
+ ".png");
|
||||
@ -187,7 +187,7 @@ public class ExtractImageScansController {
|
||||
byte[] imageBytes = processedImageBytes.get(0);
|
||||
return WebResponseUtils.bytesToWebResponse(
|
||||
imageBytes,
|
||||
fileName.replaceFirst("[.][^.]+$", "") + ".png",
|
||||
fileName.replaceFirst(REPLACEFIRST, "") + ".png",
|
||||
MediaType.IMAGE_PNG);
|
||||
}
|
||||
} finally {
|
||||
@ -219,4 +219,6 @@ public class ExtractImageScansController {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static final String REPLACEFIRST = "[.][^.]+$";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user