You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2010/10/08 19:17:12 UTC
svn commit: r1005913 -
/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java
Author: pamarcelot
Date: Fri Oct 8 17:17:12 2010
New Revision: 1005913
URL: http://svn.apache.org/viewvc?rev=1005913&view=rev
Log:
Fix for DIRSTUDIO-703 (DSML Export fails to export when the size limit is hit).
Modified:
directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java
Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java?rev=1005913&r1=1005912&r2=1005913&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlRunnable.java Fri Oct 8 17:17:12 2010
@@ -62,6 +62,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;
/**
@@ -259,25 +260,45 @@ public class ExportDsmlRunnable implemen
* the monitor
* @param searchParameter
* the search parameter
- * @throws NamingException
* @throws LdapURLEncodingException
* @throws LdapException
*/
public static void processAsDsmlResponse( StudioNamingEnumeration ne, BatchResponseDsml batchResponse,
- StudioProgressMonitor monitor, SearchParameter searchParameter ) throws NamingException,
- LdapURLEncodingException, LdapException
+ StudioProgressMonitor monitor, SearchParameter searchParameter ) throws LdapURLEncodingException, LdapException
{
// Creating and adding the search response
SearchResponseDsml sr = new SearchResponseDsml();
batchResponse.addResponse( sr );
- if ( !monitor.errorsReported() )
+ try
+ {
+ int count = 0;
+
+ if ( !monitor.errorsReported() )
+ {
+ // 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 )
{
- // Creating and adding a search result entry or reference 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();
- sr.addResponse( convertSearchResultToDsml( searchResult, searchParameter ) );
+ monitor.reportError( e );
}
}
@@ -408,14 +429,36 @@ public class ExportDsmlRunnable implemen
// 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 );
}
}