directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1082253 - /directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
Date Wed, 16 Mar 2011 18:35:39 GMT
Author: pamarcelot
Date: Wed Mar 16 18:35:39 2011
New Revision: 1082253

URL: http://svn.apache.org/viewvc?rev=1082253&view=rev
Log:
Fixed NPEs when some attributes are missing from the RootDSE.

Modified:
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java?rev=1082253&r1=1082252&r2=1082253&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
Wed Mar 16 18:35:39 2011
@@ -302,16 +302,34 @@ public class InitializeRootDSERunnable i
         // Set detected connection properties
         DetectedConnectionProperties detectedConnectionProperties = browserConnection.getConnection()
             .getDetectedConnectionProperties();
-        detectedConnectionProperties.setVendorName( browserConnection.getRootDSE().getAttribute(
"vendorName" )
-            .getStringValue() );
-        detectedConnectionProperties.setVendorVersion( browserConnection.getRootDSE().getAttribute(
"vendorVersion" )
-            .getStringValue() );
-        detectedConnectionProperties.setSupportedControls( Arrays.asList( browserConnection.getRootDSE()
-            .getAttribute( "supportedControl" ).getStringValues() ) );
-        detectedConnectionProperties.setSupportedExtensions( Arrays.asList( browserConnection.getRootDSE()
-            .getAttribute( "supportedExtension" ).getStringValues() ) );
-        detectedConnectionProperties.setSupportedFeatures( Arrays.asList( browserConnection.getRootDSE()
-            .getAttribute( "supportedFeatures" ).getStringValues() ) );
+        IAttribute vendorNameAttribute = browserConnection.getRootDSE().getAttribute( "vendorName"
);
+        if ( ( vendorNameAttribute != null ) && ( vendorNameAttribute.getValueSize()
> 0 ) )
+        {
+            detectedConnectionProperties.setVendorName( vendorNameAttribute.getStringValue()
);
+        }
+        IAttribute vendorVersionAttribute = browserConnection.getRootDSE().getAttribute(
"vendorVersion" );
+        if ( ( vendorVersionAttribute != null ) && ( vendorVersionAttribute.getValueSize()
> 0 ) )
+        {
+            detectedConnectionProperties.setVendorVersion( vendorVersionAttribute.getStringValue()
);
+        }
+        IAttribute supportedControlAttribute = browserConnection.getRootDSE().getAttribute(
"supportedControl" );
+        if ( ( supportedControlAttribute != null ) && ( supportedControlAttribute.getValueSize()
> 0 ) )
+        {
+            detectedConnectionProperties.setSupportedControls( Arrays.asList( supportedControlAttribute
+                .getStringValues() ) );
+        }
+        IAttribute supportedExtensionAttribute = browserConnection.getRootDSE().getAttribute(
"supportedExtension" );
+        if ( ( supportedExtensionAttribute != null ) && ( supportedExtensionAttribute.getValueSize()
> 0 ) )
+        {
+            detectedConnectionProperties.setSupportedExtensions( Arrays.asList( supportedExtensionAttribute
+                .getStringValues() ) );
+        }
+        IAttribute supportedFeaturesAttribute = browserConnection.getRootDSE().getAttribute(
"supportedFeatures" );
+        if ( ( supportedFeaturesAttribute != null ) && ( supportedFeaturesAttribute.getValueSize()
> 0 ) )
+        {
+            detectedConnectionProperties.setSupportedFeatures( Arrays.asList( supportedFeaturesAttribute
+                .getStringValues() ) );
+        }
         detectedConnectionProperties
             .setServerType( ServerTypeDetector.detectServerType( browserConnection.getRootDSE()
) );
 



Mime
View raw message