directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r905635 - /directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java
Date Tue, 02 Feb 2010 13:57:15 GMT
Author: pamarcelot
Date: Tue Feb  2 13:57:13 2010
New Revision: 905635

URL: http://svn.apache.org/viewvc?rev=905635&view=rev
Log:
Fix for DIRSTUDIO-624 (NPE in the SearchLogsViewUniversalListener.java under rare circumstances
when selecting a connection).

Modified:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java?rev=905635&r1=905634&r2=905635&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewUniversalListener.java
Tue Feb  2 13:57:13 2010
@@ -155,31 +155,36 @@
         {
             this.input = input;
 
-            // load file %u %g
-            StringBuffer sb = new StringBuffer();
             LdifSearchLogger searchLogger = ConnectionCorePlugin.getDefault().getLdifSearchLogger();
-            File[] files = searchLogger.getFiles( input.getBrowserConnection().getConnection()
);
-            int i = input.getIndex();
-            if ( 0 <= i && i < files.length && files[i] != null &&
files[i].exists() && files[i].canRead() )
+
+            if ( ( input != null ) && ( input.getBrowserConnection() != null )
+                && ( input.getBrowserConnection().getConnection() != null ) &&
( searchLogger != null ) )
             {
-                try
+                // load file %u %g
+                StringBuffer sb = new StringBuffer();
+                File[] files = searchLogger.getFiles( input.getBrowserConnection().getConnection()
);
+                int i = input.getIndex();
+                if ( 0 <= i && i < files.length && files[i] != null
&& files[i].exists() && files[i].canRead() )
                 {
-                    FileReader fr = new FileReader( files[i] );
-                    char[] cbuf = new char[4096];
-                    for ( int length = fr.read( cbuf ); length > 0; length = fr.read(
cbuf ) )
+                    try
                     {
-                        sb.append( cbuf, 0, length );
+                        FileReader fr = new FileReader( files[i] );
+                        char[] cbuf = new char[4096];
+                        for ( int length = fr.read( cbuf ); length > 0; length = fr.read(
cbuf ) )
+                        {
+                            sb.append( cbuf, 0, length );
+                        }
+                    }
+                    catch ( Exception e )
+                    {
+                        sb.append( e.getMessage() );
                     }
                 }
-                catch ( Exception e )
-                {
-                    sb.append( e.getMessage() );
-                }
-            }
 
-            // change input
-            view.getMainWidget().getSourceViewer().getDocument().set( sb.toString() );
-            view.getActionGroup().setInput( input );
+                // change input
+                view.getMainWidget().getSourceViewer().getDocument().set( sb.toString() );
+                view.getActionGroup().setInput( input );
+            }
         }
     }
 



Mime
View raw message