Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * JBoss, Home of Professional Open Source.
  * Copyright 2008, Red Hat Middleware LLC, and individual contributors
  * as indicated by the @author tags. See the copyright.txt file in the
  * distribution for a full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.jsfunit.jsfsession;
Exception indicates that a reference was made to a JSF component with a client ID suffix that matched more than one component on a page (client side) or in a component tree (server side). The message in this exception will tell you which client IDs matched the ID suffix.

Author(s):
Stan Silvert
Since:
1.0
{
   
   
Create a new DuplicateClientIDException.

Parameters:
clientIDSuffix The suffix that matched more than one component.
clientIDs The list of IDs that matched the clientIDSuffix.
   public DuplicateClientIDException(String clientIDSuffixList<StringclientIDs)
   {
      super(makeMessage(clientIDSuffixclientIDs));
   }
   
   
Create a new DuplicateClientIDException.

Parameters:
elements A list of Elements whose IDs matched the clientIDSuffix.
clientIDSuffix The suffix that matched more than one component.
   public DuplicateClientIDException(List elementsString clientIDSuffix)
   {
      this(clientIDSuffixconvertToStringList(elements));
   }
   
   private static List<StringconvertToStringList(List<Objectelements)
   {
      List<Stringids = new ArrayList<String>(elements.size());
      for (Iterator<Objecti = elements.iterator(); i.hasNext(); )
      {
         Element element = (Element)i.next();
         ids.add(element.getAttribute("id"));
      }
      return ids;
   }
   
   private static String makeMessage(String clientIDSuffixList<StringclientIDs)
   {
      String message = "'" + clientIDSuffix + "' matches more than one JSF component ID.  Use a more specific ID suffix.  Suffix matches: ";
      for (Iterator<Stringi = clientIDs.iterator(); i.hasNext();)
      {
         message += i.next();
         if (i.hasNext()) message += ", ";
      }
      
      return message;
   }
New to GrepCode? Check out our FAQ X