This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch support/struts-6-x-x in repository https://gitbox.apache.org/repos/asf/struts.git
commit 61daa3094cad1bb126ca940bfdd486eaddcaf60e Author: Lukasz Lenart <[email protected]> AuthorDate: Sat Oct 31 15:28:59 2026 +0100 WW-5828 chore(conversion): address Sonar findings Use instanceof for the BigDecimal check (S6202) and drop the throws clause the new test does not need (S1130). Co-Authored-By: Claude Mythos 5.1 <[email protected]> --- .../java/com/opensymphony/xwork2/conversion/impl/StringConverter.java | 2 +- .../com/opensymphony/xwork2/conversion/impl/StringConverterTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/StringConverter.java b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/StringConverter.java index 9a065a7e4..8d7fc8a1b 100644 --- a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/StringConverter.java +++ b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/StringConverter.java @@ -102,7 +102,7 @@ public class StringConverter extends DefaultTypeConverter { } protected String convertToString(Locale locale, Object value) { - if (BigDecimal.class.isInstance(value) && integerDigits((BigDecimal) value) > MAX_INTEGER_DIGITS) { + if (value instanceof BigDecimal && integerDigits((BigDecimal) value) > MAX_INTEGER_DIGITS) { return value.toString(); } if (Number.class.isInstance(value)) { diff --git a/core/src/test/java/com/opensymphony/xwork2/conversion/impl/StringConverterTest.java b/core/src/test/java/com/opensymphony/xwork2/conversion/impl/StringConverterTest.java index 4160a7eab..d08238175 100644 --- a/core/src/test/java/com/opensymphony/xwork2/conversion/impl/StringConverterTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/conversion/impl/StringConverterTest.java @@ -115,7 +115,7 @@ public class StringConverterTest extends StrutsInternalTestCase { assertEquals("0", value); } - public void testBigDecimalIntegerDigitsAreBounded() throws Exception { + public void testBigDecimalIntegerDigitsAreBounded() { // given StringConverter converter = new StringConverter(); Map<String, Object> context = createContextWithLocale(new Locale("pl", "PL"));
