View Javadoc

1   package cz.cuni.amis.pogamut.sposh.exceptions;
2   
3   import cz.cuni.amis.pogamut.sposh.elements.ParseException;
4   import java.text.MessageFormat;
5   
6   /**
7    * Thrown when trying to add element into the posh tree, but the tree already
8    * contains element with the same name.
9    * @author Honza
10   */
11  public class DuplicateNameException extends ParseException {
12  
13      public static DuplicateNameException create(String name) {
14          String msg = MessageFormat.format("Another element is already using ''{0}''.", name);
15          return new DuplicateNameException(msg);
16      }
17  
18      public DuplicateNameException(String message) {
19          super(message);
20      }
21  }