[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...
Gavin King
gavin.king at jboss.com
Fri Jul 6 21:28:17 EDT 2007
User: gavin
Date: 07/07/06 21:28:17
Modified: src/main/org/jboss/seam Component.java
Log:
validate characters in component names
Revision Changes Path
1.268 +25 -8 jboss-seam/src/main/org/jboss/seam/Component.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Component.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
retrieving revision 1.267
retrieving revision 1.268
diff -u -b -r1.267 -r1.268
--- Component.java 25 Jun 2007 23:59:30 -0000 1.267
+++ Component.java 7 Jul 2007 01:28:16 -0000 1.268
@@ -216,14 +216,8 @@
type = Seam.getComponentType( getBeanClass() );
interceptionEnabled = Seam.isInterceptionEnabled( getBeanClass() );
- if ( getBeanClass().isInterface() )
- {
- throw new IllegalArgumentException("component class is an interface: " + name);
- }
- if ( Modifier.isAbstract( getBeanClass().getModifiers() ) )
- {
- throw new IllegalArgumentException("component class is abstract: " + name);
- }
+ checkName();
+ checkNonabstract();
initNamespaces(componentName, applicationContext);
initSynchronize();
@@ -260,6 +254,29 @@
}
+ private void checkName()
+ {
+ for ( char c: name.toCharArray() )
+ {
+ if ( !Character.isJavaIdentifierPart(c) && c!='.' )
+ {
+ throw new IllegalStateException("not a valid Seam component name: " + name);
+ }
+ }
+ }
+
+ private void checkNonabstract()
+ {
+ if ( getBeanClass().isInterface() )
+ {
+ throw new IllegalArgumentException("component class is an interface: " + name);
+ }
+ if ( Modifier.isAbstract( getBeanClass().getModifiers() ) )
+ {
+ throw new IllegalArgumentException("component class is abstract: " + name);
+ }
+ }
+
private void initStartup()
{
startup = getBeanClass().isAnnotationPresent(Startup.class);
More information about the jboss-cvs-commits
mailing list