-
Bug
-
Resolution: Done
-
Minor
-
JBossSecurity_2.0.2.GA
-
None
The constructor public Attribute(URI id, String issuer, DateTimeAttribute issueInstant, AttributeValue value) fails to set the attribute's type. Test case and patch below:
JUnit test case.
/**
*/
package test.attributefinder;
import static org.junit.Assert.*;
import java.net.URI;
import java.net.URISyntaxException;
import org.jboss.security.xacml.sunxacml.attr.DateTimeAttribute;
import org.jboss.security.xacml.sunxacml.attr.StringAttribute;
import org.jboss.security.xacml.sunxacml.ctx.Attribute;
import org.junit.Test;
/**
- @author kevincarlin
*
*/
public class AttributeTest {
/**
- Test method for
{@link org.jboss.security.xacml.sunxacml.ctx.Attribute#Attribute(java.net.URI, java.lang.String, org.jboss.security.xacml.sunxacml.attr.DateTimeAttribute, org.jboss.security.xacml.sunxacml.attr.AttributeValue)}
.
- @throws Throwable
*/
@Test
public void testAttributeURIStringDateTimeAttributeAttributeValue() throws Throwable { Attribute attribute = new Attribute(new URI("urn:oasis:names:tc:xacml:1.0:resource:resource-id"), "com.bifrost.dnipilot", new DateTimeAttribute(), new StringAttribute("Test")); assertNotNull("Attribute type must be set in the constructor", attribute.getType()); }
}
Patch:
Index: security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/ctx/Attribute.java
===================================================================
— . (revision 72241)
+++ . (working copy)
@@ -99,6 +99,7 @@
if(this.attributeValues == null)
this.attributeValues = new HashSet<AttributeValue>();
this.attributeValues.add(value);
+ this.type = value.getType();
}
public Attribute(URI id, URI type, String issuer, DateTimeAttribute issueInstant,