@@ -506,6 +506,7 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
506
506
if (targetType == null || targetType .isArray () || unknownEditorTypes .contains (targetType )) {
507
507
return null ;
508
508
}
509
+
509
510
ClassLoader cl = targetType .getClassLoader ();
510
511
if (cl == null ) {
511
512
try {
@@ -522,28 +523,34 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
522
523
return null ;
523
524
}
524
525
}
526
+
525
527
String targetTypeName = targetType .getName ();
526
528
String editorName = targetTypeName + "Editor" ;
527
529
try {
528
530
Class <?> editorClass = cl .loadClass (editorName );
529
- if (!PropertyEditor .class .isAssignableFrom (editorClass )) {
530
- if (logger .isInfoEnabled ()) {
531
- logger .info ("Editor class [" + editorName +
532
- "] does not implement [java.beans.PropertyEditor] interface" );
531
+ if (editorClass != null ) {
532
+ if (!PropertyEditor .class .isAssignableFrom (editorClass )) {
533
+ if (logger .isInfoEnabled ()) {
534
+ logger .info ("Editor class [" + editorName +
535
+ "] does not implement [java.beans.PropertyEditor] interface" );
536
+ }
537
+ unknownEditorTypes .add (targetType );
538
+ return null ;
533
539
}
534
- unknownEditorTypes .add (targetType );
535
- return null ;
540
+ return (PropertyEditor ) instantiateClass (editorClass );
536
541
}
537
- return (PropertyEditor ) instantiateClass (editorClass );
542
+ // Misbehaving ClassLoader returned null instead of ClassNotFoundException
543
+ // - fall back to unknown editor type registration below
538
544
}
539
545
catch (ClassNotFoundException ex ) {
540
- if (logger .isTraceEnabled ()) {
541
- logger .trace ("No property editor [" + editorName + "] found for type " +
542
- targetTypeName + " according to 'Editor' suffix convention" );
543
- }
544
- unknownEditorTypes .add (targetType );
545
- return null ;
546
+ // Ignore - fall back to unknown editor type registration below
546
547
}
548
+ if (logger .isTraceEnabled ()) {
549
+ logger .trace ("No property editor [" + editorName + "] found for type " +
550
+ targetTypeName + " according to 'Editor' suffix convention" );
551
+ }
552
+ unknownEditorTypes .add (targetType );
553
+ return null ;
547
554
}
548
555
549
556
/**
0 commit comments