@@ -543,6 +543,7 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
543
543
if (targetType == null || targetType .isArray () || unknownEditorTypes .contains (targetType )) {
544
544
return null ;
545
545
}
546
+
546
547
ClassLoader cl = targetType .getClassLoader ();
547
548
if (cl == null ) {
548
549
try {
@@ -559,28 +560,34 @@ public static PropertyEditor findEditorByConvention(@Nullable Class<?> targetTyp
559
560
return null ;
560
561
}
561
562
}
563
+
562
564
String targetTypeName = targetType .getName ();
563
565
String editorName = targetTypeName + "Editor" ;
564
566
try {
565
567
Class <?> editorClass = cl .loadClass (editorName );
566
- if (!PropertyEditor .class .isAssignableFrom (editorClass )) {
567
- if (logger .isInfoEnabled ()) {
568
- logger .info ("Editor class [" + editorName +
569
- "] does not implement [java.beans.PropertyEditor] interface" );
568
+ if (editorClass != null ) {
569
+ if (!PropertyEditor .class .isAssignableFrom (editorClass )) {
570
+ if (logger .isInfoEnabled ()) {
571
+ logger .info ("Editor class [" + editorName +
572
+ "] does not implement [java.beans.PropertyEditor] interface" );
573
+ }
574
+ unknownEditorTypes .add (targetType );
575
+ return null ;
570
576
}
571
- unknownEditorTypes .add (targetType );
572
- return null ;
577
+ return (PropertyEditor ) instantiateClass (editorClass );
573
578
}
574
- return (PropertyEditor ) instantiateClass (editorClass );
579
+ // Misbehaving ClassLoader returned null instead of ClassNotFoundException
580
+ // - fall back to unknown editor type registration below
575
581
}
576
582
catch (ClassNotFoundException ex ) {
577
- if (logger .isTraceEnabled ()) {
578
- logger .trace ("No property editor [" + editorName + "] found for type " +
579
- targetTypeName + " according to 'Editor' suffix convention" );
580
- }
581
- unknownEditorTypes .add (targetType );
582
- return null ;
583
+ // Ignore - fall back to unknown editor type registration below
583
584
}
585
+ if (logger .isTraceEnabled ()) {
586
+ logger .trace ("No property editor [" + editorName + "] found for type " +
587
+ targetTypeName + " according to 'Editor' suffix convention" );
588
+ }
589
+ unknownEditorTypes .add (targetType );
590
+ return null ;
584
591
}
585
592
586
593
/**
0 commit comments