Author: ggregory
Date: Wed Aug 24 12:37:48 2005
New Revision: 239739

URL: http://svn.apache.org/viewcvs?rev=239739&view=rev
Log:
Refactor multiple instances of the same string literal into a default message 
string static.

Modified:
    
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/NotImplementedException.java

Modified: 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/NotImplementedException.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/NotImplementedException.java?rev=239739&r1=239738&r2=239739&view=diff
==============================================================================
--- 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/NotImplementedException.java
 (original)
+++ 
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/NotImplementedException.java
 Wed Aug 24 12:37:48 2005
@@ -51,6 +51,8 @@
 public class NotImplementedException
         extends UnsupportedOperationException implements Nestable {
 
+    private static final String DEFAULT_MESSAGE = "Code is not implemented";
+
     /** Serialization version. */
     private static final long serialVersionUID = -6894122266938754088L;
 
@@ -72,7 +74,7 @@
      * @since 2.1
      */
     public NotImplementedException() {
-        super("Code is not implemented");
+        super(DEFAULT_MESSAGE);
     }
 
     /**
@@ -82,7 +84,7 @@
      * @param msg  the error message.
      */
     public NotImplementedException(String msg) {
-        super(msg == null ? "Code is not implemented" : msg);
+        super(msg == null ? DEFAULT_MESSAGE : msg);
     }
 
     /**
@@ -93,7 +95,7 @@
      * @since 2.1
      */
     public NotImplementedException(Throwable cause) {
-        super("Code is not implemented");
+        super(DEFAULT_MESSAGE);
         this.cause = cause;
     }
 
@@ -106,23 +108,21 @@
      * @since 2.1
      */
     public NotImplementedException(String msg, Throwable cause) {
-        super(msg == null ? "Code is not implemented" : msg);
+        super(msg == null ? DEFAULT_MESSAGE : msg);
         this.cause = cause;
     }
 
     /**
-     * Constructs a new <code>NotImplementedException</code> referencing
-     * the specified class.
+     * Constructs a new <code>NotImplementedException</code> referencing the 
specified class.
      * 
-     * @param clazz  the <code>Class</code> that has not implemented the method
+     * @param clazz
+     *            the <code>Class</code> that has not implemented the method
      */
     public NotImplementedException(Class clazz) {
-        super((clazz == null ?
-                "Code is not implemented" :
-                "Code is not implemented in " + clazz));
+        super(clazz == null ? DEFAULT_MESSAGE : DEFAULT_MESSAGE + " in " + 
clazz);
     }
 
-    //-----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     /**
      * Gets the root cause of this exception.
      * @return the root cause of this exception.
@@ -163,9 +163,8 @@
     public String getMessage(int index) {
         if (index == 0) {
             return super.getMessage();
-        } else {
-            return delegate.getMessage(index);
         }
+        return delegate.getMessage(index);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to