directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r582279 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/NestableDelegate.java
Date Fri, 05 Oct 2007 14:09:15 GMT
Author: elecharny
Date: Fri Oct  5 07:09:14 2007
New Revision: 582279

URL: http://svn.apache.org/viewvc?rev=582279&view=rev
Log:
Removed some warnings using generics

Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/NestableDelegate.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/NestableDelegate.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/NestableDelegate.java?rev=582279&r1=582278&r2=582279&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/NestableDelegate.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/NestableDelegate.java
Fri Oct  5 07:09:14 2007
@@ -27,7 +27,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 
@@ -260,18 +259,21 @@
      *             chain
      * @since 2.0
      */
-    public int indexOfThrowable( Class type, int fromIndex )
+    public int indexOfThrowable( Class<?> type, int fromIndex )
     {
         if ( fromIndex < 0 )
         {
             throw new IndexOutOfBoundsException( "The start index was out of bounds: " +
fromIndex );
         }
+        
         Throwable[] throwables = ExceptionUtils.getThrowables( this.nestable );
+        
         if ( fromIndex >= throwables.length )
         {
             throw new IndexOutOfBoundsException( "The start index was out of bounds: " +
fromIndex + " >= "
                 + throwables.length );
         }
+        
         for ( int i = fromIndex; i < throwables.length; i++ )
         {
             if ( throwables[i].getClass().equals( type ) )
@@ -279,6 +281,7 @@
                 return i;
             }
         }
+        
         return -1;
     }
 
@@ -365,17 +368,23 @@
 
         synchronized ( out )
         {
-            for ( Iterator iter = stacks.iterator(); iter.hasNext(); )
+            boolean isFirst = true;
+            
+            for ( String[] st:stacks )
             {
-                String[] st = ( String[] ) iter.next();
-                for ( int i = 0, len = st.length; i < len; i++ )
+                if ( isFirst )
                 {
-                    out.println( st[i] );
+                    isFirst = false;
                 }
-                if ( iter.hasNext() )
+                else
                 {
                     out.print( separatorLine );
                 }
+
+                for ( String s:st )
+                {
+                    out.println( s );
+                }
             }
         }
     }
@@ -417,18 +426,19 @@
      *            The list containing String[] elements
      * @since 2.0
      */
-    protected void trimStackFrames( List stacks )
+    protected void trimStackFrames( List<String[]> stacks )
     {
         for ( int size = stacks.size(), i = size - 1; i > 0; i-- )
         {
-            String[] curr = ( String[] ) stacks.get( i );
-            String[] next = ( String[] ) stacks.get( i - 1 );
+            String[] curr = stacks.get( i );
+            String[] next = stacks.get( i - 1 );
 
-            List currList = new ArrayList( Arrays.asList( curr ) );
-            List nextList = new ArrayList( Arrays.asList( next ) );
+            List<String> currList = new ArrayList<String>( Arrays.asList( curr
) );
+            List<String> nextList = new ArrayList<String>( Arrays.asList( next
) );
             ExceptionUtils.removeCommonFrames( currList, nextList );
 
             int trimmed = curr.length - currList.size();
+            
             if ( trimmed > 0 )
             {
                 currList.add( "\t... " + trimmed + " more" );



Mime
View raw message