From 750648e594e1174632884c6c2884196636db13db Mon Sep 17 00:00:00 2001 From: Jonathan Heindl Date: Fri, 16 Sep 2022 14:45:09 +0200 Subject: [PATCH] add option to index maps by Integer key --- .../apache/commons/beanutils2/PropertyUtilsBean.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java b/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java index 4fa5d32a1..0185fcb86 100644 --- a/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java +++ b/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java @@ -797,7 +797,15 @@ protected Object getPropertyOfMapBean(final Map bean, String propertyName) + " objects of type Map: " + propertyName); } - return bean.get(propertyName); + Object result = bean.get(propertyName); + if(result==null){ + try{ + return bean.get(Integer.parseInt(propertyName)) + }catch(NumberFormatException ex){ + return result; + } + } + return result; } /**