[jboss-cvs] JBossAS SVN: r75324 - projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/attr.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 3 00:49:53 EDT 2008
Author: anil.saldhana at jboss.com
Date: 2008-07-03 00:49:53 -0400 (Thu, 03 Jul 2008)
New Revision: 75324
Modified:
projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/attr/AttributeDesignator.java
Log:
SECURITY-257: throw a RTE instead of a NPE when mandatory xml attributes not found
Modified: projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/attr/AttributeDesignator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/attr/AttributeDesignator.java 2008-07-03 04:30:39 UTC (rev 75323)
+++ projects/security/security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/attr/AttributeDesignator.java 2008-07-03 04:49:53 UTC (rev 75324)
@@ -228,7 +228,11 @@
try {
// there's always an Id
- id = new URI(attrs.getNamedItem("AttributeId").getNodeValue());
+ Node attributeIdNode = attrs.getNamedItem("AttributeId");
+ if(attributeIdNode == null)
+ throw new IllegalStateException("Required AttributeId missing in " +
+ "AttributeDesignator ->" + root.getNodeName() );
+ id = new URI(attributeIdNode.getNodeValue());
} catch (Exception e) {
throw new ParsingException("Required AttributeId missing in " +
"AttributeDesignator", e);
@@ -236,7 +240,11 @@
try {
// there's always a data type
- type = new URI(attrs.getNamedItem("DataType").getNodeValue());
+ Node dataTypeNode = attrs.getNamedItem("DataType");
+ if(dataTypeNode == null)
+ throw new IllegalStateException("Required DataType missing in " +
+ "AttributeDesignator ->" + root.getNodeName());
+ type = new URI(dataTypeNode.getNodeValue());
} catch (Exception e) {
throw new ParsingException("Required DataType missing in " +
"AttributeDesignator", e);
More information about the jboss-cvs-commits
mailing list