crafterm 2002/10/04 14:26:38
Modified: xfc/src/java/org/apache/excalibur/xfc/modules ECM.java
Log:
Added validation of the input/output context's
Revision Changes Path
1.3 +22 -1
jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/modules/ECM.java
Index: ECM.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/modules/ECM.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ECM.java 4 Oct 2002 14:46:35 -0000 1.2
+++ ECM.java 4 Oct 2002 21:26:38 -0000 1.3
@@ -117,6 +117,8 @@
public Model generate( final String context )
throws Exception
{
+ validateContext( context );
+
Configuration[] roles = getRoles( getRoleFile( context ) );
Model model = new Model();
@@ -372,6 +374,8 @@
public void serialize( final Model model, final String context )
throws Exception
{
+ validateContext( context );
+
RoleRef[] rolerefs = model.getDefinitions();
DefaultConfiguration roles = new DefaultConfiguration( "role-list", "" );
@@ -458,6 +462,23 @@
role.setAttribute( "default-class", defs[0].getDefaultClass() );
return role;
+ }
+
+ /**
+ * Helper method to validate the input & output context's
+ * given to this module.
+ *
+ * @param context a <code>String</code> context value
+ * @exception Exception if an error occurs
+ */
+ private void validateContext( final String context )
+ throws Exception
+ {
+ if ( context.indexOf( CONTEXT_SEPARATOR ) == -1 )
+ throw new IllegalArgumentException(
+ "Module requires the role and xconf filename " +
+ "separated by a '" + CONTEXT_SEPARATOR + "' character"
+ );
}
// Normalized mappings for ECM lifestyles
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>