You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/11/09 00:02:51 UTC

svn commit: r472682 - /directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java

Author: elecharny
Date: Wed Nov  8 15:02:50 2006
New Revision: 472682

URL: http://svn.apache.org/viewvc?view=rev&rev=472682
Log:
Fixed warnings by using generics

Modified:
    directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java

Modified: directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java?view=diff&rev=472682&r1=472681&r2=472682
==============================================================================
--- directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java (original)
+++ directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/RuntimeMultiException.java Wed Nov  8 15:02:50 2006
@@ -40,7 +40,7 @@
     static final long serialVersionUID = 8582253398936366771L;
 
     /** Collection of nested exceptions. */
-    private Collection m_nestedExceptions = new ArrayList();
+    private Collection<Throwable> nestedExceptions = new ArrayList<Throwable>();
 
 
     /**
@@ -55,12 +55,12 @@
     /**
      * Constructs an Exception with a detailed message.
      * 
-     * @param a_message
+     * @param message
      *            The message associated with the exception.
      */
-    public RuntimeMultiException(String a_message)
+    public RuntimeMultiException( String message )
     {
-        super( a_message );
+        super( message );
     }
 
 
@@ -69,9 +69,9 @@
      * 
      * @return an Iterator over the nested exceptions.
      */
-    public Iterator listNestedExceptions()
+    public Iterator<Throwable> listNestedExceptions()
     {
-        return m_nestedExceptions.iterator();
+        return nestedExceptions.iterator();
     }
 
 
@@ -82,7 +82,7 @@
      */
     public int size()
     {
-        return m_nestedExceptions.size();
+        return nestedExceptions.size();
     }
 
 
@@ -93,19 +93,18 @@
      */
     public boolean isEmpty()
     {
-        return m_nestedExceptions.isEmpty();
+        return nestedExceptions.isEmpty();
     }
 
 
     /**
      * Add an exeception to this multiexception.
      * 
-     * @param a_nested
-     *            exception to add to this MultiException.
+     * @param nested exception to add to this MultiException.
      */
-    public void addThrowable( Throwable a_nested )
+    public void addThrowable( Throwable nested )
     {
-        this.m_nestedExceptions.add( a_nested );
+        this.nestedExceptions.add( nested );
     }
 
 
@@ -117,29 +116,30 @@
      * Beside printing out the standard stack trace this method prints out the
      * stack traces of all the nested exceptions.
      * 
-     * @param an_out
-     *            PrintWriter to write the nested stack trace to.
+     * @param out PrintWriter to write the nested stack trace to.
      */
-    public void printStackTrace( PrintWriter an_out )
+    public void printStackTrace( PrintWriter out )
     {
-        super.printStackTrace( an_out );
+        super.printStackTrace( out );
 
-        an_out.println( "Nested exceptions to follow:\n" );
-        Iterator l_list = listNestedExceptions();
-        Throwable l_throwable = null;
-        while ( l_list.hasNext() )
+        out.println( "Nested exceptions to follow:\n" );
+        boolean isFirst = true;
+        
+        for ( Throwable throwable:nestedExceptions )
         {
-            l_throwable = ( Throwable ) l_list.next();
-            l_throwable.printStackTrace();
-            if ( l_list.hasNext() )
-            {
-                an_out.println( "\n\t<<========= Next Nested Exception" + " ========>>\n" );
+            if ( isFirst )
+            { 
+                isFirst = false; 
             }
             else
             {
-                an_out.println( "\n\t<<========= Last Nested Exception" + " ========>>\n" );
+                out.println( "\n\t<<========= Next Nested Exception" + " ========>>\n" );
             }
+
+            throwable.printStackTrace();
         }
+
+        out.println( "\n\t<<========= Last Nested Exception" + " ========>>\n" );
     }
 
 
@@ -147,29 +147,30 @@
      * Beside printing out the standard stack trace this method prints out the
      * stack traces of all the nested exceptions.
      * 
-     * @param an_out
-     *            PrintStream to write the nested stack trace to.
+     * @param out PrintStream to write the nested stack trace to.
      */
-    public void printStackTrace( PrintStream an_out )
+    public void printStackTrace( PrintStream out )
     {
-        super.printStackTrace( an_out );
+        super.printStackTrace( out );
+
+        out.println( "Nested exceptions to follow:\n" );
+        boolean isFirst = true;
 
-        an_out.println( "Nested exceptions to follow:\n" );
-        Iterator l_list = listNestedExceptions();
-        Throwable l_throwable = null;
-        while ( l_list.hasNext() )
+        for ( Throwable throwable:nestedExceptions )
         {
-            l_throwable = ( Throwable ) l_list.next();
-            l_throwable.printStackTrace();
-            if ( l_list.hasNext() )
-            {
-                an_out.println( "\n\t<<========= Next Nested Exception" + " ========>>\n" );
+            if ( isFirst )
+            { 
+                isFirst = false; 
             }
             else
             {
-                an_out.println( "\n\t<<========= Last Nested Exception" + " ========>>\n" );
+                out.println( "\n\t<<========= Next Nested Exception" + " ========>>\n" );
             }
+
+            throwable.printStackTrace();
         }
+
+        out.println( "\n\t<<========= Last Nested Exception" + " ========>>\n" );
     }