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 2013/03/20 18:07:36 UTC

svn commit: r1458955 - /directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsExporter.java

Author: pamarcelot
Date: Wed Mar 20 17:07:36 2013
New Revision: 1458955

URL: http://svn.apache.org/r1458955
Log:
Fix for DIRSTUDIO-891 (A schema project containing a reference to a deleted connection makes the perspective completely unusable).

Modified:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsExporter.java

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsExporter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsExporter.java?rev=1458955&r1=1458954&r2=1458955&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsExporter.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsExporter.java Wed Mar 20 17:07:36 2013
@@ -22,6 +22,7 @@ package org.apache.directory.studio.sche
 
 import java.util.List;
 
+import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.schemaeditor.model.Project;
 import org.apache.directory.studio.schemaeditor.model.ProjectType;
 import org.apache.directory.studio.schemaeditor.model.Schema;
@@ -128,11 +129,21 @@ public class ProjectsExporter
             // If project is an Online Schema Project
             if ( type.equals( ProjectType.ONLINE ) )
             {
-                // Connection Name
-                element.addAttribute( CONNECTION_TAG, project.getConnection().getId() );
+                // Connection ID
+                Connection connection = project.getConnection();
 
-                // Connection Name
-                element.addAttribute( SCHEMA_CONNECTOR_TAG, project.getSchemaConnector().getId() );
+                if ( connection != null )
+                {
+                    element.addAttribute( CONNECTION_TAG, connection.getId() );
+                }
+
+                // Schema Connection ID
+                SchemaConnector schemaConnector = project.getSchemaConnector();
+
+                if ( schemaConnector != null )
+                {
+                    element.addAttribute( SCHEMA_CONNECTOR_TAG, project.getSchemaConnector().getId() );
+                }
 
                 // Schema Backup
                 Element schemaBackupElement = element.addElement( SCHEMA_BACKUP_TAG );