[jboss-jira] [JBoss JIRA] Created: (SECURITY-206) Attribute type not set in constructor

Kevin Carlin (JIRA) jira-events at lists.jboss.org
Fri Apr 25 13:13:09 EDT 2008


Attribute type not set in constructor
-------------------------------------

                 Key: SECURITY-206
                 URL: http://jira.jboss.com/jira/browse/SECURITY-206
             Project: JBoss Security and Identity Management
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: JBossXACML
    Affects Versions: 2.0.2.GA
         Environment: JBoss-5.0.0.Beta4 (Windows XP, Solaris 10, Mac OS X 10.5.2)
            Reporter: Kevin Carlin
         Assigned To: Anil Saldhana
            Priority: Minor
             Fix For: 2.0.2.GA


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.enterra.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,


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list