[jboss-cvs] jboss-seam/src/main/org/jboss/seam/init ...

Gavin King gavin.king at jboss.com
Fri Jun 22 18:22:59 EDT 2007


  User: gavin   
  Date: 07/06/22 18:22:59

  Modified:    src/main/org/jboss/seam/init  Initialization.java
  Log:
  fix breakage, and validate @Namespace declarations
  
  Revision  Changes    Path
  1.185     +13 -2     jboss-seam/src/main/org/jboss/seam/init/Initialization.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Initialization.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/init/Initialization.java,v
  retrieving revision 1.184
  retrieving revision 1.185
  diff -u -b -r1.184 -r1.185
  --- Initialization.java	22 Jun 2007 21:57:00 -0000	1.184
  +++ Initialization.java	22 Jun 2007 22:22:59 -0000	1.185
  @@ -186,7 +186,14 @@
         {
            String ns = elem.getNamespace().getURI();
            NamespaceDescriptor nsInfo = namespaceMap.get(ns);
  -         if (nsInfo != null)
  +         if (nsInfo == null )
  +         {
  +            if ( ns!=null && !ns.equals("http://jboss.com/products/seam/components") )
  +            {
  +               log.warn("namespace declared in components.xml does not resolve to a package annotated @Namespace: " + ns);
  +            }
  +         }
  +         else
            {
               String name = elem.attributeValue("name");
               String elemName = toCamelCase( elem.getName(), true );
  @@ -711,7 +718,11 @@
            if (ns != null)
            {
               log.info("Namespace: " + ns.value() + ", package: " + pkg.getName() + ", prefix: " + ns.prefix());
  -            namespaceMap.put(ns.value(), new NamespaceDescriptor(ns, pkg));
  +            NamespaceDescriptor old = namespaceMap.put(ns.value(), new NamespaceDescriptor(ns, pkg));
  +            if ( old!=null && !old.getPackage().equals(pkg) )
  +            {
  +               throw new IllegalStateException("two packages with the same @Namespace: " + ns.value());
  +            }
            }
         }
      }
  
  
  



More information about the jboss-cvs-commits mailing list