View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package javax.faces.view.facelets;
20  
21  /**
22   * An Exception caused by a TagAttribute
23   */
24  public final class TagAttributeException extends FaceletException
25  {
26  
27      /**
28       * 
29       */
30      private static final long serialVersionUID = 1L;
31  
32      public TagAttributeException(TagAttribute attr)
33      {
34          super(attr.toString());
35      }
36  
37      public TagAttributeException(TagAttribute attr, String message)
38      {
39          super(attr + " " + message);
40      }
41  
42      public TagAttributeException(TagAttribute attr, String message, Throwable cause)
43      {
44          super(attr + " " + message, cause);
45      }
46  
47      public TagAttributeException(TagAttribute attr, Throwable cause)
48      {
49          super(attr + " " + cause.getMessage(), cause);
50      }
51  
52      /**
53       * 
54       */
55      public TagAttributeException(Tag tag, TagAttribute attr)
56      {
57          super(print(tag, attr));
58      }
59  
60      /**
61       * @param message
62       */
63      public TagAttributeException(Tag tag, TagAttribute attr, String message)
64      {
65          super(print(tag, attr) + " " + message);
66      }
67  
68      /**
69       * @param message
70       * @param cause
71       */
72      public TagAttributeException(Tag tag, TagAttribute attr, String message, Throwable cause)
73      {
74          super(print(tag, attr) + " " + message, cause);
75      }
76  
77      /**
78       * @param cause
79       */
80      public TagAttributeException(Tag tag, TagAttribute attr, Throwable cause)
81      {
82          super(print(tag, attr) + " " + cause.getMessage(), cause);
83      }
84  
85      private static String print(Tag tag, TagAttribute attr)
86      {
87          return tag.getLocation() + " <" + tag.getQName() + " " + attr.getQName() + "=\"" + attr.getValue() + "\">";
88      }
89  }