directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1085712 - /directory/studio/branches/1.5.x/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java
Date Sat, 26 Mar 2011 12:40:11 GMT
Author: seelmann
Date: Sat Mar 26 12:40:11 2011
New Revision: 1085712

URL: http://svn.apache.org/viewvc?rev=1085712&view=rev
Log:
Fix for DIRSTUDIO-703 (DSML Export fails to export when the size limit is hit)

Modified:
    directory/studio/branches/1.5.x/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java

Modified: directory/studio/branches/1.5.x/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.5.x/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java?rev=1085712&r1=1085711&r2=1085712&view=diff
==============================================================================
--- directory/studio/branches/1.5.x/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java
(original)
+++ directory/studio/branches/1.5.x/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java
Sat Mar 26 12:40:11 2011
@@ -61,7 +61,7 @@ import org.apache.directory.studio.conne
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.SearchParameter;
-
+import org.apache.directory.studio.ldapbrowser.core.utils.JNDIUtils;
 
 /**
  * This class implements a Job for Exporting a part of a LDAP Server into a DSML File.
@@ -252,16 +252,38 @@ public class ExportDsmlJob extends Abstr
         SearchResponseDsml sr = new SearchResponseDsml();
         batchResponse.addResponse( sr );
 
-        if ( !monitor.errorsReported() )
+        try
         {
-            // Creating and adding a search result entry or reference for each result
-            while ( ne.hasMore() )
+            int count = 0;
+
+            if ( !monitor.errorsReported() )
             {
-                SearchResult searchResult = ( SearchResult ) ne.next();
-                sr.addResponse( convertSearchResultToDsml( searchResult, searchParameter
) );
+                // Creating and adding a search result entry or reference for each result
+                while ( ne.hasMore() )
+                {
+                    SearchResult searchResult = ( SearchResult ) ne.next();
+                    sr.addResponse( convertSearchResultToDsml( searchResult, searchParameter
) );
+
+                    count++;
+                    monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__export_progress,
+                        new String[]
+                                   { Integer.toString( count ) } ) );
+                }
             }
         }
-
+        catch ( NamingException e )
+        {
+            int ldapStatusCode = JNDIUtils.getLdapStatusCode( e );
+            if ( ldapStatusCode == 3 || ldapStatusCode == 4 || ldapStatusCode == 11 )
+            {
+                // ignore
+            }
+            else
+            {
+                monitor.reportError( e );
+            }
+        }
+        
         // Creating and adding a search result done at the end of the results
         SearchResultDoneCodec srd = new SearchResultDoneCodec();
         LdapResultCodec ldapResult = new LdapResultCodec();
@@ -391,14 +413,36 @@ public class ExportDsmlJob extends Abstr
         // Creating the batch request
         BatchRequestDsml batchRequest = new BatchRequestDsml();
 
-        if ( !monitor.errorsReported() )
+        try
+        {
+            int count = 0;
+
+            if ( !monitor.errorsReported() )
+            {
+                // Creating and adding an add request for each result
+                while ( ne.hasMore() )
+                {
+                    SearchResult searchResult = ( SearchResult ) ne.next();
+                    AddRequestDsml arDsml = convertToAddRequestDsml( searchResult );
+                    batchRequest.addRequest( arDsml );
+
+                    count++;
+                    monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__export_progress,
+                        new String[]
+                                   { Integer.toString( count ) } ) );
+                }
+            }
+        }
+        catch ( NamingException e )
         {
-            // Creating and adding an add request for each result
-            while ( ne.hasMore() )
+            int ldapStatusCode = JNDIUtils.getLdapStatusCode( e );
+            if ( ldapStatusCode == 3 || ldapStatusCode == 4 || ldapStatusCode == 11 )
+            {
+                // ignore
+            }
+            else
             {
-                SearchResult searchResult = ( SearchResult ) ne.next();
-                AddRequestDsml arDsml = convertToAddRequestDsml( searchResult );
-                batchRequest.addRequest( arDsml );
+                monitor.reportError( e );
             }
         }
 



Mime
View raw message