mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-26 22:29:24 +00:00
fix junit
This commit is contained in:
parent
a6fee5e90f
commit
9ebb4a3c31
@ -1,6 +1,7 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ public class ExceptionUtils {
|
|||||||
*/
|
*/
|
||||||
public static IOException createIOException(
|
public static IOException createIOException(
|
||||||
String messageKey, String defaultMessage, Exception cause, Object... args) {
|
String messageKey, String defaultMessage, Exception cause, Object... args) {
|
||||||
String message = String.format(defaultMessage, args);
|
String message = MessageFormat.format(defaultMessage, args);
|
||||||
return new IOException(message, cause);
|
return new IOException(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +120,7 @@ public class ExceptionUtils {
|
|||||||
*/
|
*/
|
||||||
public static RuntimeException createRuntimeException(
|
public static RuntimeException createRuntimeException(
|
||||||
String messageKey, String defaultMessage, Exception cause, Object... args) {
|
String messageKey, String defaultMessage, Exception cause, Object... args) {
|
||||||
String message = String.format(defaultMessage, args);
|
String message = MessageFormat.format(defaultMessage, args);
|
||||||
return new RuntimeException(message, cause);
|
return new RuntimeException(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +134,7 @@ public class ExceptionUtils {
|
|||||||
*/
|
*/
|
||||||
public static IllegalArgumentException createIllegalArgumentException(
|
public static IllegalArgumentException createIllegalArgumentException(
|
||||||
String messageKey, String defaultMessage, Object... args) {
|
String messageKey, String defaultMessage, Object... args) {
|
||||||
String message = String.format(defaultMessage, args);
|
String message = MessageFormat.format(defaultMessage, args);
|
||||||
return new IllegalArgumentException(message);
|
return new IllegalArgumentException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,11 +56,8 @@ public class ConvertWebsiteToPDF {
|
|||||||
}
|
}
|
||||||
// Validate the URL format
|
// Validate the URL format
|
||||||
if (!URL.matches("^https?://.*") || !GeneralUtils.isValidURL(URL)) {
|
if (!URL.matches("^https?://.*") || !GeneralUtils.isValidURL(URL)) {
|
||||||
throw ExceptionUtils.createIllegalArgumentException(
|
throw ExceptionUtils.createInvalidArgumentException(
|
||||||
"error.invalidFormat",
|
"URL", "provided format is invalid");
|
||||||
"Invalid {0} format: {1}",
|
|
||||||
"URL",
|
|
||||||
"provided format is invalid");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate the URL is reachable
|
// validate the URL is reachable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user