mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#1370 avoid errors when Joda is not on classpath
This commit is contained in:
parent
2d8af2960b
commit
e368b34ea4
@ -154,6 +154,9 @@ final class DateFormatValidatorFactory {
|
|||||||
catch ( InvocationTargetException e ) {
|
catch ( InvocationTargetException e ) {
|
||||||
return invalidDateFormat( dateFormat, e.getCause() );
|
return invalidDateFormat( dateFormat, e.getCause() );
|
||||||
}
|
}
|
||||||
|
catch ( ClassNotFoundException e ) {
|
||||||
|
return noJodaOnClassPath();
|
||||||
|
}
|
||||||
catch ( Exception e ) {
|
catch ( Exception e ) {
|
||||||
return invalidDateFormat( dateFormat, e );
|
return invalidDateFormat( dateFormat, e );
|
||||||
}
|
}
|
||||||
@ -185,4 +188,8 @@ final class DateFormatValidatorFactory {
|
|||||||
private static DateFormatValidationResult invalidDateFormat(String dateFormat, Throwable e) {
|
private static DateFormatValidationResult invalidDateFormat(String dateFormat, Throwable e) {
|
||||||
return new DateFormatValidationResult( false, Message.GENERAL_INVALID_DATE, dateFormat, e.getMessage() );
|
return new DateFormatValidationResult( false, Message.GENERAL_INVALID_DATE, dateFormat, e.getMessage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static DateFormatValidationResult noJodaOnClassPath() {
|
||||||
|
return new DateFormatValidationResult( false, Message.GENERAL_JODA_NOT_ON_CLASSPATH );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,7 @@ public enum Message {
|
|||||||
GENERAL_UNSUPPORTED_DATE_FORMAT_CHECK( "No dateFormat check is supported for types %s, %s" ),
|
GENERAL_UNSUPPORTED_DATE_FORMAT_CHECK( "No dateFormat check is supported for types %s, %s" ),
|
||||||
GENERAL_VALID_DATE( "Given date format \"%s\" is valid.", Diagnostic.Kind.NOTE ),
|
GENERAL_VALID_DATE( "Given date format \"%s\" is valid.", Diagnostic.Kind.NOTE ),
|
||||||
GENERAL_INVALID_DATE( "Given date format \"%s\" is invalid. Message: \"%s\"." ),
|
GENERAL_INVALID_DATE( "Given date format \"%s\" is invalid. Message: \"%s\"." ),
|
||||||
|
GENERAL_JODA_NOT_ON_CLASSPATH( "Cannot validate Joda dateformat, no Joda on classpath. Consider adding Joda to the annotation processorpath.", Diagnostic.Kind.WARNING ),
|
||||||
GENERAL_NOT_ALL_FORGED_CREATED( "Internal Error in creation of Forged Methods, it was expected all Forged Methods to finished with creation, but %s did not" ),
|
GENERAL_NOT_ALL_FORGED_CREATED( "Internal Error in creation of Forged Methods, it was expected all Forged Methods to finished with creation, but %s did not" ),
|
||||||
GENERAL_NO_SUITABLE_CONSTRUCTOR( "%s does not have an accessible parameterless constructor." ),
|
GENERAL_NO_SUITABLE_CONSTRUCTOR( "%s does not have an accessible parameterless constructor." ),
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user