Skip to content

Commit 6be5069

Browse files
committed
Minor cleanup of POJOPropertiesCollector (wrt error reporting)
1 parent 9ab6356 commit 6be5069

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertiesCollector.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -901,9 +901,8 @@ protected void _doAddInjectable(JacksonInject.Value injectable, AnnotatedMember
901901
if (prev != null) {
902902
// 12-Apr-2017, tatu: Let's allow masking of Field by Method
903903
if (prev.getClass() == m.getClass()) {
904-
String type = id.getClass().getName();
905-
throw new IllegalArgumentException("Duplicate injectable value with id '"
906-
+ id +"' (of type "+type+")");
904+
reportProblem("Duplicate injectable value with id '%s' (of type %s)",
905+
id, ClassUtil.classNameOf(id));
907906
}
908907
}
909908
}
@@ -1351,12 +1350,12 @@ private PropertyNamingStrategy _findNamingStrategy()
13511350
if (namingDef instanceof PropertyNamingStrategy) {
13521351
return (PropertyNamingStrategy) namingDef;
13531352
}
1354-
/* Alas, there's no way to force return type of "either class
1355-
* X or Y" -- need to throw an exception after the fact
1356-
*/
1353+
// Alas, there's no way to force return type of "either class
1354+
// X or Y" -- need to throw an exception after the fact
13571355
if (!(namingDef instanceof Class)) {
1358-
throw new IllegalStateException("AnnotationIntrospector returned PropertyNamingStrategy definition of type "
1359-
+namingDef.getClass().getName()+"; expected type PropertyNamingStrategy or Class<PropertyNamingStrategy> instead");
1356+
reportProblem("AnnotationIntrospector returned PropertyNamingStrategy definition of type %s"
1357+
+ "; expected type `PropertyNamingStrategy` or `Class<PropertyNamingStrategy>` instead",
1358+
ClassUtil.classNameOf(namingDef));
13601359
}
13611360
Class<?> namingClass = (Class<?>)namingDef;
13621361
// 09-Nov-2015, tatu: Need to consider pseudo-value of STD, which means "use default"
@@ -1365,8 +1364,8 @@ private PropertyNamingStrategy _findNamingStrategy()
13651364
}
13661365

13671366
if (!PropertyNamingStrategy.class.isAssignableFrom(namingClass)) {
1368-
throw new IllegalStateException("AnnotationIntrospector returned Class "
1369-
+namingClass.getName()+"; expected Class<PropertyNamingStrategy>");
1367+
reportProblem("AnnotationIntrospector returned Class %s; expected `Class<PropertyNamingStrategy>`",
1368+
ClassUtil.classNameOf(namingClass));
13701369
}
13711370
HandlerInstantiator hi = _config.getHandlerInstantiator();
13721371
if (hi != null) {

0 commit comments

Comments
 (0)