diff --git a/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java b/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java index 53f424681..5db20fc4f 100644 --- a/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java +++ b/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java @@ -285,12 +285,28 @@ public class SecurityMemberAccessTest extends TestCase { assertTrue("Invalid test! Access to static method of excluded class is blocked!", actual); } + public void testAccessPrimitiveInt() throws Exception { + // given + SecurityMemberAccess sma = new SecurityMemberAccess(false); + + String propertyName = "intField"; + Member member = FooBar.class.getMethod("get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1)); + + // when + boolean accessible = sma.isAccessible(context, target, member, propertyName); + + // then + assertTrue(accessible); + } + } class FooBar implements FooBarInterface { private String stringField; + private int intField; + public String getStringField() { return stringField; } @@ -312,6 +328,13 @@ class FooBar implements FooBarInterface { return 1; } + public int getIntField() { + return intField; + } + + public void setIntField(int intField) { + this.intField = intField; + } } interface FooInterface {