Author: swd847
Date: 2010-10-13 06:39:47 -0400 (Wed, 13 Oct 2010)
New Revision: 13840
Modified:
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java
Log:
ensure fields are accessible when setting field values
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
===================================================================
---
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-10-13
10:22:34 UTC (rev 13839)
+++
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-10-13
10:39:47 UTC (rev 13840)
@@ -226,6 +226,7 @@
throw new XmlConfigurationException("A virtual producer field may not
containe <override> or <extend> tags", getDocument(), getLineno());
}
Field member =
org.jboss.seam.xml.util.Reflections.getField(VirtualProducerField.class,
"field");
+ member.setAccessible(true);
ClassXmlItem vclass = new ClassXmlItem(null, VirtualProducerField.class,
Collections.<String, String> emptyMap(), document, lineno);
PropertyXmlItem field = new PropertyXmlItem(vclass,
Properties.createProperty(member), null, getJavaClass(), document, lineno);
vclass.addChild(field);
Modified:
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java
===================================================================
---
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java 2010-10-13
10:22:34 UTC (rev 13839)
+++
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java 2010-10-13
10:39:47 UTC (rev 13840)
@@ -21,6 +21,9 @@
*/
package org.jboss.seam.xml.parser.namespace;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -137,6 +140,19 @@
}
else if (property != null)
{
+ // ensure the property is accessible
+ Member member = property.getMember();
+ if (member instanceof Field)
+ {
+ Field field = (Field) member;
+ field.setAccessible(true);
+ }
+ else if (member instanceof Method)
+ {
+ Method method = (Method) member;
+ method.setAccessible(true);
+ }
+
return new PropertyXmlItem(parent, property, innerText, null, document,
lineno);
}
return null;
Show replies by date