[jdom-interest] Attribute constructor JavaDoc path

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed May 15 15:57:20 PDT 2002


The attached patch adds better JavaDoc @throws comments for the 
constructors in the Attribute class that throw runtime exceptions. It 
syncs them up with the setter methods they call. I did not add throws 
clauses for these exceptions since consensus seemed to be against using 
throws from runtime exceptions as per Bloch, Effective Java.  This patch 
should only change the comments. It should have no effect on the actual 
code.

If this works and you like it, I can send similar patches for the other 
org.jdom classes.

-- 
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|           The XML Bible, 2nd Edition (IDG Books, 2001)             |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:   http://www.cafeaulait.org/     | 
|  Read Cafe con Leche for XML News:  http://www.cafeconleche.org/   |
+----------------------------------+---------------------------------+

-------------- next part --------------
Index: src/java/org/jdom/Attribute.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/Attribute.java,v
retrieving revision 1.43
diff -d -u -r1.43 Attribute.java
--- src/java/org/jdom/Attribute.java	2002/04/29 13:38:15	1.43
+++ src/java/org/jdom/Attribute.java	2002/05/16 07:00:32
@@ -196,6 +196,12 @@
      * @param name <code>String</code> name of <code>Attribute</code>.
      * @param value <code>String</code> value for new attribute.
      * @param namespace <code>Namespace</code> namespace for new attribute.
+     * @throws IllegalNameException if the given name is illegal as an
+     *         attribute name or if if the new namespace is the default
+     *         namespace. Attributes cannot be in a default namespace.
+     * @throws IllegalDataException if the given attribute value is
+     *         illegal character data (as determined by
+     *         {@link org.jdom.Verifier#checkCharacterData}).
      */
     public Attribute(String name, String value, Namespace namespace) {
         setName(name);
@@ -212,6 +218,14 @@
      * @param value <code>String</code> value for new attribute.
      * @param type <code>int</code> type for new attribute.
      * @param namespace <code>Namespace</code> namespace for new attribute.
+     * @throws IllegalNameException if the given name is illegal as an
+     *         attribute name or if if the new namespace is the default
+     *         namespace. Attributes cannot be in a default namespace.
+     * @throws IllegalDataException if the given attribute value is
+     *         illegal character data (as determined by
+     *         {@link org.jdom.Verifier#checkCharacterData}) or
+     *         if the given attribute type is not one of the 
+     *         supported types.
      */
     public Attribute(String name, String value, int type, Namespace namespace) {
         setName(name);
@@ -231,6 +245,11 @@
      *
      * @param name <code>String</code> name of <code>Attribute</code>.
      * @param value <code>String</code> value for new attribute.
+     * @throws IllegalNameException if the given name is illegal as an
+     *         attribute name.
+     * @throws IllegalDataException if the given attribute value is
+     *         illegal character data (as determined by
+     *         {@link org.jdom.Verifier#checkCharacterData}).
      */
     public Attribute(String name, String value) {
         this(name, value, UNDECLARED_ATTRIBUTE, Namespace.NO_NAMESPACE);
@@ -248,6 +267,13 @@
      * @param name <code>String</code> name of <code>Attribute</code>.
      * @param value <code>String</code> value for new attribute.
      * @param type <code>int</code> type for new attribute.
+     * @throws IllegalNameException if the given name is illegal as an
+     *         attribute name.
+     * @throws IllegalDataException if the given attribute value is
+     *         illegal character data (as determined by
+     *         {@link org.jdom.Verifier#checkCharacterData}) or
+     *         if the given attribute type is not one of the 
+     *         supported types.
      */
     public Attribute(String name, String value, int type) {
         this(name, value, type, Namespace.NO_NAMESPACE);


More information about the jdom-interest mailing list